Implementing JavaScript testing isn’t easy but its the way to go!

We’ve been trying to implement testing on the product I’m currently working on for about 6-8 weeks, I’ve moved from a team that implemented JavaScript testing successfully although I can’t take credit for it (Brian Blignaut was our mentor).

To start with I set up the build tasks to run JSLint and run JsTestDriver, that all went very smoothly.

I think the easiest way to start is with code that works and then refactor that to follow the MVP pattern.

Then write tests to satisfy this code not the most correct way but there is so much to get your head around when first learning to test JavaScript especially around writing good object oriented code not as easy as it looks!

When you have a new feature/requirement to add to the code then start by change existing or adding new tests that describe the behavoiur of the new feature/requirement then make the tests pass this isn’t as easy as in C# but once you get your head round it it does make sense.

Mocking framework we used Ewloe

Unit Testing framework JsTestDriver

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: