VS2017创建的单元测试不支持顺序测试

 

问题:使用IDE创建的单元测试项目,标准引用是,导致不能添加顺序测试,复制其它项目的顺序测试文件进行编辑时,也会提示基于MSTest V2的测试不能用于顺序测试

 

 

解决办法:

移除自带的NUGET引用,保存项目文件,然后用记事本打开项目文件,添加配置

 

@@@code

<Choose>

<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">

<ItemGroup>

<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

</ItemGroup>

</When>

<Otherwise>

<ItemGroup>

<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />

</ItemGroup>

</Otherwise>

</Choose>

<Choose>

<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">

<ItemGroup>

<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

<Private>False</Private>

</Reference>

<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

<Private>False</Private>

</Reference>

<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

<Private>False</Private>

</Reference>

<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

<Private>False</Private>

</Reference>

</ItemGroup>

</When>

</Choose>

 

 

@@#

 

问题解决,添加新项,就可以添加顺序测试了

 

posted @ 2019-07-19 10:02  秦秋随  阅读(261)  评论(0编辑  收藏  举报