You are right, I was not updated and the done function was missing.

That function is not mentioned in the API doc so I did not check if
there was a newer version. Anyway, it was a good exercise making the
changes :)

Many thanks for letting me know

Miquel

2009/4/27 John Resig <[email protected]>:
> What version of qUnit are you using? You can just hook in to QUnit.done and
> it gets called when the tests are done running.
>
> --John
>
>
> On Sun, Apr 26, 2009 at 7:52 AM, Miquel <[email protected]> wrote:
>>
>> I am after a way to better integrate Qunit into a continuous
>> integration system. I need quinit to send a report to a web server but
>> could not find a way to hook a callback at the end of the tests where
>> I could use ajax to send the stats.
>>
>> So I did the following simple changes to testrunner.js to allow that.
>>
>> first add a neutral callback for report as default:
>>
>> var config = {
>>        Test: [],
>>        ... (line 21)
>>        report: function(){},
>>        // block until document ready
>>        blocking: true
>> };
>>
>>
>> function runTest() {
>>   ... (line 18)
>>        $("#banner").addClass(config.stats.bad ? "fail" : "pass");
>>        config.report(config.stats);
>> });
>>
>> (line 206)
>> // callback after running all tests
>> function report(callback) {
>>        config.report = callback;
>> }
>>
>>
>> // public API as global methods
>> $.extend(window, {
>>   ... (line 527)
>>        triggerEvent: triggerEvent,
>>        report: report
>> });
>>
>> This adds a report() function allowing to set a callback which will
>> receive the stats as parameter at the end of the test run.
>>
>> In the test page we can use it to set up a hook for that report as in
>> the following example:
>>
>> <script>
>>    $(document).ready(function(){
>>
>>        test('Succeed', function() {
>>            expect(1);
>>                        ok(true);
>>        });
>>
>>        test('Fail', function() {
>>            expect(1);
>>                        ok(false);
>>        });
>>
>>        report(function(stats){
>>                alert(stats.bad + " of " + stats.all + " failed.");
>>        });
>>    });
>>
>> </script>
>>
>> What do you think of this? Would it be worth to add it to the main
>> stream?
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to