在测试运行日志中,我有Run UnitTests
步骤,该步骤使用Visual Studio Test
。但是我看到日志消息:
No test is available in C:\stuff\Debug\x64\bin\x86\ilc\MyApp.Test.dll some_other_dlls Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
测试在Visual Studio中可见,并且我可以运行所有这些(我有50多个测试)。 我安装了xunit.runner.visualstudio软件包。我所缺少的是,为什么Azure会忽略我的测试?
**************** Starting test execution *********************
\vstest.console.exe "@C:\path\fadisfjla.tmp"
Microsoft (R) Test Execution Command Line Tool Version 16.4.0
Copyright (c) Microsoft Corporation. All rights reserved.
vstest.console.exe "C:\dir\Release\x64\bin\arm\MyApp.Test\testhost.dll"
"C:\dir\Release\x64\bin\arm\MyApp.Test\xunit.runner.visualstudio.uwp.testadapter.dll"
"C:\dir\Release\x64\bin\arm\ilc\MyApp.Test.dll"
"C:\dir\Release\x64\bin\x86\MyApp.Test\testhost.dll"
"C:\dir\Release\x64\bin\x86\MyApp.Test\xunit.runner.visualstudio.uwp.testadapter.dll"
"C:\dir\Release\x64\bin\x86\ilc\MyApp.Test.dll"
/Settings:"C:\tmp\fadslfj.tmp.runsettings"
/EnableCodeCoverage
/Logger:"trx"
/TestAdapterPath:"C:\dir\Release\x64"
Starting test execution, please wait...
Test run will use DLL(s) built for framework .NETFramework,Version=v4.0 and platform X86. Following DLL(s) do not match framework/platform settings.
testhost.dll is built for Framework .NETStandard,Version=v1.4 and Platform AnyCPU.
xunit.runner.visualstudio.uwp.testadapter.dll is built for Framework .NETCore,Version=v5.0 and Platform AnyCPU.
MyApp.Test.dll is built for Framework .NETFramework,Version=v4.0 and Platform ARM.
testhost.dll is built for Framework .NETStandard,Version=v1.4 and Platform AnyCPU.
xunit.runner.visualstudio.uwp.testadapter.dll is built for Framework .NETCore,Version=v5.0 and Platform AnyCPU.
Go to more details on managing these settings.
Microsoft (R) Coverage Collection Tool Version 16.0.30319.200
Copyright (c) Microsoft Corporation. All rights reserved.
1.5873
A total of 6 test files matched the specified pattern.
No test is available in C:\dir\Release\x64\bin\arm\MyApp.Test\testhost.dll C:\dir\Release\x64\bin\arm\MyApp.Test\xunit.runner.visualstudio.uwp.testadapter.dll C:\dir\Release\x64\bin\arm\ilc\MyApp.Test.dll C:\dir\Release\x64\bin\x86\MyApp.Test\testhost.dll C:\dir\Release\x64\bin\x86\MyApp.Test\xunit.runner.visualstudio.uwp.testadapter.dll C:\dir\Release\x64\bin\x86\ilc\MyApp.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Microsoft (R) Coverage Collection Tool Version 16.0.30319.200
Copyright (c) Microsoft Corporation. All rights reserved.
Results File: C:\path\fdsfdsfd.trx
Attachments:
C:\path\file-dfsfdsfe.coverage
Vstest.console.exe exited with code 0.
在我的项目文件中
<PackageReference Include="xunit.runner.visualstudio">
<Version>2.4.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
答案 0 :(得分:0)
首先,请确保您已添加xunit.runner.visualstudio
软件包。然后确保您已经在Test selection/Test files
任务的Visual Studio Test
下指向了生成的测试程序集,例如:
**\bin\$(BuildConfiguration)\**\*test*.dll
!**\obj\**
!**\xunit.runner.visualstudio.testadapter.dll
!**\xunit.runner.visualstudio.dotnetcore.testadapter.dll
检查以下链接:
答案 1 :(得分:0)
事实证明,如果您拥有适用于Windows版本1803
的UWP项目,并从该版本的测试项目中删除了该项目,它将忽略测试项目中的所有测试。我认为这是在xunit或Windows SDK中的问题。如果仅将测试项目更新为1903
,那么它将正常工作。