[英]Code coverage issues after migrating from VS2010 to VS2013
Recently I migrated all my C# projects from VS2010 to VS2013. 最近,我将所有C#项目从VS2010迁移到VS2013。 There were barely any code changes required but immediately after I checked in the projects, I noticed that CI started failing.
几乎不需要任何代码更改,但是在我检入项目后,我立即注意到CI开始失败。 On checking the issue, I realized that the coverage file generated after running unit tests was not being generated in the location specified in the
.testsettings
file. 检查问题后,我意识到在
.testsettings
文件中指定的位置中未生成运行单元测试后生成的.testsettings
文件。 In the Test Results Names section of Test Settings in VS2010, I configured a user defined naming scheme and unchecked the Append date-time stamp checkbox. 在VS2010中“测试设置”的“测试结果名称”部分中,我配置了用户定义的命名方案,并且未选中“附加日期/时间戳”复选框。 This would generate the coverage file in \\\\data.coverage.
这将在\\\\ data.coverage中生成coverage文件。 After migrating to VS2013, the coverage file is getting generated in a Test Settings folder which believe is the default location when the Default naming scheme is chosen.
迁移到VS2013之后,将在“测试设置”文件夹中生成覆盖文件,当选择“默认”命名方案时,该文件夹将是默认位置。
On researching a bit, I found an MSDN post and a few other blogs posts suggesting doing away with the .testsettings
file and adopting the new .runsettings
file. 经过研究,我发现了一条MSDN帖子和其他一些博客帖子,这些帖子建议
.testsettings
文件并采用新的.runsettings
文件。 The weird thing is Microsoft is recommending usage of the .runsettings file but don't seem to deliver a default one which I can build upon. 奇怪的是,Microsoft建议使用.runsettings文件,但似乎没有提供我可以建立的默认文件。 In any case, I did create one based on the sample provided on the same MSDN post.
无论如何,我确实根据同一MSDN帖子上提供的示例创建了一个。 It did work for me as far as creation of the coverage file is concerned but I again faced the same problem that it is getting generated in a Test Results folder.
就覆盖文件的创建而言,它确实对我有用,但是我再次遇到了在“测试结果”文件夹中生成该文件的问题。 The bigger problem is that a sub-folder with some GUID type name is created into which the coverage file is dumped and it changes every time a test is run with code coverage ON.
更大的问题是,创建了一个具有一些GUID类型名称的子文件夹,并将覆盖文件转储到该子文件夹中,并且每次在代码覆盖率ON的情况下运行测试时,它都会更改。
I wonder if there's a way make my VS2010 settings work as expected in VS2013 or using the .runsettings
file, can I provide the complete path where the coverage file should be created? 我想知道是否有一种方法可以使我的VS2010设置在VS2013中达到预期效果,或者使用
.runsettings
文件,是否可以提供应该创建coverage文件的完整路径?
Go to Test->Test Settings->Select Test Settings File and select the .testsettings file associated with your test project. 转到“测试”->“测试设置”->“选择测试设置文件”,然后选择与您的测试项目关联的.testsettings文件。 It's a hack but always works.
这是一个hack,但始终有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.