如何解决TeamCity中缺少的测试范围? [英] How to trouble-shoot missing test coverage in TeamCity?

查看:118
本文介绍了如何解决TeamCity中缺少的测试范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据日志,我缺少获取测试覆盖率的信息.可能的原因是:

According to the log I'm missing the info to get the test coverage. Possible reasons are:

  1. 包含/排除模式不正确
  2. 在没有调试信息的情况下编译程序集
  3. PDB文件不可用
  4. 已为MSTest启用Visual Studio代码覆盖率
  5. TESTRUNCONFIG用于MSTest,并且未禁用Visual Studio代码覆盖范围

作为TeamCity的新手,我需要一些操作指南.

Being a novice on TeamCity, I need some guidance on what to do.

  1. 我已经通过 +:* DLL 包含了所有DLL.目前尚无排除,但我尝试通过-:* test * 忽略测试本身.
  2. 我使用 DEBUG 配置文件进行编译,并将结果放在 bin/debug obj/debug 目录中的服务器上.根本没有发行版.
  3. 我在服务器上的 .source/bin/debug 中有PDB文件.
  4. 由于我在TeamCity服务器上运行了nUnit和dotCover,所以没有涉及VS.
  5. 由于我在TeamCity服务器上运行了nUnit和dotCover,所以没有涉及VS.
  1. I've included all DLLs by +:*DLL. No exclusion at the moment but I've tried to omit the test itself by -:*test*.
  2. I compile using DEBUG profile and the result is put on the server in bin/debug and obj/debug directories. There's no release at all.
  3. I have PDB files in .source/bin/debug on the server.
  4. Since I run the nUnit and dotCover on the TeamCity server, there's no VS involved.
  5. Since I run the nUnit and dotCover on the TeamCity server, there's no VS involved.

我想念什么?我还能做些什么?

What do I miss? What can I do more?

系统为:VS13,TFS10,TC8.2(附带的nUnit和dotCoverage最新版本)

The system is: VS13, TFS10, TC8.2 (the latest available with the included nUnit and dotCoverage)

日志的一部分,它是测试步骤(未报告编译步骤中的任何错误,退出代码0).此后,仅删除dotCover快照文件.但是请注意,找不到DATA文件,并且XML文件不包含任何数据.

The part of log that is the testing step (no errors in the compile step reported, exit code 0). After this, there's only the removal of dotCover snapshot files. Note, however, that there's no DATA file to be found and that the XML file contains no data.

<?xml version="1.0" encoding="UTF-8"?>
<Root DotCoverVersion="2.6.1000.602" 
      ReportType="TeamCityXml" 
      CoveragePercent="0" 
      TotalStatements="0" 
      CoveredStatements="0"/>

我在这里可以做什么?

