How to integrate QUnit javascript unittests teambuild 2010

Topics: Web Guidance v-Next (not WCSF)
Dec 23, 2010 at 10:00 PM

We want to integrate javascript unittests in our tfs 2010 teambuild.
I am wondering is there going to be clear guidance and/or examples on how to fully integrate qunit unittests into a teambuild?
So capture the buildresults and fail a build when a unittest fails etc..
I would really appreciate some help.

Dec 27, 2010 at 3:25 PM

Hi,

You can find an example of integrating QUnit JavaScript unit tests with Continuous Integration (in this case using MSBuild) in the "Integrate JavaScript Unit Tests with Continuous Integration" section of the article titled How to: Create and Run JavaScript Unit Tests from the Web Guidance documentation.

You might find that useful to adapt its concepts to TFS 2010 TeamBuild.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Dec 28, 2010 at 9:02 AM

@Guido,

Thanks for your reply.
The guidance in the "Integrate JavaScript Unit Tests with Continuous Integration" section of the article titled How to: Create and Run JavaScript Unit Tests from the Web Guidance documentation is for TFS 2008, TFS 2010 has changed, the concepts can be used as you say, but I think the guidance is incomplete.

  1. I asume the project JSUnitTestResult is the 'service' used to process the results into the trx format (it is not mentioned in the guidance)
  2. Can I use the format used in JSUnitTestResult in the TestResultSerializer( I have started writing my own implementation of the ITestresultSerializer)? (not mentioned in the guidance)
  3. How can I add the results to the TFS buildreport? (This part is not metioned in the 'guidance'.
  4. How can I break the build in TFS 2010, Ithe guidance provides part of an msbuildscript, that i can not use in TFS 2010.

Thanks in advance.

Henry Cordes
http://www.henrycordes.nl 

Dec 28, 2010 at 3:49 PM

Hi Henry,

As you're suggesting, the JSUnitTestResult is the service used to process the test results into the format you mentioned.

The format used in the project can be used in the TestResultSerializer. You could check the TestResultSerializer class provided in the JSUnitTestResult project (inside the Models folder), which you might find useful to base your implementation on.

The serializer provided in the aforementioned project outputs an XML file with the test results to a path specified in the Web.Config file, and if there are errors, it also outputs another XML file with the errors. You could add the results to the TFS build report and decide if it is needed to break the build based on those files. For guidance on how to achieve this in TFS 2010, you might find better support in the Team Foundation Server - Build Automation forum, as this is not strictly related to the Web Guidance.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi