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

发布于 2024-08-02 15:54:27 字数 941 浏览 3 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们的影子 2024-08-09 15:54:27

我看不到使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文