Показаны сообщения с ярлыком reports. Показать все сообщения
Показаны сообщения с ярлыком reports. Показать все сообщения

2018-01-17

TestNG, skipped tests and "why" related information.


 As usually there are passed, failed and skipped tests. TestNG map skip tests due to failures in
precondition steps (i.e. somewhere inside all those @BeforeSuite/Group/Method routines). In such a case there is no quick-human-readable
explanation why a test was skipped. That is a pity, so what about the following:
1. Go to TestListenerAdapter#onTestSkipped(ITestResult result);
2. Check Throwable of that ITestResult;
3. If null then get skipped configurations - result.getTestContext().getSkippedConfigurations();
4. I haven't found a straight way to link skipped configuration and skipped test, but one could try to do that via TestContext/TestClass:
check whether skippedConfig.getTestClass().equals(result.getTestClass()))
5. If there is skipped config caused the test to be skipped then use result.setThrowable() to transfer throwable to ITestResult;
6. No guarantees but seems to work.

2015-12-03

You should read documentation, really - Allure reports + TestNG and run from command line.

 One have to read documentation, no options! It clearly stated that you have to run java process in a special way if you want to get steps, attachments etc info in your Allure report upon running a TestNG based test set.  And no, I had to spend two hours just to re-read the spec and discover that aspectjweaver dependency! And only after that it became clear that here is the way:

aspectjweaver_jar_file_name="$(ls ./lib/aspectjweaver-*.jar | xargs echo)"
java -ea -javaagent:"$aspectjweaver_jar_file_name" -cp "${full_classpath}" org.testng.TestNG ./test_suites/$testXmlName