如何在VSTS中使用NUnit.ConsoleRunner构建Nunit测试

时间:2018-04-09 15:25:12

标签: nunit azure-devops

我正在尝试使用VSTS中的NUnit.ConsoleRunner构建Nunit测试。我提供了自定义testAdapter的路径(见截图)。但似乎没有执行任何测试。

    [2018-04-08T18:41:54.0612737Z ##\[section\]Starting: VsTest - testAssemblies
2018-04-08T18:41:54.0619175Z ==============================================================================
2018-04-08T18:41:54.0619365Z Task         : Visual Studio Test
2018-04-08T18:41:54.0619652Z Description  : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test runner. Test frameworks that have a Visual Studio test adapter such as xUnit, NUnit, Chutzpah, etc. can also be run. Tests can be distributed on multiple agents using this task (version 2).
2018-04-08T18:41:54.0619877Z Version      : 2.3.28
2018-04-08T18:41:54.0619996Z Author       : Microsoft Corporation
2018-04-08T18:41:54.0620167Z Help         : \[More Information\](https://go.microsoft.com/fwlink/?LinkId=835764)
2018-04-08T18:41:54.0620311Z ==============================================================================
2018-04-08T18:41:54.8812472Z Run the tests locally using vstest.console.exe
2018-04-08T18:41:54.8812753Z ========================================================
2018-04-08T18:41:54.8813319Z Test selector : Test assemblies
2018-04-08T18:41:54.8813511Z Test assemblies : **\*Test*.dll
2018-04-08T18:41:54.8813672Z Test filter criteria : null
2018-04-08T18:41:54.8813829Z Search folder : D:\a\1\s
2018-04-08T18:41:54.8813996Z Run settings file : D:\a\1\s
2018-04-08T18:41:54.8814208Z Run in parallel : false
2018-04-08T18:41:54.8814365Z Run in isolation : false
2018-04-08T18:41:54.8815225Z Path to custom adapters : D:\a\1\s\packages\NUnit.ConsoleRunner.3.8.0\tools
2018-04-08T18:41:54.8815399Z Other console options : null
2018-04-08T18:41:54.8815674Z Code coverage enabled : true
2018-04-08T18:41:54.8816110Z Rerun failed tests: false
2018-04-08T18:41:54.8816314Z VisualStudio version selected for test execution : 15.0
2018-04-08T18:41:55.9616722Z ========================================================
2018-04-08T18:41:56.3694859Z \[command\]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" @C:\Users\VSSADM~1\AppData\Local\Temp\83279701-3b5c-11e8-9819-d7c3479be946.txt
2018-04-08T18:42:01.0080893Z Microsoft (R) Test Execution Command Line Tool Version 15.6.0
2018-04-08T18:42:01.0085729Z Copyright (c) Microsoft Corporation.  All rights reserved.
2018-04-08T18:42:01.0085868Z 
2018-04-08T18:42:01.2058417Z vstest.console.exe 
2018-04-08T18:42:01.2058820Z "D:\a\1\s\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll"
2018-04-08T18:42:01.2059138Z "D:\a\1\s\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll"
2018-04-08T18:42:01.2059736Z "D:\a\1\s\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll"
2018-04-08T18:42:01.2060603Z "D:\a\1\s\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll"
2018-04-08T18:42:01.2061575Z "D:\a\1\s\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
2018-04-08T18:42:01.2062254Z "D:\a\1\s\UnitTestProject1\bin\Debug\NUnit3.TestAdapter.dll"
2018-04-08T18:42:01.2062955Z "D:\a\1\s\UnitTestProject1\bin\Debug\UnitTestProject1.dll"
2018-04-08T18:42:01.2063475Z "D:\a\1\s\UnitTestProject1\obj\Debug\UnitTestProject1.dll"
2018-04-08T18:42:01.2064146Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll"
2018-04-08T18:42:01.2064715Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll"
2018-04-08T18:42:01.2065487Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll"
2018-04-08T18:42:01.2066106Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
2018-04-08T18:42:01.2066819Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\cs\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2069097Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\cs\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2069646Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\cs\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2070538Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\de\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2072720Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\de\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2073885Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\de\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2074629Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\es\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2074992Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\es\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2075215Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\es\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2075446Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\fr\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2075900Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\fr\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2076316Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\fr\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2076700Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\it\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2076992Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\it\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2077185Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\it\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2077385Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ja\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2077572Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ja\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2077877Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ja\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2078228Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ko\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2078396Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ko\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2078569Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ko\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2078744Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pl\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2079025Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pl\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2079209Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pl\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2079380Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pt\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2079547Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pt\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2080177Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\pt\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2080340Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ru\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2080532Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ru\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2080696Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\ru\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2080872Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\tr\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2081056Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\tr\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2081228Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\tr\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2081409Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hans\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2081581Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hans\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2081927Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hans\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2082129Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hant\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll"
2018-04-08T18:42:01.2082299Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hant\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll"
2018-04-08T18:42:01.2082473Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\_common\zh-Hant\Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll"
2018-04-08T18:42:01.2082657Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\netcoreapp1.0\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll"
2018-04-08T18:42:01.2082820Z "D:\a\1\s\packages\MSTest.TestAdapter.1.2.0\build\uap10.0\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll"
2018-04-08T18:42:01.2082999Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll"
2018-04-08T18:42:01.2083191Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
2018-04-08T18:42:01.2083456Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll"
2018-04-08T18:42:01.2083635Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
2018-04-08T18:42:01.2083803Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\uap10.0\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll"
2018-04-08T18:42:01.2083961Z "D:\a\1\s\packages\MSTest.TestFramework.1.2.0\lib\uap10.0\Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
2018-04-08T18:42:01.2084123Z "D:\a\1\s\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3.TestAdapter.dll"
2018-04-08T18:42:01.2084262Z "D:\a\1\s\packages\NUnit3TestAdapter.3.10.0\build\netcoreapp1.0\NUnit3.TestAdapter.dll"
2018-04-08T18:42:01.2084380Z /EnableCodeCoverage
2018-04-08T18:42:01.2084494Z /logger:"trx"
2018-04-08T18:42:01.2084617Z /TestAdapterPath:"D:\a\1\s\packages\NUnit.ConsoleRunner.3.8.0\tools"
2018-04-08T18:42:05.3127054Z Starting test execution, please wait...

消息:“测试运行将使用为框架.NETFramework,Version = v4.0和平台X86构建的DLL。以下DLL与框架/平台设置不匹配。”

2018-04-08T18:42:05.8696418Z 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.
2018-04-08T18:42:05.8697240Z Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8697506Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8697806Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8698031Z Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8698378Z Microsoft.VisualStudio.TestPlatform.TestFramework.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8698717Z UnitTestProject1.dll is built for Framework 4.6.1 and Platform AnyCPU.
2018-04-08T18:42:05.8698916Z UnitTestProject1.dll is built for Framework 4.6.1 and Platform AnyCPU.
2018-04-08T18:42:05.8699148Z Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8699439Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8699690Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8699910Z Microsoft.VisualStudio.TestPlatform.TestFramework.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8700130Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll is built for Framework 1.5 and Platform AnyCPU.
2018-04-08T18:42:05.8700371Z Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll is built for Framework 5.0 and Platform AnyCPU.
2018-04-08T18:42:05.8700606Z Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8700842Z Microsoft.VisualStudio.TestPlatform.TestFramework.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8701071Z Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8701289Z Microsoft.VisualStudio.TestPlatform.TestFramework.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8701521Z Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll is built for Framework 5.0 and Platform AnyCPU.
2018-04-08T18:42:05.8701737Z Microsoft.VisualStudio.TestPlatform.TestFramework.dll is built for Framework 4.5 and Platform AnyCPU.
2018-04-08T18:42:05.8701957Z NUnit3.TestAdapter.dll is built for Framework 1.0 and Platform AnyCPU.
2018-04-08T18:42:05.8702323Z Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings.
2018-04-08T18:42:05.8702484Z 
2018-04-08T18:42:14.1988661Z M][1]

1 个答案:

答案 0 :(得分:2)

您告诉vstest-console要使用的适配器是NUnit.ConsoleRunner。但是,NUnit.ConsoleRunner 是vstest的适配器。它是一个运行测试的独立程序 - 就像vstest-console一样。

要使用vstest-console,您必须指向NUnit 3 VS测试适配器的安装,您可以在nuget.org上找到它。

相关问题