简体   繁体   中英

Is there a code coverage for HTML using Karma when doing angular e2e test?

We can use coverage to see how much javascript code is covered with our unit testing. With e2e testing we are literally testing view components in HTML code against controller. So the question is, is there same code coverage available for how much of HTML DOM elements are covered or touched in our e2e testing? I agree, there is a big difference in the execution path testing and UI testing. but curious. Thanks

As I know e2e testing use your files served by your web server, for unit test they are served directly by karma, e2e testing is mostly used to be sure your page work like you expect, end-to-end test use your server side and client side. That's why you typically never expected to have 100% e2e coverage because they are more fragile.

So people focus on unit test (testing all edge-cases), and they add e2e test to be sure the behavior of the page works correctly.

You can use istanbul and build the coverage report with karma.

http://gotwarlost.github.io/istanbul/

Or this article : http://lkrnac.net/blog/2014/04/measuring-code-coverage-by-protractor/ sum up how to use protractor e2e to generate coverage report of your e2e tests. Using using this tool : https://github.com/r3b/grunt-protractor-coverage

Hope it's help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM