Git Product home page Git Product logo

Comments (12)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
To test asynchronous code you can use the JS Unit Mock Timeouts.

See this previous thread discussing it:
http://groups.google.com/group/js-test-driver/browse_thread/thread/13...

Or check out this Google Testing Blog entry:
http://googletesting.blogspot.com/2007/03/javascript-simulating-time-...

This approach works by overriding the setTimeout and setInterval
functions, and giving you a clock you can explicitly control in your
tests.

The main benefit of this approach is all your tests run instantly, you don't 
actually
need to wait for the timeout to complete! And there is no need for a timeout, 
which
could cause intermittent failures (due to a slow test machine for example.)

Original comment by [email protected] on 30 Aug 2009 at 8:32

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
Thanks for the hint into this direction.

Because I always used QUnits possibilities to test asynchronous call, I never 
thought
about simply mocking them to create a synchronous sequence of calls. Even 
though this
seems quite intuitively the right thing to do now, I just never thought of it. 
The
jsUnit Mock Timeouts are a great addition to this.

This should cover everything I need to test using js-test-driver.

I like js-test-driver better every minute ;)

greetings Jakob  

Original comment by [email protected] on 30 Aug 2009 at 11:08

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
I second the desire to get support for asynchronous tests. I've been using the 
JsUnit
mocker, and it works like a charm. Maybe it should just be rolled into 
JsTestDriver?

Original comment by [email protected] on 20 Oct 2009 at 4:07

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
I noticed that there is an implementation for asynchronous tests in the latest 
JsTestDriver trunk.  I modified the QUnit adapter to support stop(), start(), 
and asyncTest().

The modified adapter works as of revision r364 if the patch from issue 125 is 
applied.

Original comment by [email protected] on 9 Jul 2010 at 11:19

Attachments:

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
Is the revision in Comment #4 correct?  I looked at the patch and it doesn't 
seem to match up with the underlying source.  In fact I can't find any version 
of that file (QUnitAdapter.js) that lines up with the patch.  Did it come from 
a branch?

I ask this because I would love to use JSTD but I need to test async calls.  It 
is for doing integration tests rather than unit tests, but I still need a 
similar framework.

Original comment by [email protected] on 11 Sep 2010 at 6:06

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
Never mind comment #5.  I upgraded to the head (r688) and the patch worked fine 
(assuming that the patch from issue 125 is applied first)

Original comment by [email protected] on 11 Sep 2010 at 6:16

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
I'm sorry; I must have completely spaced when I wrote the revision number in 
comment #4.

Original comment by [email protected] on 11 Sep 2010 at 7:33

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
I created a new plugin called QUnitTestRunnerPlugin 
<http://github.com/jivesoftware/QUnitTestRunnerPlugin> that I believe provides 
more robust support for running asynchronous tests with JsTestDriver and QUnit 
than QUnitAdapter does.  It also does not require patching JsTestDriver.  We 
are using QUnitTestRunnerPlugin to test production code at Jive Software.

Original comment by [email protected] on 11 Sep 2010 at 10:31

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
The implementation of AsyncTestCase in release 1.2.2 works, just not as 
advertised in its current docs at 
http://code.google.com/p/js-test-driver/wiki/AsyncTestCase. Presumably the 
version in svn trunk works as described on that page.

Essentially, the 1.2.2 version passes a pool object to the tests in an 
AsyncTestCase rather than a queue object.

Original comment by [email protected] on 9 Dec 2010 at 4:17

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
See also issue 171, which more-or-less duplicates this one.

Original comment by [email protected] on 9 Dec 2010 at 4:27

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
Fully release in 1.3.0

Original comment by [email protected] on 14 Feb 2011 at 4:39

  • Changed state: Fixed

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 18, 2024
I extended the adapter to add/update the methods to current QUnit trunk (as of 
15/09/11). Includes the patch above, adding QUnit async methods with some 
bugfixes.

You can find it here: https://github.com/progmedia/QUnit-to-JsTestDriver-adapter

Feel free to fork it and suggest patches. 

I'll soon be updating this repo with some scripts i'm working on to add support 
for external HTML fixtures, accessible from the DOM in tests, something I find 
sorely lacking in Js-Test-Driver.

Original comment by [email protected] on 16 Sep 2011 at 1:15

from js-test-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.