background preloader

Test

Facebook Twitter

Unit test JavaScript applications with Jasmine. Introduction To JavaScript Unit Testing. Advertisement You probably know that testing is good, but the first hurdle to overcome when trying to write unit tests for client-side code is the lack of any actual units; JavaScript code is written for each page of a website or each module of an application and is closely intermixed with back-end logic and related HTML.

Introduction To JavaScript Unit Testing

In the worst case, the code is completely mixed with HTML, as inline events handlers. This is likely the case when no JavaScript library for some DOM abstraction is being used; writing inline event handlers is much easier than using the DOM APIs to bind those events. More and more developers are picking up a library such as jQuery to handle the DOM abstraction, allowing them to move those inline events to distinct scripts, either on the same page or even in a separate JavaScript file.

However, putting the code into separate files doesn’t mean that it is ready to be tested as a unit.

Silverlight/Wpf

Three pillars of Unit Tests. Ok, now we know what TDD is all about and how to do TDD. Really? Well, no. In fact we only know how TDD works, but TDD is about writing tests (to be more precise – unit tests). What should our tests look like? Here it comes… The Art Of Unit Testing - Home.