Closed tlytvyn closed 9 years ago
@tlytvyn are your AspectJ settings correct?
In current implementation of TestNG adapter we are showing only failed TestNG configuration methods in the report. Method annotated with @AfterMethod is considered as configuration method. Anyway you should not annotate any of TestNG annotated methods with Allure's @Step annotation as they will be shown as Test Case in the Allure report not as the Step.
@braimanm thank you for clarification. TestNG for us is like a barrel with gunpowder. Nobody knows when and where it explodes.
@vania-pooh I am using the next settings - attachments are working for me but as I mentioned above only, but not in other listeners methods like (public void onFinish(ITestContext testContext)) or in Before and After methods for testng annotations
@braimanm Yes, I understand that, but what about other listeners like (public void onFinish(ITestContext testContext)) ??
onFinish event is triggered once at the end of suite execution. Tell me what you would like to achieve and I might help you.
@braimanm I would like to attach all test log file to reporter, so whether I am attaching here onTestFailure(ITestResult result), onTestPass(ITestResult result), etc - that file doesn't include log text that was logged in @After annotations. But wheher I will be able to attach it on test finish - it will include. onFinish is called on test finished - not suite, I take it from TestListenerAdapter.
Usually you don’t include Before and After methods in your report as they are not part of your test itself rather they are part of the test configuration. The only rational reason to show the configuration method in report is when they are failing. But if you would like to hook your code to configuration methods you should use methods of IConfigurationListener interface which are: onConfigurationSuccess , onConfigurationFailure and onConfigurationSkip.
@braimanm so that IConfigurationListener listener methods could be annotated as steps with attachments ?
You can extend AllureTestListener class and override IConfigurationListener methods.
Seems like you solve the problem. You can reopen if needed
I have such code:
@Step("After method step:") @AfterMethod public void tearDownTestBaseMethod(Method method) { LOG.info("Post Condition TEAR DOWN for method: " + method.getName()); TestLogHelper.stopTestLoggingSeparateMethod(); TestListenerUtil.attachLogToReporter(System.getProperty("logTestFolder"), method.getName()); }
where attachLogToReporter is marked with @Attachment(value = "Test log during execution for \"{1}\"", type="text/plain")
After test execution attachment is created in report folder near xml file but I can't see step in generated xml and in maven report as a result.
I also tried to extend TestListenerAdapter
and overrided there a method @Step("Test ended") @Override public void onFinish(ITestContext testContext) { TestListenerUtil.attachLogToReporter(System.getProperty("logTestFolder"), "demoTest"); }
result is the same.
But if we mark such methods with @step annotation like: onTestFailure(ITestResult result), onTestPass(ITestResult result), etc
we can see steps in report.
How to fix that or is there any wariant to handle that ability ???
Thank you