cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Vergés (JIRA) <>
Subject [jira] [Created] (CB-4050) The async automated test are unnecessarily slow
Date Fri, 28 Jun 2013 19:18:20 GMT
Xavier Vergés created CB-4050:

             Summary: The async automated test are unnecessarily slow
                 Key: CB-4050
             Project: Apache Cordova
          Issue Type: Wish
          Components: mobile-spec
            Reporter: Xavier Vergés
            Assignee: Filip Maj
            Priority: Minor

The automated tests in {{cordova-mobile-spec/autotest}} are coded to wait only for the expected
callback and do not wait for the callback that will only be called when the test fails. This
causes some of the failing tests to have to wait for a timeout.

{code:JavaScript|title=test that expects fail callback to be called}

// create jasmine spies as a success and failure callback
var win = ...;
var fail = ...;

// make call, passing the two spies
runs(function() {xxx(win, fail); });

// wait for fail to be called 
waitsFor(function() { return fail.wasCalled; }, 
  "error callback never called", 

// verify the spies state
runs(function() {

If the implementation is broken and calls the {{win}} callback, the test won't finish until
TEST_TIMEOUT expires. The above pattern is pervasive in the tests in {{cordova-mobile-spec/autotest}}

If the code would check that any of the callbacks have been called

// wait for either of the two callbacks to be called 
waitsFor(function() { return fail.wasCalled | win.wasCalled; }, 
  "callback never called", 


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message