[10:59:39]步骤2/2:测试(NUnit)(29秒)
[10:59:39]开始:C:\ TeamCity \ buildAgent \ plugins \ dotnetPlugin
\ bin \ JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[10:59:39]位于目录:C:\ TeamCity \ buildAgent \ work \ 263aa919ed5f7bb8
[10:59:46] JetBrains dotCover控制台运行程序v2.6.1000.602.版权所有(c)2009-2014 JetBrains s.r.o.保留所有权利.
[10:59:55] [JetBrains dotCover]覆盖面会话开始了[2014-06-30 10:59:55]
[11:00:02]启动TeamCity NUnit测试运行器
[11:00:02]在.NET Framework v4.0 x64下运行NUnit-2.6.3测试
[11:00:03]AutonomousTesting.dll
[11:00:03]CoverageTest.TestExample.TestEquality
[11:00:03]CoverageTest.TestExample.TestException
[11:00:03]CoverageTest.TestExample.TestInequality
[11:00:03]CoverageTest.TestExample.TestOmission
[11:00:03]测试被忽略:CoverageTest.TestExample.TestOmission
[11:00:05]AutonomousTesting.dll
[11:00:05]CoverageTest.TestExample.TestEquality
[11:00:05]CoverageTest.TestExample.TestException
[11:00:05]CoverageTest.TestExample.TestInequality
[11:00:05]CoverageTest.TestExample.TestOmission
[11:00:05]忽略的测试:CoverageTest.TestExample.TestOmission
[11:00:07] [JetBrains dotCover]覆盖率会话结束[2014-06-30 11:00:07]
[11:00:07] [JetBrains dotCover]覆盖范围结果开始后处理[2014-06-30 11:00:07]
[11:00:08] [JetBrains dotCover]覆盖范围结果后处理完成[2014-06-30 11:00:08]
[11:00:09] ## teamcity [importData type ='dotNetCoverage'tool ='dotcover'file ='C:\ TeamCity \ buildAgent \ temp \ buildTmp \ coverage_dotcover16594618384737853441.data']
[11:00:09]使用"dotNetCoverage"处理器从"C:\ TeamCity \ buildAgent \ temp \ buildTmp \ coverage_dotcover16594618384737853441.data"中导入数据(8.38 KB) [11:00:09]进程退出,代码为0
[11:00:09]正在等待1个服务流程完成
[11:00:09]正在处理1个覆盖率报告
[11:00:09]通过dotcover生成文件的覆盖率报告:[C:\ TeamCity \ buildAgent \ temp \ buildTmp \ coverage_dotcover16594618384737853441.data]
[11:00:09]获取dotCover版本
[11:00:09]启动了dotCover:C:\ TeamCity \ buildAgent \ tools \ dotCover \ dotCover.exe版本C:\ TeamCity \ buildAgent \ temp \ buildTmp \ dotCover4472367238745438467Version
[11:00:09]输出:JetBrains dotCover Console Runner v2.6.1000.602.版权所有(c)2009-2014 JetBrains s.r.o.保留所有权利.
[11:00:09] dotCover退出,代码为0
[11:00:09]使用设置的DotCover 2.6.x命令
[11:00:09]合并dotCover报告(9秒)
[11:00:19]启动了dotCover:C:\ TeamCity \ buildAgent \ tools \ dotCover \ dotCover.exe合并C:\ TeamCity \ buildAgent \ temp \ buildTmp \ dotcover4719506578346509917.xml
[11:00:19]输出:JetBrains dotCover Console Runner v2.6.1000.602.版权所有(c)2009-2014 JetBrains s.r.o.版权所有. [JetBrains dotCover]快照合并开始[2014-06-30 11:00:18] [JetBrains dotCover]源快照编号:1 [JetBrains dotCover]快照合并完成[2014-06-30 11:00:19]
[11:00:19] dotCover退出,代码为0

[10:59:39]Step 2/2: Test (NUnit) (29s)
[10:59:39]Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin
\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[10:59:39]in directory: C:\TeamCity\buildAgent\work\263aa919ed5f7bb8
[10:59:46]JetBrains dotCover Console Runner v2.6.1000.602. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[10:59:55][JetBrains dotCover] Coverage session started [2014-06-30 10:59:55]
[11:00:02]Start TeamCity NUnit Test Runner
[11:00:02]Running NUnit-2.6.3 tests under .NET Framework v4.0 x64
[11:00:03]AutonomousTesting.dll
[11:00:03]CoverageTest.TestExample.TestEquality
[11:00:03]CoverageTest.TestExample.TestException
[11:00:03]CoverageTest.TestExample.TestInequality
[11:00:03]CoverageTest.TestExample.TestOmission
[11:00:03]Test ignored: CoverageTest.TestExample.TestOmission
[11:00:05]AutonomousTesting.dll
[11:00:05]CoverageTest.TestExample.TestEquality
[11:00:05]CoverageTest.TestExample.TestException
[11:00:05]CoverageTest.TestExample.TestInequality
[11:00:05]CoverageTest.TestExample.TestOmission
[11:00:05]Test ignored: CoverageTest.TestExample.TestOmission
[11:00:07][JetBrains dotCover] Coverage session finished [2014-06-30 11:00:07]
[11:00:07][JetBrains dotCover] Coverage results post-processing started [2014-06-30 11:00:07]
[11:00:08][JetBrains dotCover] Coverage results post-processing finished [2014-06-30 11:00:08]
[11:00:09]##teamcity[importData type='dotNetCoverage' tool='dotcover' file='C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover16594618384737853441.data']
[11:00:09]Importing data from 'C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover16594618384737853441.data' (8.38 KB) with 'dotNetCoverage' processor [11:00:09]Process exited with code 0
[11:00:09]Waiting for 1 service processes to complete
[11:00:09]Processing 1 coverage report(s)
[11:00:09]Generating coverage report by dotcover for files: [C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover16594618384737853441.data]
[11:00:09]Get dotCover version
[11:00:09]Started dotCover: C:\TeamCity\buildAgent\tools\dotCover\dotCover.exe version C:\TeamCity\buildAgent\temp\buildTmp\dotCover4472367238745438467Version
[11:00:09]Output: JetBrains dotCover Console Runner v2.6.1000.602. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
[11:00:09]dotCover exited with code: 0
[11:00:09]Use DotCover 2.6.x commands set
[11:00:09]Merge dotCover reports (9s)
[11:00:19]Started dotCover: C:\TeamCity\buildAgent\tools\dotCover\dotCover.exe merge C:\TeamCity\buildAgent\temp\buildTmp\dotcover4719506578346509917.xml
[11:00:19]Output: JetBrains dotCover Console Runner v2.6.1000.602. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved. [JetBrains dotCover] Snapshot merging started [2014-06-30 11:00:18] [JetBrains dotCover] Source snapshots number: 1 [JetBrains dotCover] Snapshot merging finished [2014-06-30 11:00:19]
[11:00:19]dotCover exited with code: 0

