Get additional results from Jasmine tests in custom reporter

425 views
Skip to first unread message

Igor Zhutaiev

unread,
Oct 22, 2014, 11:37:16 AM10/22/14
to karma...@googlegroups.com
Hello,

I'm working on benchmarking my Backbone application - testing Views initialising and rendering performance.
We have grunt + karma + jasmine setup and running.

I've created performance Jasmine tests where I measure rending speed using HTML 5 User Timing API and get some results.

So my next step is to create custom reporter that could collect this performance information after each spec execution and create XML output file.
This custom reporter works simular to JUnit Reporter https://github.com/karma-runner/karma-junit-reporter

So my question is: how can I access information from "window.performance.measure" method in my reporter or inject this data into Result object for "this.specSuccess" method from my tests? I need to pass this data from Jasmine tests (or application) to Karma

Could you please suggest me the best way to do such things?


Thanks in advance

Vojta Jína

unread,
Jan 26, 2015, 7:14:29 PM1/26/15
to karma...@googlegroups.com
In the client, you can use `window.__karma__.info()` API to send arbitrary objects to the server. Then, in your reporter, you can listen on `info` event and do whateva you need to...

--
You received this message because you are subscribed to the Google Groups "karma-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karma-users...@googlegroups.com.
To post to this group, send email to karma...@googlegroups.com.
Visit this group at http://groups.google.com/group/karma-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/karma-users/41f971c9-6b04-4f9f-9692-b93a5bd4ca45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Devan Shah

unread,
Jun 20, 2016, 11:51:36 AM6/20/16
to karma-users
Does "window.__karma__.info()" API still work. I tried the following

In adapter (framework) called:

window.__karma__.info({
            newResults: results
        }

And then in the reporter used:

    emitter.on('info', function (info) {
        console.log("info");
    });

And it is not dispatching this event, I do not see my console print

Devan Shah

unread,
Jun 21, 2016, 9:39:06 AM6/21/16
to karma-users, Vojta Jína
I tried the above and it is in fact not dispatching my event that is in the reporter.


Steps to reproduce are listed on the README file

devil...@gmail.com

unread,
Nov 23, 2016, 12:23:42 AM11/23/16
to karma-users
Am I doing something wrong in my sample example there in terms of listening on that event.
Reply all
Reply to author
Forward
0 new messages