Qunit + JSCoverage + Jenkins

匿名 (未验证) 提交于 2019-12-03 01:46:01

问题:

I have started using Qunit to test my JS code. I am looking into JSCoverage to generate the coverage reports later. We have a CI server (Jenkins) which already do a few things with our PHP code and I was wondering if anyone can comment on how I can integrate the report from my Qunit and JSCoverage into Jenkins

Thanks Sparsh

回答1:

QUnit: use QUnit API to generate junit XML files. Here's a sample.

In Post-build Actions for your job you then check Publish JUnit test result report and specify your junit XML files (or their file pattern). Jenkins will then mark builds that have failed tests as unstable and produce a nice trend graph of successful/failing tests.



回答2:

A few more details, for those actually attempting this:

Putting together QUnit and Jenkins

If you want to run QUnit and publish the results in Jenkins, you'll need to do the following:

Step 1: Getting QUnit to generate an XML file compatible with JUnit.

  • If you're using Apache Ant, this question explains how to get QUnit to generate XML.
  • If not, you can use Grunt and grunt-qunit-junit, together with grunt-contrib-qunit, to run your .html tests.
  • And if you're not into either Ant or Grunt, here is a script for PhantomJS to run your tests directly and produce JUnit-style XML.

Step 2: Processing that XML file

This is the easy step - look in "Post-build Actions" for your job in Jenkins, and add the path to the XML file.



转载请标明出处:Qunit + JSCoverage + Jenkins
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!