简体   繁体   English

如何在TFS生成期间在测试运行器中明确排除程序集

[英]How to explicitly exclude assemblies in test runner during TFS Build

In my solution I have c++ and c# projects with corresponding Unit test projects mixed. 在我的解决方案中,我混合了c ++和c#项目以及相应的单元测试项目。 During a TFS build I only want to execute the C# unit tests. 在TFS构建期间,我只想执行C#单元测试。 Unfortunately I can't find a way to exclude these test assemblies to be being used in the unit test runner. 不幸的是,我找不到一种排除这些测试组件在单元测试运行器中使用的方法。 I could identify all c++ unit tests projects based on a naming patter like Native.Tests.dll. 我可以根据类似Native.Tests.dll的命名模式来识别所有c ++单元测试项目。

I can't find a way to explicitly exclude certain test assemblies from being tested/executed from the test runner. 我找不到一种方法可以从测试运行程序中明确排除某些测试程序集。

Is there a way through either 有没有办法解决

  • Test Case Filter 测试用例过滤器
  • Test assembly file specification? 测试汇编文件规范?

Environment: 环境:

  • TFS 2013 TFS 2013
  • Process template: ReleaseTfvcTemplate.12.xaml 流程模板:ReleaseTfvcTemplate.12.xaml

In case you are wondering: Why do I want to exclude certain assemblies? 如果您想知道:为什么要排除某些程序集?

I want to use the Test Category feature to exclude certain unit tests from being executed on the build server, which you do through the TestCaseFilter feature in the TFS template. 我想使用“测试类别”功能从构建服务器上排除某些单元测试,这是通过TFS模板中的TestCaseFilter功能来完成的。 You specify that per "Test batch". 您可以按“测试批次”指定该值。 When I run all my unit tests (c# + c++) in one test settings the native unit tests throw an error, because they don't understand/support the TestCategory-filter feature (remember: Test Case Filter). 当我在一个测试设置中运行所有单元测试(c#+ c ++)时,本机单元测试会引发错误,因为它们不了解/不支持TestCategory-filter功能(请记住:测试用例过滤器)。 Therefore I want to split the it in 2 test runs/batches: c++ and c#. 因此,我想将其拆分为2个测试运行/批次:c ++和c#。

Test Category is only worked in C# test project. 测试类别仅在C#测试项目中有效。 (Test in my environment: TFS2015 VS2015) (在我的环境中测试:TFS2015 VS2015)

If you only want to execute the C# unit test. 如果只想执行C#单元测试。 The simplest way you can specify the C# test assembly file in Test assembly file specification. 在测试程序集文件规范中指定C#测试程序集文件的最简单方法。 You just need to identify all C# unit tests projects based on a naming patter totally different as C++ tests projects. 您只需要根据与C ++测试项目完全不同的命名方式来识别所有C#单元测试项目。

Note: You must make sure you are using totally different naming rules between C++ an C# test project. 注意:您必须确保在C ++和C#测试项目之间使用完全不同的命名规则。

For example: 例如:

C++test project name : including  ABC  like ABC1 ,ABC2, ABC3

C# test project name: including  XYZ  like XYZ1, XYZ2 ,XYZ3

Then using ***XYZ*.dll in Test assembly file specification to run the all C# test project. 然后在测试程序集文件规范中使用*** XYZ * .dll运行所有C#测试项目。

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

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