At the moment we have close to 1000 unit tests written in jasmine/typescript. When I run them all they take as much as 5 mins on chrome. We do have some unit tests which deals with DOM as well. e.g. verify if a button exists with specified text. We have a number of files where these tests are distributed. We have noticed that when we run individual files and sum up total time taken, it is far less than that of when we run all tests in one go. That's why we are thinking if there is a way to run tests in parallel? The plan is to divide tests and run them in parallel.
We can utilize karma-parallel plugin to execute test cases parallely. This npm package splits your unit tests into multiple suites that run in parallel with each other, on different threads of your processor.
A Karma JS plugin to support sharding tests to run in parallel across multiple browsers.
Jasmine doesn't actually support parallel execution. It runs one spec (or before/after) function at a time.
The 'go test' command may run tests for different packages in parallel as well, according to the setting of the -p flag (see 'go help build').
You can use karma-parallel to split up your tests across multiple browser instances. It runs specs in different browser instances and is very simple and easy to install:
npm i karma-parallel
and then add the 'parallel' to the frameworks list in karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ['parallel', 'jasmine']
});
};
karma-parallel
Disclosure: I am the author
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With