VSTS Build 无法运行 NUnit 测试 [英] VSTS Build fails running NUnit tests

查看:23
本文介绍了VSTS Build 无法运行 NUnit 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 Visual Studio 团队服务构建 Visual Studio 解决方案时,它运行单元测试,使用 nunit 3 NUnit3TestAdapter 在 nunit 3 中编写,它开始运行测试.

它给出的错误是:错误:路径中存在非法字符.

完整输出如下

2016-02-11T17:02:40.8514411Z 执行powershell脚本:C:BuildAgent	asksVSTest1.0.29VSTest.ps12016-02-11T17:02:41.1483135Z ##[debug]为所有测试程序集调用 Invoke-VSTest2016-02-11T17:02:41.2108131Z 工作文件夹:C:BuildAgent\_work52016-02-11T17:02:41.2108131Z 执行 C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDECommonExtensionsMicrosoftTestWindowvstest.console.exe "C:BuildAgent\_work5sxxxxxxxxxxTestsinReleasexxxxxxxxxxTests.dll"/logger:trx/TestAdapterPath:"C:BuildAgent\_work5s"2016-02-11T17:02:41.5240692Z Microsoft (R) 测试执行命令行工具版本 14.0.24720.02016-02-11T17:02:41.5240692Z 版权所有 (c) Microsoft Corporation.版权所有.2016-02-11T17:02:42.1326930Z 开始测试执行,请稍候...2016-02-11T17:02:46.4921857Z 信息:NUnit Adapter 3.0.8.0 执行测试已启动2016-02-11T17:02:46.5077303Z 信息:在 C:BuildAgent\_work5sxxxxxxxxxxTestsinReleasexxxxxxxxxxTests.dll 中运行所有测试2016-02-11T17:02:46.6327336Z 信息:NUnit Adapter 3.0.8.0 执行测试完成2016-02-11T17:02:46.6327336Z ##[错误]错误:异常 System.ArgumentException,执行测试时抛出异常2016-02-11T17:02:46.6327336Z ##[错误]2016-02-11T17:02:46.6327336Z ##[错误]错误:路径中存在非法字符.2016-02-11T17:02:46.6327336Z ##[错误]2016-02-11T17:02:46.7108474Z 信息:此外,如果测试发现者 &executor 作为 vsix 扩展安装在机器上,并且您的安装支持 vsix 扩展.示例:vstest.console.exe myTests.dll/UseVsixExtensions:true2016-02-11T17:02:46.8358887Z ##[error]VSTest 测试运行失败,退出代码:12016-02-11T17:02:46.8514965Z ##[警告]未找到可发布的结果.

我们有一个内部构建代理,但我认为这不会有什么不同.

感谢您提供的任何建议.

解决方案

我在使用

When building a visual studio solution using visual studio team services it runs the unit tests, written in nunit 3 using the nunit 3 NUnit3TestAdapter it starts running the tests.

The error it gives is: Error: Illegal characters in path.

The complete output as follows

2016-02-11T17:02:40.8514411Z Executing the powershell script: C:BuildAgent	asksVSTest1.0.29VSTest.ps1
2016-02-11T17:02:41.1483135Z ##[debug]Calling Invoke-VSTest for all test assemblies
2016-02-11T17:02:41.2108131Z Working folder: C:BuildAgent\_work5
2016-02-11T17:02:41.2108131Z Executing C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDECommonExtensionsMicrosoftTestWindowvstest.console.exe "C:BuildAgent\_work5sxxxxxxxxxxTestsinReleasexxxxxxxxxxTests.dll"  /logger:trx /TestAdapterPath:"C:BuildAgent\_work5s"
2016-02-11T17:02:41.5240692Z Microsoft (R) Test Execution Command Line Tool Version 14.0.24720.0
2016-02-11T17:02:41.5240692Z Copyright (c) Microsoft Corporation.  All rights reserved.
2016-02-11T17:02:42.1326930Z Starting test execution, please wait...
2016-02-11T17:02:46.4921857Z Information: NUnit Adapter 3.0.8.0 executing tests is started
2016-02-11T17:02:46.5077303Z Information: Running all tests in C:BuildAgent\_work5sxxxxxxxxxxTestsinReleasexxxxxxxxxxTests.dll
2016-02-11T17:02:46.6327336Z Information: NUnit Adapter 3.0.8.0 executing tests is finished
2016-02-11T17:02:46.6327336Z ##[error]Error: Exception System.ArgumentException, Exception thrown executing tests
2016-02-11T17:02:46.6327336Z ##[error]
2016-02-11T17:02:46.6327336Z ##[error]Error: Illegal characters in path.
2016-02-11T17:02:46.6327336Z ##[error]
2016-02-11T17:02:46.7108474Z Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
2016-02-11T17:02:46.8358887Z ##[error]VSTest Test Run failed with exit code: 1
2016-02-11T17:02:46.8514965Z ##[warning]No results found to publish.

We have an on premise build agent but I don't think this should make an difference.

Any advice you can give it appreciated.

解决方案

I met this issue when I use NUnit3 Test Adapter Nuget Package during the build. And I resolved it by installing NUnit3 Test Adapter and upload all the installed files to Version Control and use it as the Test Adapter.

Since you are using on premise build agent. You can easily install the NUnit3 Test Adapter on the build agent and use "/UseVsixExtensions:true" argument as the error message indicates.

这篇关于VSTS Build 无法运行 NUnit 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