2011-07-05 35 views
2

我们当前的项目涉及构建由.Net应用程序控制的自动化盒子。我们连接了很多硬件库,并且我们建立了一个集成服务器,并连接所有硬件以运行每晚的回归测试。所有测试都通过,但TFS将构建标记为部分成功

不幸的是,并非我们设置中的所有硬件库都与TFS和MSTest很好地集成在一起。

当我们具有一定librairy运行我们的构建和测试中,我们要么这两个行为之一:

  • 在 TFS通过,但构建如图 部分成功的所有测试都martked。
  • TFS显示没有测试运行,但日志显示所有测试通过,构建标记为部分succeeede。在日志

来看,我们可以看到这两条线的测试后发布到TFS服务器, “处理MSTest的异常” “MSTest.exe返回0的退出代码表明,并非所有的测试通过“

真正令我困惑的是,使用mstest从命令行运行相同的测试不会显示此问题。 Futhermore,在命令行中运行时,MSTEST 返回0时通过了所有测试和1时出现错误

所以我的问题是:

  1. 什么是成功适当MSTest的返回码/失败
  2. 除了登录visual studio之外,还有其他详细的登录功能吗?
  3. 任何线索在哪里看?

附加信息:在mstest中使用(或不)“NoIsolation”标志时,我们确实注意到了差异。使用该标志时特定的测试会通过,但其他测试将失败......我们仍在调查那一个。

由于

编辑:日志的相关部分: 30/30测试(多个)传递

Summary 
------- 
Test Run Completed. 
Passed 30 
---------- 
Total 30 
Results file: C:\Builds\1\Galil Daily build\TestResults\D201364-W7$_D201364-W7 2011-07-05 10_23_33_Any CPU_Debug.trx 
Test Settings: Default Test Settings 
Waiting to publish... 
Publishing results of test run [email protected] 2011-07-05 10:23:33_Any CPU_Debug to http://mtlapp07:8080/tfs/DI_DEV... 
..Publish completed successfully. 
Final Property Values 
Category = Galil 
CommandLineArguments = /noisolation 
Flavor = 
MaxPriority = -1 
MinPriority = -1 
PathToResultsFilesRoot = C:\Builds\1\Galil Daily build\TestResults 
Platform = 
Publish = True 
SearchPathRoot = C:\Builds\1\Galil Daily build\Binaries 
TestConfigId = -1 
TestConfigName = 
TestContainers = System.Linq.OrderedEnumerable`2[System.String,System.String] 
TestLists = 
TestMetadata = 
TestNames = 
TestSettings = 
ToolPath = 
Version = -1 
Final Property Values 
Condition = False 
Final Property Values 
Condition = True 

00:00 
Handle MSTest Exception 
MSTest.exe returned an exit code of 0 indicating that not all tests passed. 

00:00 
If testException is NOT TestFailureException 
Initial Property Values 
Condition = False 
Final Property Values 
Condition = False 

编辑2.0:

using System; 
using Microsoft.VisualStudio.TestTools.UnitTesting; 
using Galil; 

namespace TestProject1 
{ 
[TestClass] 
public class UnitTest1 
    { 
    [TestMethod] 
    public void TestMethod1() 
    { 
     Galil.Galil m_galil = new Galil.Galil(); 
     m_galil.address = "COM4 19200"; 
     string resp = m_galil.command("MTA=2.5;"); 
     Assert.AreEqual(":", resp); 
     try 
     { 
      m_galil.address = "OFFLINE"; 
     } 
     catch (Exception) 
     { 
     } 
    } 

    [TestMethod] 
    public void TestMethod2() 
    { 
     Galil.Galil m_galil = new Galil.Galil(); 
     m_galil.address = "COM4 19200"; 
     string resp = m_galil.command("MTA=2.0;"); 
     Assert.AreEqual(":", resp); 
     try 
     { 
      m_galil.address = "OFFLINE"; 
     } 
     catch (Exception) 
     { 
     } 
    } 
    } 
} 
+0

你可以发布你的日志吗? –

回答

2

什么是适当的MSTest成功/失败返回码

退出代码1 =不通过了所有测试

实施例:

C:\程序 文件\的MSBuild \微软\ VisualStudio的\ TeamBuild \ Microsoft.TeamFoundation.Build.targets(1377,5,1377 ,5): 警告:MSTest。EXE返回 退出代码1表示并非所有 测试通过。

通过了所有测试

例子:

等待发布...发布 结果试运行的 Company_TFSBuild_SVC @ BUILD-DEV 2011-07-01 13:15:46_Any CPU_Release到 http://company-source:8080/ ...
..发布成功完成。

除了登录visual studio之外,还有其他详细的登录功能吗?

您可以通过获得更详细的日志:

菜单栏 - >工具 - >选项 - > 项目和解决方案 - > MSBuild的 项目生成输出的详细程度

任何线索在哪里看?

需要查看您的日志文件。

+0

已添加日志的相关部分 –

+0

MsBuild是否也用于在VS2010上运行测试?它似乎使用了一个不像MSBuild构建脚本的xml构建定义文件。 –

+0

创建一个包装来调用MSBuild中的MSTest.exe。 MSTest.exe运行测试。 –

2

实际上,我们能够将问题隔离到将字符串输出到标准错误流中的库。不知何故,如果TFS看到标准错误,它会将测试标记为部分完成。

+0

我有这个问题。由于某种原因传递了无效的命令行参数,MSBuild不喜欢这种情况并记录下来,步骤被标记为部分成功。 – Edgar

+0

我的意思是MSTest ... – Edgar

相关问题