Content tagged with: javascript
Testable JavaScript is a process. Whether starting with a blank slate or an already implemented application (or somewhere in-between) being able to test your JavaScript code simply, cleanly, and effectively is a necessary feature. Code that cannot be tested will be rewritten.
In this blog post, Francois Zaninotto provides an detailed explanation on how to do functional testing for Node.js using the Mocha open source software testing framework. Mocha is a feature-rich JavaScript test framework running on node.js and the browser. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
Jasmine is a behavior-driven development framework for testing JavaScript code with a clean, obvious syntax so that you can easily write tests. Testem is test runner that makes Javascript unit testing easier. In this blog post, Joe Zimmerman provides a step by step approach to set up a Jasmine unit testing environment with Testem.
Martin Flower defines legacy code as code without tests. You test your server-side code, but if you are working on a site with a fair amount of non-trivial JavaScript (ajax call, extensive callbacks, etc.) you really should be testing your JavaScript as well. All the untested JavaScript code we are writing today is, in effect, legacy code, but we can address this with JavaScript unit testing!
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 …
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 …
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 …
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.
James Shore is famous for the excellent “Let’s Play TDD” screencast series where he produces videos about the development of a real software projects using Java, test-driven development and evolutionary design. He is currently planning to repeat the same type of journey but this time he will focus on the browser and Javascript.

Twitter
Facebook
RSS Feed