0
0
Selenium Javatesting~5 mins

Dependency between tests in Selenium Java - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A@Test(dependsOnMethods = {"methodName"})
B@DependsOnTest("methodName")
C@Test(priority = 1)
D@Test(enabled = false)
What is a risk of having dependencies between tests?
ATests run faster
BTests become independent
CTests always pass
DFailure in one test can cause others to skip or fail
If test A depends on test B, and test B fails, what happens to test A in TestNG?
ATest A runs anyway
BTest A passes automatically
CTest A is skipped
DTest A runs before test B
Which of the following is a good practice regarding test dependencies?
AAvoid dependencies to keep tests independent
BMake all tests dependent on each other
CWrite tests that never fail
DRun tests in random order
What attribute in TestNG @Test annotation controls test dependencies?
Apriority
BdependsOnMethods
Cenabled
Dgroups
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.