Java Test Automation / Quiz

Dependency Scopes: test Means Test

compile, provided, runtime, test. Which classpath each scope feeds, and why TestNG imports explode when they wander into src/main.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
8 min

// MISSION BRIEF

Your Mission

Every dependency in a pom carries a scope, and the scope decides which classpaths it joins: compiling main code, compiling tests, running tests, shipping. Testers meet this the hard way, usually via package org.testng does not exist.

This quiz covers the scopes that matter for test code and the classic failure signatures of getting them wrong.

// FIRST CONTACT

Battle teaser

<scope>test</scope> makes a dependency available:

  1. AOnly for compiling and running code under src/test; src/main cannot see it, and it is never packaged
  2. BAt runtime in production, but not during builds
  3. CEverywhere, but with a warning
  4. DOnly in the IDE, never in CI
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javamavendependency-scope