Skip to main content

Bug Tracker

Side navigation

#3215 closed enhancement (fixed)

Opened August 03, 2008 03:08PM UTC

Closed June 09, 2009 05:24PM UTC

Bugfixes + Features for QUnit testrunner

Reported by: chadmyers Owned by: joern
Priority: trivial Milestone: 1.3
Component: qunit Version: 1.2.6
Keywords: qunit testrunner Cc:
Blocked by: Blocking:
Description

We're using QUnit at my work for testing and we found a sporadic bug with the test timing which I believe is due to the use of calculations with Date() instead of Date().getTime().

We also added the following features:

1.) Display the number of GOOD/PASSED tests in the stats display (instead of just the failed ones)

2.) beforeEach() and afterEach() for more XUnit-style setup/teardown behavior.

3.) Appending a hidden results div with a special ID to make it easier to integrate QUnit tests into your CI build with things like WatiR or WatiN.

Please consider the patch below to see if there's anything you might find useful for contributing into the trunk (either code or ideas).

Attachments (2)
  • testrunner.js (11.2 KB) - added by chadmyers August 03, 2008 03:09PM UTC.

    Full test runner source (for your convenience)

  • testrunner.patch (2.7 KB) - added by chadmyers August 03, 2008 03:08PM UTC.

    Testrunner patch for trunk rev 5800.

Change History (3)

Changed August 08, 2008 06:11PM UTC by joern comment:1

resolution: → fixed
status: newclosed

Commited [5815], improving the date handling (not much difference) and adding an id and two spans with classes to the result element, also documented how to read that microformat: http://docs.jquery.com/QUnit#Integration_into_Browser_Automation_Tools

I'd need a usecase for the other two things: With the numbers for all and failed tests, the number of succesful tests can be computed, why add the code to count them, too? beforeEach/afterEach is less useful in the context of QUnit, where those would have a global scope - in contrast to eg. JUnit's setUp/tearDown, which are local to a single TestCase.

Please reopen the ticket with usecases for those, and I consider adding them, too.

Changed August 12, 2008 01:16AM UTC by chadmyers comment:2

resolution: fixed
status: closedreopened

@joern This is great, thank you!

As for the use cases:

1.) Number of Successful Tests: Agreed we don't need the extra variable to track it, but the output display is nice. Several of our developers thanked me for adding that to our build. It's minor, granted, but it's nice to see more than just 0 failures all the time :)

2.) As for beforeEach/afterEach, I don't understand. These run before each individual test in the suite, not just the entire suite. So it is local to each test case, but it's common setup/teardown needed for each, individual test() call. This one I consider very important and required for any sort of XUnit-style testing.

Thanks again for considering these. Sorry to be a pest, but I think these changes make QUnit even better!

Changed June 09, 2009 05:24PM UTC by joern comment:3

resolution: → fixed
status: reopenedclosed

Fixed in r6381. beforeEach/afterEach is available as the lifecycle argument of the module method: http://docs.jquery.com/QUnit/module#namelifecycle