Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript unit testing tools for Visual Studio / Build Server - any consensus yet?

Here's the situation:

  • We're a Microsoft shop using Visual Studio / TFS etc.
  • We have a build server that nightly performs builds for us and runs various tests to ensure nothing has been broken during the day
  • We're now doing more and more JavaScript and this is likely to continue.

None of our JavaScript is currently tested because as I've looked around I've found the JavaScript testing world is in a state of flux. There are lots of offerings which I've read about and I'm not sure which path to take. I found this question quite helpful in terms of just raw info:

JavaScript unit test tools for TDD

Ideally I'd like to use something which integrates nicely into Visual Studio and our TFS build server. Most of the JavaScript testing options do not seem to support this.

I found this article: (but I'm not too keen on using jscript for testing)

http://stephenwalther.com/blog/archive/2010/12/20/integrating-javascript-unit-tests-with-visual-studio.aspx

And I found this - which looks quite promising:

http://chutzpah.codeplex.com/

So what I'm wondering is, is there any consensus yet? Are people adopting one tool over another, is any approach gaining critical mass yet? I'm keen to make use of something which is clearly working for a lot of people already.

Is it worthwhile me sticking it out for a JavaScript testing framework that plays nice with Visual Studio / TFS or should I look to use one of the non Microsoft friendly offerings instead?

All insights appreciated!

like image 631
John Reilly Avatar asked Apr 06 '26 21:04

John Reilly


1 Answers

I wouldn't got that far and state that I'm moving away from developing in MS environment. I think Visual Studio is a great tool. Working a little with Eclipse & XCode, for PhoneGap development even gave me another perspective as to how Visual Studio really rocks.

Regarding JavaScript, there are many enhancements in Visual Studio 2012, but integral solution for Unit Testing is not yet part of it.

After being involved in some JavaScript heavy projects, also felt the need for Unit Testing, so started with In-Browser tests with QUnit and Sinon.JS.

I went out there to find the right stack to meet my expectations:

  • Seamless integration with Visual Studio. So we can run tests without leaving the IDE.

  • Headless testing. Against multiple browsers at the same time if possible.

  • Support for AMD (Asynchronous Module Definition) / Require.JS.

  • Support for Async Tests.

  • Documented libraries & Tools.

  • Free Tools are preferred.

Eventually find my perfect combination for Headless testing from inside the IDE with JS-Test-Driver.

I've written a 3 parts series on my blog:

  • Part I - Expectations & the selected Stack

  • Part II - Setting up the environment for Headless tests

  • Part III - Testing AMD/Require.JS Modules

You can find the last part here, with links to first 2 posts:

http://www.upstruct.net/2013/02/javascript-unit-testing-in-visual-part-3.html

Been using this combination in several projects, and got a very good feedback from the teams so far.

Let me know if it suits you...

like image 176
Yaniv Yechezkel Avatar answered Apr 08 '26 09:04

Yaniv Yechezkel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!