Multiplos Teste assicronos no qunit

1 resposta
K

[size=18]só o primeiro teste é executado, alguem sabe com resolvo isso?[/size]

asyncTest( "asynchronous test: two second later!", function() {
  expect( 1 );
 
  setTimeout(function() {
    ok( true, "Passed and ready to resume!" );
    start();
  }, 2000);
});

asyncTest( "asynchronous test: five second later!", function() {
  expect( 1 );
 
  setTimeout(function() {
   
 ok( true, "Passed and ready to resume!" );
    start();
  }, 5000);
});

asyncTest( "asynchronous test: one second later!", function() {
  expect( 1 );
 
  setTimeout(function() {
    ok( true, "Passed and ready to resume!" );
    start();
  }, 1000);
});

1 Resposta

W

Ola,

eu rodei os seus tests sem problemas, os 3 foram executados normalmente.

Talvez voce esteja achando que soh o primeiro roda porque o segundo teste tem um timeout the 5 segundos, ai demora um pouco mais para roda.

Aqui vai o meu codigo completo:
HTML

<!DOCTYPE html>  
<html>  
<head>  
    <title>QUnit Test Suite</title>  
    <link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen">  
    <script type="text/javascript" src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>      
    <script type="text/javascript" src="myTests.js"></script>  
</head>  
<body>  
    <h1 id="qunit-header">QUnit Test Suite</h1>  
    <h2 id="qunit-banner"></h2>  
    <div id="qunit-testrunner-toolbar"></div>  
    <h2 id="qunit-userAgent"></h2>  
    <ol id="qunit-tests"></ol>  
</body>  
</html>

Javascript (testes)

asyncTest( "asynchronous test: two second later!", function() {  
  expect( 1 );  
  
  setTimeout(function() {  
    ok( true, "Passed and ready to resume!" );  
    start();  
  }, 2000);  
});  
  
asyncTest( "asynchronous test: five second later!", function() {  
  expect( 1 );  
  
  setTimeout(function() {  
     
ok( true, "Passed and ready to resume!" );  
    start();  
  }, 5000);  
});  
  
asyncTest( "asynchronous test: one second later!", function() {  
  expect( 1 );  
  
  setTimeout(function() {  
    ok( true, "Passed and ready to resume!" );  
    start();  
  }, 1000);  
});

//Daniel

Criado 3 de setembro de 2012
Ultima resposta 19 de set. de 2012
Respostas 1
Participantes 2