TeamCity 构建不运行新的 XUnit 测试
我将 TeamCity 5 与 Git VCS 和 Visual Studio 2010 SLN 构建运行程序结合使用。
我的解决方案有一个类库项目,其中包含许多 XUnit 1.5 测试。该项目上的构建后事件运行测试
$(SolutionDir)libs\XUnit-1.5\xunit.console.exe $(SolutionDir)MyTestProj\$(OutDir)\MyTestProj.dll
这对于在我的开发人员上运行所有测试效果很好机,并且在 TeamCity 构建代理上运行良好。
不过,我最近向该项目添加了一个新的 XUnit 测试功能,并将其提交到 github,TeamCity 选取了该功能并运行了构建。但新的测试并未包含在运行中。
看起来源代码被签出到我的 git 存储库 (c:\my_source) 的不同目录(例如 c:\checkedoutsource),并且当 SLN 构建运行程序构建我的解决方案时,构建后事件“运行测试”的目标是c:\checkedoutsource\bin\debug\MyTestProj.dll 而不是 c:\my_source\bin\debug\MyTestProj.dll
任何人对如何让 TeamCity 构建我的测试项目并针对新项目运行构建后事件有任何建议创建测试程序集? (无需编写大量的 MSBuild 脚本文件)。
即是否可以在构建运行程序中设置 Visual Studio 变量,例如 $(SolutionDir)?
希望这是有道理的,谢谢
I'm using TeamCity 5 with Git VCS and Visual Studio 2010 SLN build runner.
My solution has a class library proj containing a number of XUnit 1.5 tests. The post build event on this project runs the tests
$(SolutionDir)libs\XUnit-1.5\xunit.console.exe $(SolutionDir)MyTestProj\$(OutDir)\MyTestProj.dll
This works fine for running all my tests on my dev machine, and runs fine on the TeamCity build agent.
However, I recently added a new XUnit test function to this project, committed it to github, which was picked up by TeamCity and a build was run. But the new test was not included in the run.
It appears that the source is checked out to a different directory (e.g. c:\checkedoutsource) to my git repository (c:\my_source), and when the SLN build runner builds my solution, the post build event 'run tests' is targeting the c:\checkedoutsource\bin\debug\MyTestProj.dll and not c:\my_source\bin\debug\MyTestProj.dll
Anyone have any suggestions of how to get TeamCity to build my test project and run the post build event against the newly created test assembly?? (without writing mahoosive MSBuild script files).
i.e. is it possible to set visual studio variables such as $(SolutionDir) in the build runner?
Hope that made sense, thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我们的项目中,我们从 *.msbuild 文件中的单独目标运行测试:
并且我们将 TeamCity 配置为执行两个目标:Build、RunTests。
需要注意的是,我们的项目在构建后事件中将它们自身复制到“众所周知”目录,但该目录是相对的。
希望这有帮助。
In our project we run tests from separate target in *.msbuild file:
And we configure TeamCity to execute two targets: Build, RunTests.
The caveat is that our projects are copying them selves in after-build event to "well-known" directory, but that directory is relative.
Hope this helps.