Bug Tracker

Modify

Ticket #3215 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

testrunner.patch Download (2.7 KB) - added by chadmyers 5 years ago.
Testrunner patch for trunk rev 5800.
testrunner.js Download (11.2 KB) - added by chadmyers 5 years ago.
Full test runner source (for your convenience)

Change History

Changed 5 years ago by chadmyers

Testrunner patch for trunk rev 5800.

Changed 5 years ago by chadmyers

Full test runner source (for your convenience)

comment:1 Changed 5 years ago by joern

  • Status changed from new to closed
  • Resolution set to fixed

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.

comment:2 Changed 5 years ago by chadmyers

  • Status changed from closed to reopened
  • Resolution fixed deleted

@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!

comment:3 Changed 4 years ago by joern

  • Status changed from reopened to closed
  • Resolution set to fixed

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.