Total runtime using pocket test

Currently, we have switched to running unit tests remotely on browserstack in multiple browsers on multiple operating systems using karma-browserstack-launcher .

Currently, the output of the test run is as follows:

 $ grunt unit:remote Running "unit:remote" task Running "karma:remote" (karma) task INFO [karma]: Karma v0.12.23 server started at http://localhost:9876/ INFO [launcher]: Starting browser firefox 21.0 (OS X Mountain Lion) on BrowserStack INFO [launcher]: Starting browser iPhone 5 (ios 6.0) on BrowserStack INFO [launcher]: Starting browser android (android 4.1) on BrowserStack INFO [launcher]: Starting browser ie 8.0 (Windows 7) on BrowserStack INFO [launcher]: Starting browser ie 9.0 (Windows 7) on BrowserStack INFO [launcher]: Starting browser chrome latest (OS X Mavericks) on BrowserStack INFO [launcher]: Starting browser PhantomJS PhantomJS 1.9.7 (Mac OS X): Executed 70 of 70 SUCCESS (0.063 secs / 0.275 secs) Chrome 37.0.2062 (Mac OS X 10.9.0): Executed 70 of 70 SUCCESS (0 secs / 0.452 secs) Mobile Safari 6.0.0 (iOS 6.1.4): Executed 70 of 70 SUCCESS (1.161 secs / 0.839 secs) Firefox 21.0.0 (Mac OS X 10.8): Executed 70 of 70 SUCCESS (1.175 secs / 0.496 secs) ... 

Reported runtime for each browser.

Is there a way to see the total runtime on the console?


FYI, here is the karma config that we use.

+6
source share
2 answers

I forked the karma plugin and added the extraLog option to karma browserStack config to get additional information after all your browsers have completed, including the overall execution and network time of all browsers.

I mainly use browser_complete event emitter which give me the total and net browser.

 emitter.on('browser_complete', function (data) { result.browsers.push({ name: data.name, time: data.lastResult.totalTime }); result.time.net += data.lastResult.netTime; result.time.total += data.lastResult.totalTime; //this is what we want }); 

Using three browsers here is an example output (sorry I'm not a designer yet):

screen

This allows you to get a more accurate result compared to time-grunt.

You can view the code here in the feature-extra-logs branch.

I really donโ€™t know how you want (and best of all) to deploy it for yourself, because I donโ€™t think it is interesting enough to be combined with the upstream, but I could be wrong.

+5
source

Not entirely specific to karma, but you can use https://github.com/sindresorhus/time-grunt to find out how long the entire block takes: a remote task.

Just by copying the readme.md file, you can install it with

 npm install --save-dev time-grunt 

And then edit your grunt file as

 // Gruntfile.js module.exports = function (grunt) { // require it at the top and pass in the grunt instance require('time-grunt')(grunt); grunt.initConfig(); } 

Then, when you start the task (s), you should get the output, for example:

time-grunt example

+3
source

Source: https://habr.com/ru/post/975328/


All Articles