另外,在我将代码检入官方构建之后,有没有办法验证测试部门在进行独立测试时是否涉及了这30行代码中的所有内容?
我知道有很多工具可以验证测试部门是否测试了所有要求,但我还没有找到一种可以验证测试人员是否测试了所有代码行的工具。
我最感兴趣的是.NET/C#工具。
请查看手动测试中使用代码覆盖率
的相关内容。我已经成功使用dotnet-coverage工具,在手动或自动化测试期间能够捕获所有覆盖率百分比。
先决条件:需要安装dotnet。 要安装dotnet-coverage NuGet包的最新发布版本,请使用dotnet tool install命令:
dotnet tool install --global dotnet-coverage
dotnet tool install -g dotnet-reportgenerator-globaltool
导航到“\从项目位置执行下面的行。这将根据项目和.pdb函数在.coverage文件中收集数据
dotnet-coverage collect dotnet run
在localhost:5000中启动应用程序
执行一些场景,进行一些操作或运行任何自动化脚本,然后单击ctrl+C关闭运行-output.coverage将被创建
After executing the scripts output.coverage is getting generated so we need to merge this output.coverage to .xml with below function
dotnet-coverage merge -o output.xml -f xml output.coverage
使用报告生成器从output.xml创建html报告 ReportGenerator -reports:C:\Analytics_Application\analyticscoredev\Temenos.Insight\Temenos.InsightWeb\output.xml -targetdir:C:\SampleAppPlus\CoverageReports\html -sourcedirs:C:\SampleAppPlus
vsintr /coverage yourapp.dll
很遗憾我还没想出如何使用通配符。
启动应用程序
vsperfcmd /start:coverage /output:run.coverage
C:\Users\<your user>\Documents\IISExpress\config\applicationhost.config
获取站点名称运行您的手动测试, 然后完成
vsperfcmd /shutdown
达到100%的覆盖率可能有些过度追求,而且有些情况下即使所有代码行都被覆盖了,工具也可能不会显示。话虽如此,你应该查看Visual Studio Team System中的代码覆盖工具或任何一款外部覆盖工具,例如nCover。Team System允许您定义与测试相关的签入策略,这可能允许您确保已经测试过的代码已经签入。
将它贴在这里,以防万一我们失去它。我还没有测试过这个解决方案
由于灵活的团队系统测试基础架构设计,您可以像处理其他要进行检测的测试一样设置它:
通过双击“localtestrun.testrunconfig”文件(位于解决方案项下)打开“测试运行配置”。那里你只需导航到代码覆盖并添加/标记要检测的程序集。
然后开始测试,确保在您定义的组件路径中启动正在测试的应用程序,通常是\bin\debug。
现在只需开始测试应用程序以满足手动测试即可。在应用手动测试之前,请确保关闭应用程序,以保存代码覆盖结果。