Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain karma unit test times

I've been searching the web for this for two days and I found nothing. Maybe I'm looking in the wrong way — I don't know...

So here it is: what are the times on my console when running a Karma+Jasmine+phantomJs unit test?

... Executed 1 of 1 SUCCESS (0.878 secs / 0.112 secs)

First, I though that the second time is the total unit test time (for example, when running multiple tasks), however, sometimes the first time gets to be 'bigger', sometimes not...

Anyone?

like image 350
ppseprus Avatar asked Jan 06 '16 17:01

ppseprus


People also ask

What is karma in unit testing?

Karma is a node-based test tool that allows you to test your JavaScript codes across multiple real browsers. A node-based tool is any tool that needs the Nodejs engine installed for it to run and can be accessed (installed) through the node package manager (npm).

How long should a unit test take?

The average for all 21 of these unit tests comes to 0.019785 seconds. Note the slowest test is due to it using Microsoft Moles to mock/isolate the file system. So with this example, if my unit test suite grows to 10,000 tests, it could take over 3 minutes to run.

What is difference between Jasmine and karma?

Jasmine can be classified as a tool in the "Javascript Testing Framework" category, while Karma is grouped under "Browser Testing". "Can also be used for tdd " is the primary reason why developers consider Jasmine over the competitors, whereas "Test Runner" was stated as the key factor in picking Karma.


1 Answers

total time / net time

  • net time = only test execution (in the browser)
  • total time = how long it took since Karma noticed the file change till the final result was printed (net time + communication with the browser + loading the files in the browser)

See karma/lib/reporters/base.js

like image 168
Vojta Avatar answered Oct 01 '22 20:10

Vojta