3

I am trying to figure out the best and reliable solution to speed up my unit tests written in angular project.

I have gone through some couple of blogs which suggests to use either

(1) ng-bullet

(2) karma-paralle

(3) ng test  --browsers ChromeHeadless

(4) configure your test module inside beforeAll suite 

Angular 4 Unit Tests (TestBed) extremely slow (point 4)

My question is can we use all these options at a time to speed up the unit test execution as well as build time and if not which option should I choose to improve the performance of unit test cases execution.

Also which option is more reliable and easy to use?

Any help/suggestion is appreciable.

Thanks

shreyansh
  • 1,427
  • 4
  • 21
  • 39

2 Answers2

1

I don't know about ng-bullet, I am trying to implement it now. I will maybe comment to this response my findings.

karma-parallel - I have used it to make tests faster but this is because the tests were written in an anti-pattern way. Making your unit tests faster with karma-parallel is a slim chance because you have to remember karma-parallel has to delegate how to split up the describe blocks across the instances of browsers which can take a long time in itself.

Running the tests headless may make the test faster and consume less resources on your computer.

Most important for you is to experiment with each one and them together and see what is the best fit for you in my opinion.

AliF50
  • 8,832
  • 11
  • 17
1

I use ng-bullet im my projects, and I do not faced with the better way to increase speed of my unit-tests. In different projects ng-bullet incerese speed for check all test about 5 times faster. You can see how it was without ng-bulle: You can see how it was without ng-buller And how it is now and how it is now I think ng-bullet is the easiest way to improve the speed of tests if its number does not exceed 2000 tests, in that case you needs to use karma-parallel too. But in some case ng-bullet did errors log useless, it may be difficult to understand what is happening.