Attach Failure Screenshot for the failed test(TestNG+Ant+Selenium) on TeamCity Results Page Follow
Can you please help me advising a method/plugin using which i can add a screenshot for the failed test some where in the highlighted area when running TestNG, Ant Selenium build on TeamCity.
Please sign in to leave a comment.
TeamCity doesn't make screenshots of Selenium tests, so you need to make sure your test itself makes screenshots and saves them. You can find instructions in the Selenium documentation.
After that you need to configure Artifact paths so that those screenshots are added to the build artifacts.
Please contact the TeamCity support for further questions: Community forum or submit a support request
Hi Liubov Dievskaia,
Thank You for the reply. Actually i've screenshots generated by my selenium scripts in a separate folder with in the project but how can i configure artifact paths so that those screenshots are added to the build artifacts. Do we need to configure the Artifact Paths manually every time or can we configure it somewhere for one time and that works for every execution ? Please suggest.
In the General Settings of the build configuration there is an "Artifact Paths" field available where you can write the paths to be published as build artifacts. You can use wildcards to get groups of files or folders, even create redirections to move them to a different folder. Once you set them up here, they should work for every run of the build.
The artifact paths are relative to the build folder, and if you have run at least one successful build of that specific configuration before, you can use the tree view button to select them via the UI instead of typing them manually.
More info here: https://confluence.jetbrains.com/display/TCD10/Configuring+General+Settings#ConfiguringGeneralSettings-artifactPaths
Hi Denis Lapuente,
Thanks for the quick response, i tried as you suggested, its working perfectly. Also, is it possible to include failure screenshot to TeamCity generated failure links(failure link as in the attached screenshot)?, ideally when the link is clicked it should show both the error stack trace and failure screenshot link.Currently it is showing the error stack trace only as in the screenshot which is not enough to know the exact issue.
it's not possible directly. While you can add additional problems through service messages, it's only possible to add a text description. You can create a plugin that extends the web ui (https://confluence.jetbrains.com/display/TCD10/Web+UI+Extensions) or create a html report yourself with the screenshots then add the report as explained here: https://confluence.jetbrains.com/display/TCD10/Including+Third-Party+Reports+in+the+Build+Results
Hi Denis Lapuente,
Thank You Very Much for the clarifications.