简体   繁体   中英

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. Now we can install either 32-Bit or 64-Bit driver on one machine. Now these TC automatically run for both 32-bit and 64-bit configuration on TFS server, which contains drivers installed for 32-bit only. So now for 64-bit build, it is failing and I am unable to checkIn the code.

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.

Just try below ways:

1.Build the x86 and x64 builds separately, run test for x86 build.

2.Create .runsettings file and specify <TargetPlatform>x86</TargetPlatform> , then use the .runsettings file for the testing.

3.Create two runsettings files, one for x86 and one for 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:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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