简体   繁体   中英

Automated Unit testing for Javascript integrated with CruiseControl, nUnit, nAnt and ASP.net MVC

I work for a team of ASP.net MVC and they are using Cruisecontrol, nUnit and nAnt for the automated testing and build. I am new to the group and i handle the Javascript layer and i am looking for ways to incorporate my work with my teams workflow.

Are there any possoble way to do this?

Thanks

A few thoughts:

  • There is JSUnit, a unit test framework for JavaScript. I used it a 2 years ago and it was pretty good. Something better may be out there now.
  • I assume they're using source code control of some form, and that Cruise Control monitors the repository. If so, then just make sure your JavaScript is kept in the same repo, so it will trigger builds, automatic kickoff of unit tests, etc.
  • If you have portions of your JavaScript layer that can only be tested in a browser, think about using Selenium or a similar tool to create a kind of automated tests that drive the browser through various scenarios. I'm sure there is a way to kick these off from Cruise Control.

Just a couple of days ago, John Resig announced a JavaScript unit test automator he's working on called Test Swarm . It's just now going into alpha, but it might be worth watching.

I've found JSUnit to be a pretty good unit testing tool for javascript.

You might also consider using javascript lint (link below). It's a static code analyzer (not a unit testing tool) and I've had good experiences with it in the past. It's not as thorough as some of the complied language lint tools, but it can save you from making some truly evil mistakes in javascript. You can run it from the web page or the command line, so it should wire into a build process pretty easily.

http://www.javascriptlint.com/index.htm

As @Charlie mentions, JsUnit is a good choice for automated unit testing, via JsUnit Server .

QUnit is a new unit testrunner, is highly customizable, I've been playing with it and you can integrate and check the test results through browser automation tools like Selenium .

That's pretty much what we have at the moment, but a very promising project is emerging right now, TestSwarm by Mr. John Resig, check this blog post for more information (and sign up for the alpha release:):

Looks really interesting:


(source: ejohn.org )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM