Skip to content
Sharp

Testing · interview question

In a Maven project, where should you define your test dependencies to ensure they are included only in the test classpath?

Multiple choiceMediumchapter-10-curatedpremiumtestingunit-testing-with-junit
Choose one answer
Answer and explanation

Correct answer

D. <scope>test</scope>

Why

By setting the test dependencies with <scope>test</scope>, they are included only in the test classpath and not in the main build, preventing unnecessary dependencies from being packaged with the application.

Test yourself on Testing

A free test with instant, explained results. No account needed.

Start free test
All Testing questions →