While, a google search gives the purpose for Karma and Protractor, I am keen to know as to what are the best practices when it comes to writing automated tests. Is it a recommended practice to write both Karma and Protractor tests? Is this an overkill on the project. How can one find the optimal balance?
Asked
Active
Viewed 248 times
1
-
1possible duplicate http://stackoverflow.com/questions/17070522/can-protractor-and-karma-be-used-together?rq=1 – mccainz Mar 28 '14 at 19:03
-
1Karma is primarily for unit testing, as protractor is for e2e. – tymeJV Mar 28 '14 at 19:12
-
I know what each does. The purpose is clear. Should we use both for all projects? – Aneesh Mar 29 '14 at 03:16
-
2@Aneesh: if you want to be serious about testing, then yes. – JB Nizet Mar 29 '14 at 15:18
-
My personal approach is to skip e2e (protractor) for small project / simple things, but do unit tests (karma) always! – przno Mar 29 '14 at 18:31
-
delivering a buggy product is always bad and since new untested ui elements can have bugs too, why not testing them? – nilsK Mar 31 '14 at 19:03
1 Answers
0
It is not an overkill!
Only Protractor runs end-to-end (e2e) tests, i.e. your complete application, so this is the only reliable way to test the end result.
However, errors due to individual pieces of your code are hard to track with e2e tests. Also Protractor is slow and not suitable for running in background upon every source file edit, as Karma can do.
See my answer here for more detailed discussion of use cases, advantages and limitations of Karma and Protractor.

Community
- 1
- 1

Dmitri Zaitsev
- 13,548
- 11
- 76
- 110