Selenium and TestNG Using Both 'dependsOn' and 'priority =' Issue
I am working on implementing better workflow control in my GUI automation
tests. And I first started with dependsOn but quickly found the drawback
is that if one test fails, the whole rest of the suite is not run. So I
switched to using 'priority=' but am seeing unexpected behavior. One
example:
@Test(priority = 10)
public void login(){...}
@Test(priority = 20, dependsOnMethods = "login")
public void verifyUserLogin() {...}
@Test(priority = 30, dependsOnMethods = "verifyUserLogin")
public void navigateToReportSettings() {...}
@Test(priority = 40, dependsOnMethods = "navigateToReportSettings")
public void verifyGeneralSettings() {...}
@Test(priority = 40, dependsOnMethods = "navigateToReportSettings")
public void verifyReportingPeriod() {...}
...
@Test(priority = 90, dependsOnMethods = "navigateToReportSettings")
public void saveReportSettings() {...}
What I want to happen:
Login.
Verify user is logged in.
Navigate to report settings page.
Verify the general settings and reporting period on the report settings
page (in any order)
Make some changes and save.
Important: 10, 20, and 30 must succeed or skip the rest. If any 40 fails
continue to 50 after all 40 have completed. But without dependency on any
step 40s to succeed!
What is happening:
Login (priority 10).
Save (priority 90).
Note: there are also 'groups' annotations but I don't think that is
relevant here. Thanks in advance for any tips on how to combine priority
and dependsOn successfully to control workflow, but with dependencies only
used where needed.
No comments:
Post a Comment