Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating test results and coverage reports in Jenkins, using Yeoman and Mocha

I am starting a new project, and investigating Yeoman and Mocha for use on the project. We use Jenkins for CI.

So far, I have figured out how to get client side testing working, but I am struggling to generate test results (and eventually coverage reports) that can be tracked by Jenkins. Has anybody successfully done this?

like image 564
abendigo Avatar asked Jan 04 '13 14:01

abendigo


People also ask

Which plugin is used to generate report for code coverage in Jenkins?

The Emma Plugin for Jenkins is a reporting plugin. This means it runs after the build and tests are complete, in order to process the Emma output into a form which Jenkins understands.

Which plugins can be used for test coverage in Jenkins?

jacoco-plugin A plugin for Jenkins to capture and visualize code coverage testing results for projects using the JaCoCo for code-coverage analysis. Note: Version 2.0. 0 and higher requires using JaCoCo 0.7.


2 Answers

The xunit reporter works well, for generating test reports.

Command line:

mocha -R xunit | grep "<" > reports/mocha.xml

With Jenkins, just 'publish JUnit test result report', it should work.

But, I'm still finding a solution to publish the coverage report.

like image 161
xinthink Avatar answered Nov 15 '22 08:11

xinthink


I have been able to add code coverage reports to my Jasmine tests using testem. Testem seems to work with Mocha too. https://github.com/airportyh/testem

Follow the instructions on the read me file. It explains how to use testem ci in continuous integration mode.

You will need to get the tap plugin - https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin - from jenkins.

Vytch

like image 22
Hugo Chan Avatar answered Nov 15 '22 08:11

Hugo Chan