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

时间:2009-08-27 17:01:29

标签: c# .net msbuild nunit teamcity

我使用Team City作为构建服务器,我有一个msbuild构建脚本来构建和运行我的项目的集成测试。但是,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

如何强制Team City从我的工作目录中运行这些测试?我不想直接执行nunit-console,因为我想从内置的测试失败报告等中受益。

1 个答案:

答案 0 :(得分:1)

我看不到使用MSBuild任务更改TeamCity工作目录的方法,但您可以采取中途并使用TeamCity's own console runner,您可以从正确的工作目录中开始。另一种选择是运行标准的NUnit控制台,并加载TeamCity's NUnit Addin