推荐答案

我关注了这个小小的

I followed this nice little tutorial to get it working for me. Here's something it mentions you could try if you're not getting any results:

小提示:如果您做的一切正确,但是不会生成任何报告,请查看BuildLog.在第一次尝试时,我收到此错误:

Little hint: If you do everything right but no report will be generated take a look into the BuildLog. At the first try I got this error:

解决方案:

无法读取源文件>'C:\ TeamCity \ buildAgent \ temp \ buildTmp \ dotcover8583844779204955574.xml'.找不到路径'C:\ Windows \ system32 \ config \ systemprofile \ AppData \ Local \ Temp \ 4q-kqg6z.tmp'的一部分.

Failed to read source file >'C:\TeamCity\buildAgent\temp\buildTmp\dotcover8583844779204955574.xml'. Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\4q-kqg6z.tmp'.

在"C:\ Windows \ system32 \ config \ systemprofile \ AppData \ Local"中创建搜索到的"Temp"文件夹

Create the searched "Temp" folder in "C:\Windows\system32\config\systemprofile\AppData\Local"

通常它不存在,因此出现此错误.之后,它就可以工作了.

Normally it doesn´t exist and because of this the error appeared. After this it works.

如果这不起作用,那么您可能需要提供更多信息,以便我们帮助您推断出问题所在.

If that doesn't work then you'll probably need to provide more information in order for us to help you deduce what's wrong.

例如,您的路径是什么,安装的所有版本是什么,构建配置已启用的设置是什么,等等.

e.g what are your paths, what versions of everything are you installed, what settings have you got enabled for your build configurations, etc.

正如您提到的那样,您已经可以使用此功能了,我想知道您是否仍然拥有以前可用的版本的生成日志?在你的同事搞砸之前.您有什么机会可以在构建日志正常工作和不正常工作之间进行区分吗?它可能会为您提供有关他更改的线索.

As you mentioned you already had this working, I wonder if you still have the build logs of the previously working builds? Before your colleague messed it up. Is there any chance you can do a diff between the build logs when it was working and when it's not? It might give you a clue of what he changed.

我设法进行了全新配置,以测试生成覆盖范围所需的最低工作量.这正是我采取的步骤.也许这里有些东西会让您发现自己做的不一样.

I managed to make a brand new configuration, to test the minimum work required to generate coverage. Here's exactly the steps I took. Maybe there's something here that you will find you've done differently.

在TeamCity主屏幕上的本地主机:8080,单击创建项目"

From the main TeamCity screen at localhost:8080, click "Create a Project"

  • 名称:MyProjectName
  • 点击创建"

点击添加构建配置"

  • 名称:调试

点击"VCS设置"

点击创建并附加VCS根目录"

Click "Create And Attach VCS Root"

  • Type of VCS: Git
  • VCS Root Name: MyProjectName Git Repo
  • Fetch URL: https://myusername@bitbucket.org/myusername/myprojectname.git
  • Auth method: Password (enter bitbucket username and password)
  • Checking Interval: custom, 600 seconds
  • Click "Test Connection", it should go green. Click "Save"

点击添加构建步骤"

  • 运行器类型:MSBuild
  • 步骤名称:构建MyProjectName
  • 生成文件路径:MyProjectName.sln
  • MSBuild版本:Microsoft .NET Framework 4.5
  • MSBuild Tools版本:4.0
  • 运行平台:x64
  • 点击保存"

点击添加构建步骤"

  • 流道类型:NUnit
  • 步骤名称:运行MyProjectName测试
  • .NET运行时平台:x64
  • .NET运行时版本:4.0
  • 从以下位置运行测试:MyProjectName.Tests \ bin \ Debug \ MyProjectName.Tests.dll
  • .NET覆盖率工具:Jetbrains dotCover
  • 点击保存"

点击项目"

点击运行..."

毕竟,构建应该已经生成了覆盖率.祝你好运!

After all that, the build should have generated the coverage. Good luck!

这篇关于如何解决TeamCity中缺少的测试范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