Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing Ext JS 5 Applications with Siesta

Mats Bryntse
December 02, 2014

Testing Ext JS 5 Applications with Siesta

From SenchaDay 2014 in Karlsruhe

Mats Bryntse

December 02, 2014
Tweet

More Decks by Mats Bryntse

Other Decks in Technology

Transcript

  1. Webinar | Content Unit tests UI tests Continuous Integration •

    Writing a unit test • Using PhantomJS • Hello world sample • Event recorder intro • Testing an Ext JS cmp • Recording a UI test • TeamCity • Code Coverage • Statistics • Cloud Testing
  2. Intro | WHY 1. Productivity & confidence in code 2.

    Frameworks contain bugs 3. So does your code (and mine) 4. Refactoring & code handover 5. Fix bugs once
  3. Intro | Testing with Siesta • runs in any browser

    • is written in plain JS • is sandboxed by default A Siesta test…
  4. Intro | Testing with Siesta • can do both UI

    and unit testing • can be automated using PhantomJS or Selenium WebDriver • can detect leaked global variables A Siesta test…
  5. Intro | Testing with Siesta describe('A simple Model test', function

    (t) {
 
 t.it('Should do something', function(t) {
 
 // Test things
 t.expect(1).toBe(1);
 });
 });

  6. Unit tests | Intro •Unit tests usually only involve “raw”

    JS •Run very fast •Perfect for pre-commit hooks •Disable sandboxing if possible
  7. Unit tests | Intro •Should be your #1 priority •Cover

    your most important JS classes •Run often, before commit, daily, nightly. •Use TDD approach + BDD style for readability
  8. Unit tests | TDD basics 1. Make the unit test

    fail 2. Implement 3. Make the test pass 4. Refactor, Repeat
  9. UI tests | Intro •UI “unit test” of a single

    UI component •Or Application test, open index.html and test it Two main types of UI tests
  10. UI tests | Event recorder •Great for application tests •Records

    user actions: clicks, types, drag drop •Exports actions to a Siesta test case •Can be used by a non-programmer •Big timesaver
  11. UI tests | Monkey tests •Random UI testing •Clicks, drags

    etc. in your UI •Finds unhandled exceptions •Free testing help. 0€
  12. Continuous Integration | Intro •Bryntum uses TeamCity, Siesta integrates with

    others (Jenkins…) •Test suites run every 2 hours in Chrome •Full test suites executed nightly •Reports, statistics, charts and code coverage
  13. Continuous Integration | Cloud testing •Need to create Virtual Machines

    for each version of IE •Total: Chrome, Safari, FF, IE 7-11 => 7 VMs •Managing such a farm can be very time consuming
  14. Continuous Integration | Cloud testing •Siesta integrates with both BrowserStack

    and Sauce Labs •Run tests easily in any OS and Browser combination •No need to setup your own VM farm •Read more on the Bryntum blog…