Discussion  - 
 
Hi all,  I  am using jquery and HTML 5 techniques (like File API, HistoryAPI) extensively in a project I am working on. 

I was wondering what tools I can use for 
a) quality assurance my javascript and front end code
b) unit testing my javascript and front end code

Let me share some background info.

If somebody asked me about this but for PHP, I would say, use PHPUnit for writing unit tests, use PHP CodeSniffer and then with the help of Phing and Jenkins, put this all into a single build process.

I basically want to know if something similar can be pulled off with javascript using Jenkins.

Do share your actual experiences. Please advise me on the most beginner-friendly ones. Thank you.

Disclosure: I cross-posted in G+ HTML5 and Stackoverflow.

http://programmers.stackexchange.com/questions/180917/what-tools-should-i-use-for-quality-assurance-and-testing-for-front-end-javascri

https://plus.google.com/111509997047726623122/posts/KaQ9GwhzBay
1
Florian Margaine's profile photoChris Grant's profile photoKevin C Jones's profile photo
3 comments
 
As a beginner, I would suggest you use the web service for JSHint, http://www.jshint.com/ This is a linter for your JavaScript code, which will help you write your code in an efficient way.

As a tip, you may get a few 'not defined' warnings. These would be globals such as jQuery ($) or console.

You can turn these off my placing at the top of your script,

/global "$"/
/global "console"/

Just repeat this pattern for whatever global you would like JSHint to ignore.

As for the Unit Testing, I don't see much point in writing tests for hover and drop events. Although this is my opinion. For something like that I would monitor performance with the Chrome WebTools, in which I doubt there would be any damage caused if you keep your code efficient.
 
Something I HAVEN'T used yet but I hear good things about is http://casperjs.org/ it has good docs to help you understand how to write tests especially in your case for DOM interaction/sampling without needing to load the browser yourself. It's on my list of 'To Learn' :)
Add a comment...