Recall & Review
beginner
What does 'dependency between tests' mean in software testing?
It means one test relies on another test to run first or to pass before it can run correctly.
Click to reveal answer
beginner
Why should we avoid dependencies between tests?
Because if one test fails, dependent tests may also fail, making it hard to find the real problem.
Click to reveal answer
intermediate
How can you declare a test dependency in TestNG with Selenium Java?
Use the @Test annotation with 'dependsOnMethods' attribute, for example: @Test(dependsOnMethods = {"testLogin"})
Click to reveal answer
intermediate
What happens if a test that others depend on fails in TestNG?
The dependent tests are skipped automatically to avoid false failures.
Click to reveal answer
beginner
Give one real-life example of test dependency.
Testing 'Add to Cart' depends on 'Login' test passing first, because you must be logged in to add items.
Click to reveal answer
In TestNG, how do you specify that a test depends on another test?
✗ Incorrect
The correct way is to use @Test with dependsOnMethods attribute listing the method names.
What is a risk of having dependencies between tests?
✗ Incorrect
If one test fails, dependent tests may skip or fail, hiding the real issue.
If test A depends on test B, and test B fails, what happens to test A in TestNG?
✗ Incorrect
TestNG skips dependent tests if the tests they depend on fail.
Which of the following is a good practice regarding test dependencies?
✗ Incorrect
Avoiding dependencies helps tests run independently and makes debugging easier.
What attribute in TestNG @Test annotation controls test dependencies?
✗ Incorrect
dependsOnMethods specifies which tests must run and pass before the current test.
Explain what test dependency is and why it can be problematic.
Think about how one test relying on another can affect test results.
You got /3 concepts.
Describe how to declare a test dependency in Selenium Java using TestNG and what happens if the dependent test fails.
Recall the TestNG annotation and test execution flow.
You got /3 concepts.