javascript - jasmine tests, how can I improve the performance? -


I use jasmine and work for my code testing I'm App, Almost 1000 tests currently, it takes up to 10 seconds.

This is not a problem now, but in a few months the number of tests can be very large and I would like

  Jasmine Any object (object)  

I have found that there is anything that I can do to run them fast. >

There is too much to compare to big objects.

Change:

  Hope (some.method). For the Half Bin Called ("xyz"); In  

:

  is expected (some. Method.calls.argsFor (0) [0]). Tobe ("xyz");  

Looks a little too much.

Karma is beautiful but there is nothing like it that improves performance so far, although it is really useful for debugging ( report sliverathan ).

Any other ideas how can I improve the performance of the tests?

What type of performance are you looking at to switch from toHaveBeenCalledWith Are you

I appreciate you what you are trying to achieve - you have a test suit that runs 10 seconds and you are right to try and improve the situation - but If in Savings & lt; I will be careful about the range of 500 mms because the readability and clarity of your tests has been put in danger.

toHaveBeenCalledWith communicates more with its intentions for more than the argsFor approach, as the message is displayed that will Is displayed for; Expected by "Xyz"

> From that idea, some thoughts ...

1

Look at areas where you safely call each before;

each function is said before each statement in which it is called

First of all < / Code> with call

The first all function is called only once before all the specs are run in the description.

But be careful that do not present the shared status between the tests that can skew your results (Jasmin's option to run a test in a random order can be of help here but I'm not sure how first all is controlled, it may be that those glasses are still running together). Continue using

2

reportSlowerThan as you did and if any actually slow down if you suggested it Changing like the suggested suggestions is inevitable, then put them behind well-chosen names with helpful works so that what you are trying to achieve is still clear to other developers. Or better still, make custom motors for them, because its results will also be obvious if the test fails (it can help make it easier).

3

Consider switching from Jasmine, tests are written in much the same way, but the test runner is very fast.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -