Welcome to our blog

Search

Javascript Unit Testing21.09.11

From simple websites to full scale Web Applications, JavaScript is the go-to scripting language for building interactivity into web sites and applications. As projects become more and more complex, with lines of JavaScript increasing dramatically, testing your code for bugs, glitches & performance is an essential part of development.

Unit testing is a way to test small sections of your code at a time to find any bugs and also evaluate the performance of your script. As the developer, we have an expectation of the results and unit testing allows us to test for this within the browser. Unfortunately, many developers are not aware there are a range of free tools and frameworks to assist in this process.

Firebug

Firebug is a free plugin for the Mozilla Firefox browser, allowing for inline browser checking of JavaScript as well as HTML and CSS markup, network usage and performance.  One of the greatest features of this is the ability to set breakpoints in your code. This enables us to “stop” the JavaScript in it’s step, and check various properties such as the value of variables mid-execution of functions.

JsUnit

JsUnit is a unit testing framework for client-side JavaScript within the browser. A test page must be setup, including the JsUnit.js engine which allows for custom test functions on your web page to be written. Instead of manually inspecting your code as you would in Firebug, JsUnit allows for specific tests to be written and executed all at the same time, returning a list of results. Green for OK, red for any errors.

About This Author

Get to know us and what makes us tick!

Milton Bayer

Milton Bayer

Milton Bayer is a strategic, switched-on creative agency based in Northampton that delivers websites and marketing campaigns. Awarded Investors In People in 2009.

Comments

Fancy leaving a small contribution?

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Connect

Sharing is Caring

Connect

  • rss
  • vimeo
  • youtube
  • twitter
  • facebook
  • flickr

From the Blog

Is my advertising OK? Well, no actually, it’s not.

I obviously talk to businesses about their marketing, a lot. We talk about how they are holistically, and it’s interesting how often the same topic comes up without me raising it. The conversation turns to Metrics. The question is usually a version of “How do we know our results are good results?” The trouble in [...]

27/02/13 Posted by:
Category: Discussion, We love

Read Post

Latest Tweets

http://twitter.com/miltonbayer
Close
You have successfully signed up, thank you.
Take a look at the latest issue

Contact

Call us: +44 (0)1604 704100
or email: enquiries@miltonbayer.com

21-27 Tudor Court, Wootton Hope Drive, Wootton Fields, Northampton England, NN4 6FF - +44 (0)1604 704100

submitting

Thankyou your enquiry has been successfully sent.

A member of our team will contact you shortly.

Close