selenium-java-lean-test-architecture
selenium-java-lean-test-architecture copied to clipboard
cannot attach the screenshot to the allure report
When I run "mvn clean test", there is a Error generated with below information: "[TestNG-tests-1] AllureLifecycle - Could not add attachment: no test is running", this make the attachment missing from the allure report.
Could you please help on this?
Hi @CactusStar ,
I just ran the mvn clean test
, pulling the code to get the latest changes first, and I can't reproduce it...
I also removed the test to see if this issue would appear, but it ended up with 0 tests run (because there were no tests).
Can you give a little bit of context? Maybe also sharing the full output?
Thanks!
Hi @eliasnogueira,
please find below full logs: [INFO] Scanning for projects... [INFO] [INFO] -------< com.eliasnogueira:selenium-java-lean-test-achitecture >-------- [INFO] Building selenium-java-lean-test-achitecture 2.0.1 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ selenium-java-lean-test-achitecture --- [INFO] Deleting C:\Users\XinHe\Desktop\MyProject\selenium-java-lean-test-architecture\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ selenium-java-lean-test-achitecture --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.9.0:compile (default-compile) @ selenium-java-lean-test-achitecture --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 18 source files to C:\Users\XinHe\Desktop\MyProject\selenium-java-lean-test-architecture\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ selenium-java-lean-test-achitecture --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 6 resources [INFO] [INFO] --- maven-compiler-plugin:3.9.0:testCompile (default-testCompile) @ selenium-java-lean-test-achitecture --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Users\XinHe\Desktop\MyProject\selenium-java-lean-test-architecture\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ selenium-java-lean-test-achitecture --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running TestSuite Allure environment data saved. [INFO ] 2022-07-05 21:22:22.935 [TestNG-tests-1] WebDriverManager - Using chromedriver 103.0.5060.53 (resolved driver for Chrome 103) [INFO ] 2022-07-05 21:22:22.962 [TestNG-tests-1] WebDriverManager - Exporting webdriver.chrome.driver as C:\Users\XinHe.cache\selenium\chromedriver\win32\103.0.5060.53\chromedriver.exe Starting ChromeDriver 103.0.5060.53 (a1711811edd74ff1cf2150f36ffa3b0dae40b17f-refs/branch-heads/5060@{#853}) on port 56498 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. Jul 05, 2022 9:22:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected upstream dialect: W3C Jul 05, 2022 9:22:26 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch INFO: Found exact CDP implementation for version 103 [INFO ] 2022-07-05 21:22:48.477 [TestNG-tests-1] BookingDataFactory - Booking([email protected], country=Brazil, dailyBudget=$100, newsletter=true, roomType=Single, roomDescription=Unde rerum quo aliquid dolorem. Ut neque tempora. Dignissimos et aut necessitatibus voluptatibus dicta et.) [ERROR] 2022-07-05 21:22:49.283 [TestNG-tests-1] TestListener - com.eliasnogueira.test.BookRoomWebTest [ERROR] 2022-07-05 21:22:49.283 [TestNG-tests-1] TestListener - java.lang.AssertionError: expected: "Your reservation has been mad and we will contact you shortly" but was: "Your reservation has been made and we will contact you shortly" log finished [ERROR] 2022-07-05 21:22:49.836 [TestNG-tests-1] AllureLifecycle - Could not add attachment: no test is running attach finished [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 30.742 s <<< FAILURE! - in TestSuite [ERROR] com.eliasnogueira.test.BookRoomWebTest.bookARoom Time elapsed: 1.102 s <<< FAILURE! java.lang.AssertionError:
expected: "Your reservation has been mad and we will contact you shortly" but was: "Your reservation has been made and we will contact you shortly" at com.eliasnogueira.test.BookRoomWebTest.bookARoom(BookRoomWebTest.java:59)
[INFO] [INFO] Results: [INFO] [ERROR] Failures: [ERROR] BookRoomWebTest.bookARoom:59 expected: "Your reservation has been mad and we will contact you shortly" but was: "Your reservation has been made and we will contact you shortly" [INFO] [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 36.124 s [INFO] Finished at: 2022-07-05T21:22:51+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project selenium-java-lean-test-achitecture: There are test failures. [ERROR] [ERROR] Please refer to C:\Users\XinHe\Desktop\MyProject\selenium-java-lean-test-architecture\target\surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
That's interesting...
I add the same assertion error and I don't have the [ERROR] 2022-07-05 21:22:49.836 [TestNG-tests-1] AllureLifecycle - Could not add attachment: no test is running attach finished
I will try to use a Windows machine just to run the same as you.
What I did is just clone the code from github and then run the command. BTW, I am running it in VSCode. My PC have Java 8 and Java 11 installed, and currently running version is Java 11 because of this project required. I can see almost all the information in the allure report and with the log I can see the "takeScreenshotToAttachOnAllureReport" has been called but no attachment and even the attachment description displayed.
sorry, the message you have mentioned [ERROR] 2022-07-05 21:22:49.836 [TestNG-tests-1] AllureLifecycle - Could not add attachment: no test is running attach finished ==> the attach finished is log added by myself, not from your code. lol
Hi, I see the information provided in your log file: [ERROR] 2022-07-05 15:28:57.307 [main] AllureLifecycle - Could not add attachment: no test is running. Line 49
Found the problem, which is the TestNG lifecycle.
The browser instance is terminated before the execution of the TestListener.onTestFailure()
method.
I will try to fix it as soon as possible.
Thanks.
Hi, any update on the issue?
Hi guys! I tried a lot of different approaches using either the TestNG Listeners or the Allure ones, but none worked. The weird part is that, during the debugging process, the browser instance and test are still alive, but Allure still logs that is no test running.
I can see this is an issue on their side.
I am unable to reproduce this issue on Windows 11 and Java 17 tests are passing. please try Java 17.
Hi @mdiwakar, Thank you for the feedback.
The project is already set and running on Java 17. Can you share any other info about the project you have locally?
Thanks!