Cedric,
I want to achieve the following but am struggling to find a combination of annotations and configuration to achieve it;
Set up;
- Classes contain multiple test methods
- Classes have @BeforeClass, @AfterClass methods which interact with private properties which are then referenced in each test;
-Classes extend a base test class with @BeforeMethod and @AfterMethod inherited
- All test methods are annotated with @Test(timeOut = 300000)
- Tests run via Maven surefire plugin with;
<parallel>classes</parallel>
<threadCount>5</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
-Maven run via TeamCity on MacMini server
- Test results written by ReportNG listener
Aim;
If @BeforeClass fails, do not run any tests but mark all tests as skipped
if @BeforeTest fails, mark that test as failed or skipped but continue to next test method in class and re-run @BeforeTest (OR mark all tests in that class as skipped)
If test time out occurs after 5 minutes of test method running, mark that test as failed or skipped BUT continue to run other test methods in that class (OR mark all other tests in that class as skipped)
If error occurs during @AfterTest, still run other tests in class
Can this be achieved? I haven't worked out the pattern yet, but if tests timeout, then subsequent tests in that class are neither completed nor marked as skipped, so the total number of tests in the results is incorrect. My minimum requirement is that the total number of tests is correct even if subsequent tests are marked as skipped although ideally I would like them to run as well.
Interestingly, if I look at the output which contains thread info (sorry, I can't remember the name of the html file, and don't have access to TeamCity at the moment), then I can see a subsequent test start in the same thread as the timeout test but never finish and that thread isn't used again.
Is the problem that Timeout closes the thread, therefore making subsequent tests unable to run?
Thanks
Robbie