简体   繁体   English

如何在Team City中更改NUnit测试的工作目录?

[英]How can I change the working directory for NUnit tests in Team City?

I am using Team City as the build server, and I have a msbuild build script to build and run integration tests for my project. 我使用Team City作为构建服务器,我有一个msbuild构建脚本来构建和运行我的项目的集成测试。 However, Team City when running my tests decides to ignore the WorkingDirectory attribute on the NUnit task, and as a result my tests fail to initialize: 但是,Team City在运行我的测试时决定忽略NUnit任务上的WorkingDirectory属性,因此我的测试无法初始化:

[17:46:54]: [Project "MyProject.msbuild.xml.teamcity.patch.tcprojx" (ficc-build target(s)):] C:\dev\BuildAgent\work\30decc96a6997d21\MyProject\MyProject.msbuild.xml Value from NUnit task attribute OutputXmlFile has been ignored because TeamCity NUnit task is used
[17:46:54]: [Project "MyProject.msbuild.xml.teamcity.patch.tcprojx" (ficc-build target(s)):] C:\dev\BuildAgent\work\30decc96a6997d21\MyProject\MyProject.msbuild.xml Value from NUnit task attribute WorkingDirectory has been ignored because TeamCity NUnit task is used
[17:46:54]: [Project "MyProject.msbuild.xml.teamcity.patch.tcprojx" (ficc-build target(s)):] Value from NUnit task attribute ToolPath has been ignored because TeamCity NUnit task is used

How can I force Team City to run these tests from my working directory? 如何强制Team City从我的工作目录中运行这些测试? I don't want to execute nunit-console directly, because I want to benefit from the built-in reporting on test failures, etc. 我不想直接执行nunit-console,因为我想从内置的测试失败报告等中受益。

I can't see a way to change TeamCity's working directory using the MSBuild task, but you could take the middle road and use TeamCity's own console runner , which you could start from within the proper working directory. 我看不到使用MSBuild任务更改TeamCity工作目录的方法,但您可以采取中途并使用TeamCity自己的控制台运行程序 ,您可以从正确的工作目录中开始。 Another option is to run the standard NUnit console, with TeamCity's NUnit Addin loaded. 另一个选择是运行标准NUnit控制台,加载TeamCity的NUnit Addin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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