我怎样才能改变在团队市NUnit的测试工作目录?团队、测试、目录、工作

2023-09-05 02:41:24 作者:汐﹌

我使用团队市构建服务器,我有一个MSBuild的构建脚本构建和运行集成测试我的项目。但是,运行我的测试时,团队市决定忽略NUnit的任务WorkingDirectory属性,结果我的测试无法完成初始化:

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

我怎么能强迫团队市运行从我的工作目录中这些测试?我不想直接执行NUnit控制台,因为我想从内置的测试失败的报告,等等。

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.

推荐答案

我看不到的方式来改变使用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.