[英]How to run TestCases for 32-Bit build only on TFS server
I have written some Testcases in C# using Microsoft unit test framework and some of the TC needs some drivers to create new Database files. 我已经使用Microsoft单元测试框架在C#中编写了一些测试用例,并且某些TC需要一些驱动程序来创建新的数据库文件。 Now we can install either 32-Bit or 64-Bit driver on one machine. 现在,我们可以在一台计算机上安装32位或64位驱动程序。 Now these TC automatically run for both 32-bit and 64-bit configuration on TFS server, which contains drivers installed for 32-bit only. 现在,这些TC在TFS服务器上自动针对32位和64位配置运行,其中包含仅针对32位安装的驱动程序。 So now for 64-bit build, it is failing and I am unable to checkIn the code. 所以现在对于64位版本,它失败了,我无法检入代码。
Is there any attribute (like TestClass, TestInitialize) or any configuration in the .proj file which we can do so that those TC will run only for 32-build and not for 64-bit. .proj文件中是否可以执行任何属性(如TestClass,TestInitialize)或任何配置,以便这些TC仅在32-build而不是64-bit上运行。
Just try below ways: 只需尝试以下方法:
1.Build the x86 and x64 builds separately, run test for x86 build. 1.分别构建x86和x64构建,对x86构建运行测试。
2.Create .runsettings
file and specify <TargetPlatform>x86</TargetPlatform>
, then use the .runsettings
file for the testing. 2.创建.runsettings
文件并指定<TargetPlatform>x86</TargetPlatform>
,然后使用.runsettings
文件进行测试。
3.Create two runsettings
files, one for x86 and one for x64. 3.创建两个runsettings
文件,一个用于x86,一个用于x64。 Specify the platform there: 在此处指定平台:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<!-- [x86] | x64
- You can also change it from menu Test, Test Settings, Default Processor Architecture -->
<TargetPlatform>x86</TargetPlatform>
<!-- Framework35 | [Framework40] | Framework45 -->
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
</RunConfiguration>
</RunSettings>
Reference below articles: 参考以下文章:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.