1. #1
    Ext User
    Join Date
    May 2008
    Posts
    7
    Vote Rating
    0
    jjathman is on a distinguished road

      0  

    Default Testing Ext applications

    Testing Ext applications


    My group has just started using Ext and are wondering if anyone has some good strategies for testing ext based applications? Currently we use JSUnit and Selenium to test our pages, which works fine on traditional pages with a relatively static DOM, but with all the dynamic content created by Ext our tools don't seem to work quite as well.

    What is everyone else out there using to test their applications? I'm especially curious about how to mock out the server dependencies on the Ajax requests. Thanks.

    By the way, we love Ext, it's an amazing framework.

  2. #2
    Ext JS Premium Member Foggy's Avatar
    Join Date
    Apr 2007
    Location
    Switzerland
    Posts
    477
    Vote Rating
    0
    Foggy is on a distinguished road

      0  

    Default


    I am testing with my browser and some js debugging tools. My favorite harnessed team is firefox and firebug...

  3. #3
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by jjathman View Post
    My group has just started using Ext and are wondering if anyone has some good strategies for testing ext based applications? Currently we use JSUnit and Selenium to test our pages, which works fine on traditional pages with a relatively static DOM, but with all the dynamic content created by Ext our tools don't seem to work quite as well.

    What is everyone else out there using to test their applications? I'm especially curious about how to mock out the server dependencies on the Ajax requests. Thanks.

    By the way, we love Ext, it's an amazing framework.
    I use JSunit to mock the server responses.

    JSUnit (SVN version) contains a mockRequest object - checkout Edward Hieatts blog. You may also want to look at MockJS for additional object mocking.

    In your page setup replace Exts xhr object with the mock version like so:

    PHP Code:
    mockRequest createXmlHttpRequest();
    Ext.lib.Ajax.createXhrObject = function(transactionId) {
        return{
    conn:mockRequesttId:transactionId};
    }; 
    Also bear in mind that the calls are Asynchronous, so you cant execute a request and assert the response within each test.

    I therefore have a chain of setup methods (to call the Ajax.request) and callbacks (1 of each for each test) - these are kicked off on pageSetup and my callbacks stores the relevant data to test.

    After my setup chain has completed I use:

    PHP Code:
    function setupComplete() {
        
    setUpPageStatus 'complete';    

    ... and then my tests run and assert the stored values from each callback.

    Apart from some more tricky UI stuff I haven't found any part of Ext that I couldn't test with JSUnit and MockJS.

    Hope this helps,

Thread Participants: 2