0
0
Selenium Javatesting~10 mins

Dependency between tests in Selenium Java - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to mark the test method as dependent on another test.

Selenium Java
@Test(dependsOnMethods = [1])
public void testLogin() {
    // test code here
}
Drag options to blanks, or click blank then click option'
AtestSetup
B{"testSetup"}
C"testLogin"
D"testLogout"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the method name in quotes.
Using the wrong method name.
2fill in blank
medium

Complete the code to skip the test if the dependent test fails.

Selenium Java
@Test(dependsOnMethods = {"testSetup"}, [1] = false)
public void testFeature() {
    // test code here
}
Drag options to blanks, or click blank then click option'
AskipFailedDependencies
BignoreFailures
Cenabled
DalwaysRun
Attempts:
3 left
💡 Hint
Common Mistakes
Using skipFailedDependencies (invalid attribute).
Using enabled which controls if the test runs at all.
3fill in blank
hard

Fix the error in the test dependency annotation to correctly depend on testInit.

Selenium Java
@Test(dependsOnMethods = [1])
public void testProcess() {
    // test code
}
Drag options to blanks, or click blank then click option'
A"testProcess"
BtestInit
C{"testInit"}
D"initTest"
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the method name.
Using a wrong method name.
4fill in blank
hard

Fill both blanks to create a test that depends on testLogin and skips if it fails.

Selenium Java
@Test(dependsOnMethods = [1], [2] = false)
public void testDashboard() {
    // test code
}
Drag options to blanks, or click blank then click option'
A{"testLogin"}
BskipFailedDependencies
CalwaysRun
D"testLogin"
Attempts:
3 left
💡 Hint
Common Mistakes
Not using braces for dependsOnMethods array.
Using skipFailedDependencies instead of alwaysRun.
5fill in blank
hard

Fill both blanks to create a test depending on testSetup and testLogin, skipping if either fails.

Selenium Java
@Test(dependsOnMethods = [1], [2] = false)
public void testFinal() {
    // test code
}
Drag options to blanks, or click blank then click option'
A{"testSetup", "testLogin"}
BskipFailedDependencies
CalwaysRun
Denabled
Attempts:
3 left
💡 Hint
Common Mistakes
Not using an array for multiple dependencies.
Using skipFailedDependencies instead of alwaysRun.
Setting alwaysRun to true instead of false.