I Am running my test cases via TestNG runner class,but the problem is when there is only 1 class in runner class all tests are executed correctly. correct execution xml Whereas if There are more than 1 classes in runner class I get ignored Test cases and suite runs only 1 test cases(method) only from both classes . Can someone please suggest.
2 Answers
Try @Test(alwaysRun = true)
, For before methods (beforeSuite
, beforeTest
, beforeTestClass
and beforeTestMethod
, but not beforeGroups
): If set to true, this configuration method will be run regardless of what groups it belongs to.
For after methods (afterSuite
, afterClass
, ...): If set to true, this configuration method will be run even if one or more methods invoked previously failed or was skipped.
Thanks to Arun
I did run some more tests on the same and below solution worked.
I had provided same @priority
number to different test cases in different test classes, which confused the XML file maybe and it ran only 1 test case from both.
I changed sequential priorities like 1-4 then in next class 4-9(5 Tcases).It worked
However still not sure why test ng didn't gave any error message for the same and just passed as test cases ignored.