Creating an HTML report with embedded screenshots of failed JUnit tests - html

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?

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.

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.

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....

Related

Generate report by date time with ReportNG after each test finished

I use Selenium webdriver, testng and reportng to develop automation test framework, everything works fine, reportNG gernates html report after each test finished, but the html report will be overritten by the next round test;
so, i'm considering if any parameters that can be configured in Reportng to keep HTML report will not be overwritten, just create and save by date and time separately; could you please tell me where to do the settings in reportng? thanks!
I have solved the problem, just decompile the reportng jar file, then modified source code, and pack the jar with modified code.

How to display Visual Studio loadtest result file (.trx) into readable format?

I would like to execute my load tests on the regular basis and make it part of my CI process.
I'd like to run a Visual Studio loadtest from the console and provide the results of the test in human readable format (preferably HTML page).
For executing the test I use MSTest.exe util which produces .trx file to specified location.
e.g.
mstest /TestContainer:LoadTest.loadtest /resultsfile:c:\Temp\MyResults.trx
My problem is to convert this .trx file into something which can be displayed in browser.
I tried several tools mentioned in another topics like trx2html converters and so on. All of them were built for conversion of unit tests and fail to convert load test results correctly.
Any suggestion please?
An alternative would be to use the "archive artifacts" option in Jenkins for the **/*.trx file(s). That way you can click on the link and the trx file will open in Visual Studio.
Of course that means this is only of use to people with Visual Studio installed.

Issues regarding Cucuber.json file which is used for Cucumber reports

I was trying to integrate my cucumber tests with maven-cucumber-reporting(from masterthought.net). I downloaded their Jenkins plugin and incorporated in my pom.xml file.
I have 2 tests in my eclipse project and when I ran these tests though maven it gets executed successfully. But, when I see my HTML report and also the cucumber.json , it displays details of only one test case.
I have been using Cucumber-JVM
Can you please let me know if I'm going wrong somewhere.
Thanks,
Prashanth
Do you have two RunCukesTest files for your two tests? If so make sure that you are creating unique json files for each tests (Note Test1.json below, make sure you have that distinction for each of your tests). Otherwise they will be overwritten by each other and you will only see the results from your last test.
#Cucumber.Options(format = { "pretty", "html:target/cucumber-html-report",
"json-pretty:target/Test1.json" },
features = { "src/test/resources/features" })

How do I disable code generation in my test plugin?

I have a couple of test files written in my DSL in my tests plugin/project. Most of the tests use inline multi-line strings and Xtend but in four cases, I need to test code which does some magic with URLs and the classpath, so I really need resources in the classpath for that.
Since loading the resources only works when the extension is correct, I can't give the files a fake extension.
Now my problem: My DSL also has a code generator. This means that eventually, I end up with a couple of generated files in places where I can't have them (they don't compile, for example, and one even contains an error to test error handling when information is split across several files).
I can't disable the Xtext nature because the tests project uses Xtend so for these files, I do need code generation.
Since the generator runs inside Eclipse (I have the DSL plugins installed for other projects), there is no way to override the code generator in Guice.
How can I disable the code generator in this case?
There is a simple way to achieve this:
Open the properties of your project
Expand the entry for your DSL
Select "Compiler"
Select "Enable project specific settings"
Disable/deselect "Compiler is activated" under "General"
If you don't have a properties entry for your DSL:
Add this fragment to your .mwe2 workflow file:
fragment = generator.GeneratorFragment {}
Regenerate your projects
Merge the new code from plugin.xml_gen into plugin.xml both in the base and the UI plugins.
The interesting parts are the two extension points org.eclipse.ui.preferencePages and org.eclipse.ui.propertyPages

Is there a generic Hudson reporter?

Our build has a variety of generated HTML reports. I would like to have those reported and accessible on the build page, like JavaDoc entries. Is there a generic way to expose these reports without writing a custom plug ins ?
If that isn't available, is there a way to post an HTTP link on the page ?
You can choose "archive the artifacts" and archive for example "reports/*.html"
These will appear under the project page under the heading "Last successful artifacts".
Even if you clear your workspace before each build, these artifacts are moved to a separate directory.
You could also add a build script which will modify or update a file in your userContent directory (since Hudson 1.299), and link to these build artifacts in yet another location.