We all have various testng groups added/modified/deleted each time we update our test cases. Many a times we would want to run only a single testng group though! Failing tests?
Pre Condition: My Test Automation Suite is based on Selenium-Ant-Testng
Don't forget to run your tests you can use the following option from commandline: -Dtestng.groups=
Pre Condition: My Test Automation Suite is based on Selenium-Ant-Testng
- When we want to run a single testng group lets say "sereUnitTests":
- If you don't have a beforemethod/beforetest/beforeclass annotation, then you should check your code...Its possible that something went wrong at the code level
- If you have a beforemethod/beforetest/beforeclass annotation, then you should check for the groups listed under each annotation
- For Ex: my beforemethod looks like this:
- @BeforeMethod(groups={"unit", "integration"})
- public void openReader() throws SeleniumException {
- // Some functionality
- }
- But I see that the group which I wanted to run isn't listed thus testng notices that there is a before method to be initiated before your actual tests run but then doesn't see your method name listed thus ignores the before method thus skipping all the function's content...Its highly possible that we have our initialization listed here thus our tests fail!!!!
- When we delete/add/modify a testng group, we should verify the following:
- Verify that your group is added/modified/deleted from all the annotations like BeforeMethod, AfterMethod etc...
- Also, see if you have any overrides, if you do then you should do the modifications there too!
Don't forget to run your tests you can use the following option from commandline: -Dtestng.groups=
Comments