cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lorin Beer (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CB-4050) The async automated test are unnecessarily slow
Date Wed, 23 Oct 2013 22:16:44 GMT

     [ https://issues.apache.org/jira/browse/CB-4050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lorin Beer reassigned CB-4050:
------------------------------

    Assignee: Lorin Beer  (was: Filip Maj)

> The async automated test are unnecessarily slow
> -----------------------------------------------
>
>                 Key: CB-4050
>                 URL: https://issues.apache.org/jira/browse/CB-4050
>             Project: Apache Cordova
>          Issue Type: Wish
>          Components: mobile-spec
>            Reporter: Xavier Verg├ęs
>            Assignee: Lorin Beer
>            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", 
>   Tests.TEST_TIMEOUT);
> // verify the spies state
> runs(function() {
>                     expect(win).not.toHaveBeenCalled();
>                     expect(fail).toHaveBeenCalled();
>                 });
> {code}
> 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
> {code:JavaScript}
> // wait for either of the two callbacks to be called 
> waitsFor(function() { return fail.wasCalled | win.wasCalled; }, 
>   "callback never called", 
>   Tests.TEST_TIMEOUT);
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message