Javascript Software Testing: unit testing, open source, Jasmine, Karma, Casper.js, QUnit, SinonJS, etc.
Bradley Braithwaite shares in his blog a step by step process to perform JavaScript unit testing in the Eclipse IDE with QUnit and JS Test Driver. QUnit is a powerful, easy-to-use, JavaScript test suite. It’s used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript. The goal of Js Test Driver is to build a JavaScript test runner that easily integrates with continuous builds systems and allows running tests on multiple browsers quickly to ease TDD style development. Starting from the opening of the Eclipse IDE to writing the tests, everything is explained with code examples. Bradley adds also at the end some productivity improvement tips like code template or avoiding the browser. He also recommends using a tool like JSLint or JSHint to manage code quality. JSLitmus is recommended to profile JavaScript code for performance tuning.
Many JavaScript implementations do not warn against questionable coding practices which is a nightmare when you actually want to write quality, maintainable code. That’s where JavaScript Lint comes in. With JavaScript Lint, you can check all your JavaScript source code for common mistakes without actually running the script or opening the web page. This video takes a concise look at what Lint is, how to use it, and how to incorporate it into your automated build.
This is a series of three posts by Nick Olson about the topic of unit testing your code your when you are writing a javascript client application with a .NET backend. The first post is an introduction that defines the context and presents the tools that will be used. The second post provides the code to test the javascript using KnockoutJS and Qunit. The third post explains how see the javascript unit tests results when you are inside Visual Studio. This is achieved using a browser automation tool walled Watin and a data-driven unit test in C#.
Program understanding is a major obstacle during program maintenance. In an object-oriented language, understanding an operation requires understanding its type and its effect on the object network. The effect is particularly important for scripting languages where there is neither class structure that restricts the shape of an object nor any other kind of access control. We have designed and implemented JSConTest. JSContest is a tool that enhances JavaScript with simple, type-like contracts and provides a framework for monitoring and guided random testing of programs against these contracts at the same time.
This article explores how to use QUnit And SinonJS to perform unit testing on Backbone.js applications. QUnit is a powerful, easy-to-use, JavaScript test suite. It’s used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code (and even capable of testing JavaScript code on the server-side). SinonJS is a standalone test spies, stubs and mocks for JavaScript. It has no dependencies and works with any unit testing framework like QUnit.
The increased complexity of browser-executed code has increased the need to write unit test cases for JavaScript code. This article describes some of the most common tools for unit testing JavaScript: QUnit, YUI Test and JSTestDriver. The learning curve can be steep if you do not typically write tests for client-side scripting and testing the user interface could require adjustments in your thought process. This article provides code examples that will walk you through sample test cases.
In this blog post, Rob Stevenson-Leggett gives a detail presentation on how to start some simple Javascript unit tests using QUnit as the test framework and Sinon.js as a mocking framework. QUnit is a JavaScript test suite used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code and even capable of testing JavaScript code on the server-side. Sinon.JS is a standalone test spies, stubs and mocks for JavaScript. It has no dependencies and works with any unit testing framework.