Skip to content
Sharp

Testing · interview question

If a JUnit test for an e-commerce shopping cart fails intermittently, what might be a likely cause?

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

Correct answer

B. A dependency has non-deterministic behavior.

Why

Intermittent test failures often result from non-deterministic behavior in dependencies, such as random values or time-based logic. This inconsistency causes tests to pass or fail unpredictably.

Test yourself on Testing

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

Start free test
All Testing questions →