简体   繁体   English

显示 flutter 测试覆盖率

[英]show flutter test coverage

I am a bit new to testing world in flutter. what I want to achieve is to determine my test coverage in flutter.我对 flutter 中的测试世界有点陌生。我想要实现的是确定我在 flutter 中的测试覆盖率

but I don't know any way to determine my test coverage , any help is appreciated.但我不知道有什么方法可以确定我的测试覆盖率,我们将不胜感激。

Thanks.谢谢。

Running the tests with运行测试

flutter test --coverage

should generate a file应该生成一个文件

/coverage/Icov.info

Which holds the information you need.其中包含您需要的信息。

You can now extract infos from the file in various methods as described here您现在可以使用此处所述的各种方法从文件中提取信息

In a easy way, you can determine the test coverage threshold using this package https://pub.dev/packages/dlcov以简单的方式,您可以使用此 package https://pub.dev/packages/dlcov确定测试覆盖率阈值

usage example:使用示例:

dlcov --lcov-gen="flutter test --coverage" --coverage=100

--lcov-gen Generate the lcov.info file --lcov-gen生成lcov.info文件

--coverage=100 To determine if the test coverage threshold is 100% --coverage=100判断测试覆盖率阈值是否为100%

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

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