We run a CI environment with Jenkins and the Project using ExtJS 5.1.1.
I try using Chutzpah test runner, using mocha framework JavaScript unit test.
With JavaScript test without ExtJS 5.1.1 testing run successfully.
But JavaScript with reference ext-all.js, there are no success. We have time out error in Blanket.js (error blanket_mocha.js line 5141) testing are not succeed and coverage.xml won't generate.
I'm looking for other way how run JavaScript test (ExtJS) in Jenkins with mocha framework and have code coverage report generate.
We already have Grunt run in Jenkins to do JavaScript combine and minify.
Is this possible to using Grunt to run mocha test and generate coverage.xml in Jenkins?
Please help me out if there is some other way to achieve the same thing. Any suggestion are highly appreciated.
Related
I am actually configuring Jenkins to make a continuous integration of a JS project with unit tests. My problem is that after many researchs I didn't found any tutorial or information about how to proceed to write unit tests in Jenkins.
Should I use other tools (grunt, ant...) with Jenkins or could it do the job alone ? Is there any important plugin to install to make it work ?
Thanks for your answers
What you're looking for is a testing framework with a JUnit Reporter. Jenkins can read your test results from the JUnit report and give you metrics from them.
Jenkins is just for handling the automation of building your code and running your tests in whatever language you need. In order to use it for that, you need to use something like Karma, Mocha, HapiJS's Lab, Unit.js, Jasmine, etc. to actually write and test with.
I wrote the Jasmine test for the javascript. I am trying to run the Jasmine tests using Phantomjs. I downloaded the Phantomjs from Phantomjs.org and tried running it using phantomjs.exe //path to phantom jasmine http://localhost/myJasmineTestRunner.html. Googling doesn't help me out. Can someone suggest me how to test jasmine tests using phantomjs.
Running the Tests
In order to run our jasmine test suite on the command line, all we need is:
PhantomJS
Installing PhantomJS from phantomjs.org is fairly trivial (at least on a mac).
A URL to our Jasmine test suite
We already covered jasmine test suites, so we have a URL to a jasmine test suite.
A script that loads our URL and parses the results
Fortunately, PhantomJS provides a working jasmine runner example – all we have to do is download it and use it.
Once we got these, all we have to do is run the following command:
phantomjs
It doesn’t take more than a few seconds(!) and we are provided with the test results.
This is it.
Now, lets run it with our build tool.
* For the purpose of this article, lets assume PhantomJS is installed on the system, our jasmine runner is located at /path/to/run-jasmine.js and our jasmine test suite is located at http://localhost/js/test/unit/
Source.
Is there a way to get JavaScript tests to do continuous integration with MSBuild or in Visual Studio? What I want to do is have it so anytime my JavaScript or my JavaScript tests change they are built again and ran and if they fall below certain values of acceptance criteria (code coverage, assertions passing, test's passing, etc.) it'll fail my build. Anyone know how to do this?
Thanks!
It looks like Chutzpah has a command-line runner, so you can create a PowerShell script which gets called from your build server to run the tests. See the Chutzpah documentation for more information. I'm not sure how you would integrate the test results with TFS.
I've used a Command Line build step to run my javascript tests with chutzpah.
Add this and point to something like
$(Build.SourcesDirectory)\packages\Chutzpah.4.0.3\tools\chutzpah.console.exe
or whereever you have chutzpah setup to be run on build server. You can then add an argument to tell the chutzpah console where the tests are
$(Build.SourcesDirectory)\YourApp.UnitTests\Tests**strong text**
Actually I am in the process to run my javascript code on teamcity using QUnit+ phantomjs.
(using this link as reference:http://thomasardal.com/running-qunit-tests-on-teamcity/)
And at least the execution of my tests using phantomjs looks ok on my local machine so in someway I am happy :). But that is not all what i want to do, I would like to add code coverage to my javascript tests and run it from our Teamcity server. is there some way to do that? jscoverage is an alternative?
thank you!
As to TeamCity side of the question, here are some notes in the doc on how external coverage results can be integrated into TeamCity.
We are using Team Foundation Server 2010 and we have some JavaScript unit tests running on our local machines using Jasmine.
We are using the workflow based builds.
Has anyone had any success running Jasmine tests during their builds? Can you break the build if the Jasmine tests fail?
The way I've seen this done is using the Chutzpah Test Runner available on CodePlex: http://chutzpah.codeplex.com/
This allows you to run Jasmine/QUnit tests from a command-line which can then be easily integrated with a TFSBuild using the InvokeProcess Activity.
you should checkout http://www.codit.eu/blog/2015/03/18/continuous-integration-with-javascript-nunit-on-tfsbuild-(part-23)/
The blogpost describes a complete scenario how to execute your JavaScript Unit tests on the Team Foundation Build server. Basically it uses Grunt (taskrunner) and Powershell. It also has an example of code coverage reports that you can use.