Creating an HTML report with embedded screenshots

2019-07-20 06:06发布

问题:

I've put together a custom JUnit runner that saves a screenshot when a WebDriver test fails. I'm using Maven's failsafe plugin to create reports of the integration tests and TeamCity is our CI server.

I know TeamCity supports custom reports, but I don't know how I'd embed the image files into an HTML page (or pages) with references to the relevant tests.

What would be a good method to integrate the screenshots into the test report? Is there a Maven plugin that'll do the job?

回答1:

Maybe Allure-report would suit for your purpose. It allows to create a nice report that contains different attachments, including screenshots. Moreover it has JUnit integration and Teamcity plugin, so it fully covers your use-case.



回答2:

Unfortunately there is no way to simply change the reports cause they are generated by the maven-report-plugin which can't be simply changed. What you can try is to create a separate folder and create a link via the site.xml descriptor.



回答3:

You can try maven-cobertura-plugin. Including this in your build will generate a HTML report of all the test case success, failure and coverage. Hope this helps....