简体   繁体   English

如何在 Jasmine 测试用例中将代码覆盖率提高到 80%

[英]How to increase code coverage to 80 percentage in Jasmine test case

I have written completed writing HTML, TS and service for angular components.我已经完成了 Angular 组件的 HTML、TS 和服务的编写。 I now have started writing test cases..but I cannot reach 80 percentage.我现在已经开始编写测试用例了……但是我不能达到 80%。 Can someone please help how to reach till 80 percentage.有人可以帮助如何达到80%。 Also, is there some tool which can help me determine what cases I have missed?另外,是否有一些工具可以帮助我确定我错过了哪些案例?

In the root of your application, there should be a coverage folder.在您的应用程序的根目录中,应该有一个coverage文件夹。 Open the index.html in this folder and it will show you which lines, statements, branches (if, else) and functions/methods are covered.打开此文件夹中的index.html ,它会显示哪些行、语句、分支(if、else)和函数/方法被覆盖。 Coverage means does your unit test traverse those areas.覆盖率意味着您的单元测试是否遍历这些区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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