Siesta - a new JavaScript unit testing framework.

4,986 views

Published on

The slides from my Sthlm.js presentation about Siesta - a JS unit testing framework. Join the meetup here:

http://www.meetup.com/sthlm-js/

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,986
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
35
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Siesta - a new JavaScript unit testing framework.

  1. 1. Stress free JavaScript unit testing Mats Bryntse @bryntum www.bryntum.com
  2. 2. If you’re passing by Malmö Visit our Öresund Ext JS meetup
  3. 3. About me <ul><li>Mats Bryntse, from Helsingborg </li></ul><ul><li>Ext JS enthusiast since 2007 </li></ul><ul><li>Started Bryntum 2009, selling JavaScript scheduling components and test tools for Ext JS. </li></ul>
  4. 4. What is Siesta? <ul><li>Generic JavaScript unit testing tool </li></ul><ul><li>Completely web based </li></ul><ul><li>Test any JS code, jQuery, Ext JS, NodeJS </li></ul><ul><li>Simulate user interactions, click, type etc </li></ul><ul><li>Run on console via Phantom JS or Selenium </li></ul>
  5. 5. Why Siesta? <ul><li>We had a rough upgrade to Ext JS 4 </li></ul><ul><li>Hard and time consuming to test each combination of OS, Browser, Ext JS </li></ul><ul><li>None of the existing tools seemed optimized for Ext JS </li></ul>
  6. 6. What we wanted from Siesta <ul><li>Write tests in JavaScript </li></ul><ul><li>-> not learn a new language to write tests. </li></ul><ul><li>Automatable </li></ul><ul><li>Extensible </li></ul><ul><ul><li>easily add our own assertion methods and abstractions. </li></ul></ul><ul><li>Optimized for Ext JS </li></ul><ul><li>offer high level abstractions to assist with Ext JS testing. </li></ul><ul><li>Simple and user friendly UI </li></ul><ul><li>low learning curve, should be very easy to get started </li></ul>
  7. 7. Siesta features <ul><li>Rich set of assertion checkers - isDateEqual() </li></ul><ul><li>Ext JS awareness – waitForRowsVisible(grid, fn) </li></ul><ul><li>Global variable leak detection </li></ul><ul><li>Each test is sandboxed, and can be run in strict or quirks DocType mode </li></ul><ul><li>Monkey testing </li></ul>
  8. 8. Anatomy of a test - Harness Harness.configure({ testClass : Siesta.Test.jQuery, preload : [ // Jquery CDN 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js' ] }) ; Harness.start( '010_hello_world.t.js’, .... );
  9. 9. Anatomy of a test StartTest( function (t) { t.diag( 'Testing jQuery...' ); $( 'body' ).html( 'JQuery was here' ); t.like(document.body.innerHTML, 'JQuery was here' , 'Found correct text in DOM' ); });
  10. 10. If you’re not unit testing, you’re not refactoring. You’re just changing shit. Wise man once said...
  11. 11. More info at... www.bryntum.com/products/siesta
  12. 12. Demo time

×