Javascript TDD using Qunit and Karma

karma Karma is a Javascript Test Runner created by the AngularJS team(mainly Vojta Jína) in order to run your Javascript unit tests in multiple Browsers and devices at the same time.

Installing all the prerequisites

Because Karma is an NPM Package, you have to make sure that you’ve installed Node.js already. Personally I like to install Karma and all the dependent plugins locally in my project folder. To install Karma type this command in your Terminal:

npm install karma --save-dev

Continue reading

Advertisements

Unit testing With Qunit (Part 1)

 

qunit_logo

A couple of months ago, I started working on a project WYSIWYG for the benefit of one of our partners. This editor that is fully written in Web technoliges (HTML, CSS and Javascript) is one of the most key features of the main product for this company. To make it simple for everyone, edit HTML pages was the daily repetitive task done by more than a hundred employees to create differents types of documents like DOCX or PDF that can be saved easily on the server and even sent to the final clients by email.

After a couple of weeks I started to feel the pressure of this task for many reasons:
1. Huge browser compatibility issues (especially in the native Javascript API)
2. The number of Bugs is increasing every couple of commits
3. Regression !!!!!!!!!!!!!!!!!!!!!!

Continue reading