Hi all,
I want to ask for a guideline or some tips of how to correctly write large number of unit tests. Currently we have around 1800 tests and that numbers increases every day.
Majority of the tests are testing directives and services. Some of the directives renders whole panels and so on.
When we run the tests on Chrome , memory goes up to around 850 MB and they are starting to execute slow and after some period browser is disconnected.
If we switch to Firefox, then test are passing, because Firefox doesn't have a memory limit per tab (as chrome has), but that is temporary solution.
Obviously we have some memory leak or we don't do proper clean up after the test.
About our tests and set up:
- We use :
- angularJS: 1.3.2
- grun-karma: 0.8.2
- jasmine
- Each test is defined in own file (.spec.js)
- We have general helper file that has :
- beforeEach when we set up some mock for all of the tests.
- afterEach when we try to clean up :
- compiled element with dealoc function (copied from anguilarJS source)
- clean $rootScope and $rootElement (also copied from angularJS source)
Currently we are investigating to see why our test take that much of memory (memory leak). Our application works fine without consuming memory at all.
If anyone had some similar problem or some tips like how to clean up, what not to use in test (like mock ngModelController) or any idea, please share to us.
Thanks in advance,
Igor