My team currently use karma as the testrunner for our unit tests. We are now trying to figure out if there is a way to get karma to generate a html-file containing the test-results.
What we hope to achieve by this is that we can have karma running on one of our servers and that whenever we upload new code or tests, our tests will be re-run on a myriad of different browsers. The html-files generated by these tests could then be displayed by anyone wanting to see whether or not all tests still go green on all the different desktop and mobile browsers tested.
Currently I've looked into using Karma's junit reporter and then post-process these files with ant to get HTML-files, but we're currently using Grunt as our building tool and I'd prefer not having to include ant to the mix.
Also, is there some sort of guide to creating Karma reporters if we decide that creating one would be the best way to solve our issue?
To generate a HTML report for a Selenium test, we have to install a plugin with the command: pip install pytest-html. To generate the report, we have to move from the current directory to the directory of the Pytest file that we want to execute. Then run the command: pytest --html=report. html.
Karma is a node-based test tool that allows you to test your JavaScript codes across multiple real browsers. A node-based tool is any tool that needs the Nodejs engine installed for it to run and can be accessed (installed) through the node package manager (npm).
I've written a simple HTML reporter which does the job:
https://github.com/matthias-schuetz/karma-htmlfile-reporter
Just add it to your karma.conf.js and it will produce an HTML file with test results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With