如何更改 Team City 中 NUnit 测试的工作目录?
我使用 Team City 作为构建服务器,并且有一个 msbuild 构建脚本来为我的项目构建和运行集成测试。但是,Team City 在运行我的测试时决定忽略 NUnit 任务上的工作目录属性,因此我的测试无法初始化:
[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,因为我想从测试失败的内置报告等中受益。
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. 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:
[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? I don't want to execute nunit-console directly, because I want to benefit from the built-in reporting on test failures, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看不到使用 MSBuild 任务更改 TeamCity 工作目录的方法,但您可以采取中间路线并使用 TeamCity 自己的控制台运行程序,您可以从正确的工作目录中启动它。另一种选择是运行标准 NUnit 控制台,使用 TeamCity 的 NUnit 插件已加载。
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. Another option is to run the standard NUnit console, with TeamCity's NUnit Addin loaded.