10

Microsoft has really been pushing ASP.NET MVC, and one of its major strengths over ASP.NET Web Forms is unit testing. Then, they announced that they would support jQuery as their official client-side library for the platform, automatically including the source in new projects. Recently, they announced their first official contributions to the jQuery stack: templating, data linking, and globalization.

With this push to more and more client-side logic, how does Microsoft expect developers to unit test with the same power and flexibility that they offer through MVC?

Is there a unit testing framework for client-side scripting that even comes close to comparing to what is available through ASP.NET MVC? Does Microsoft endorse or offer a specific framework that provides this functionality?

8
  • 1
    This is just a pet peeve of mine... but why does Microsoft have to endorse something for it to be valuable...? There's a lot of javascript testing out there that will never be documented or blogged by Microsofties, even in the realm of jQuery. Commented Oct 5, 2010 at 18:51
  • @zowens Good point. Microsoft is not the end-all of developer solutions. Since you say, "There's a lot of javascript testing out there," go ahead and give a recommendation. Commented Oct 5, 2010 at 18:58
  • Surely testing jQuery is an integration test, not a unit test? Commented Oct 5, 2010 at 20:02
  • Places to start are QUnit (as @DarinDimitrov suggests), YUI has an awesome test widget, Selinum has a decent test framework, I currently use a modified version of Google Test Driver to work with QUnit (somewhat), test swarm (by John Resig) is great for cross browser testing, there are a few ports of JUnit to JavaScript, and the list goes on. Commented Oct 6, 2010 at 1:58
  • @ChessWhiz +1. I had this same question and decided to go with QUnit. Another good unit test framework I read about is jstestdriver: code.google.com/p/js-test-driver But it appears to have a dependency on Java which wouldn't be surprising since Google Web Toolkit is a framework for writing web applications in Java. Commented Jul 25, 2011 at 4:49

2 Answers 2

6

You could take a look at QUnit. I am not sure whether it's or it will be endorsed by Microsoft, but it's what's used to unit test the jQuery framework itself.

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting; I wasn't familiar with QUnit. Thanks.
2

I use the following frameworks for JavaScript unit testing:

QUnit

As for me, it is the best choice if you want test your jQuery functions logic. It was developed by the jQuery developers and works with it well.

Jasmine

This is a BDD framework. It is very useful when you write your tests as specifications for your application.

Both frameworks can be integrated in the test explorer of the Visual Studio 2012 using Chutzpah Test Adapter for Visual Studio 2012.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.