copying to teamcity's out directory before running unit tests

微笑、不失礼 提交于 2019-12-01 21:01:41

问题


So my situation is that I finally finished configuring TeamCity for CI. I got it to run my unit tests with some friendly help on SO.

However, many unit tests fail because there needs to be a config file alongside the unittests.dll once it's built and ready to run.

I've written a simple Command Line step with:

copy %system.teamcity.build.checkoutDir%\xx.configfile <destination>

The destination is the problem, I need it to be the Out directory teamcity creates.

TC creates SYSTEM_<machinename> <datetime>\OUT. An example:

C:\TeamCity\buildAgent\temp\buildTmp\SYSTEM_GIDEON 2015-07-02 16_51_09\Out

In there is my unittests.dll and I want to copy my config file there. What environment var or (anything else) can I use in the command line script?

The (1) Build Tests is a Step then I want to run the (2) Copy Config Step Then (3) Run Tests. After step (1) I have that xxx\xxx\Out directory and I need that directory from some variable.

I'm using Teamcity 9.0.2


回答1:


Your problem is not to do with TeamCity I don't think, it's to do with the way that MSTest works. You need your .config file to be a DeploymentItem and have your tests deploy it to the directory that MSTest will run the tests in.

To be honest I'm surprised that you don't have this problem running locally, and it makes me think that you must be using some other test runner (like ReSharper) to run the tests if you have not seen this problem on your local machines.



来源:https://stackoverflow.com/questions/31183858/copying-to-teamcitys-out-directory-before-running-unit-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!