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)
         
I created small plunker which has non-runnable example of how our test are 
structured :
 - http://plnkr.co/edit/F8qOdwkaXNJK9ZHhfFEl

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

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to