开发者

Jenkins MSTest Issue

开发者 https://www.devze.com 2023-03-11 22:35 出处:网络
I have configured Jenkins as the CI for a project which is using Mercurial as the source control management. I\'m using MSTest plugin in Jenkins to see the test results and I have written a bat comman

I have configured Jenkins as the CI for a project which is using Mercurial as the source control management. I'm using MSTest plugin in Jenkins to see the test results and I have written a bat command to generate test result file

del results.trx
mstest /testcontainer:Example\TestProject1\bin\debug\TestProject2.dll /resultsfile:results.trx

it gives an error in console saying File "Example\TestProject1\bin\debug\TestProject2.dll" not found"

when every build happens a folder is created under %WORKSPACE% having a new name (SYSTEM_My_Computer_Name 2011-06-08 13_04_11). In that the test dll is in a directory called out. How can I get path to that dll, because the directory name is changed for every build?

It is working fine when I used a absolute url like "c:\Example\TestProject1\bin\debug\TestProject2.dll"

How can we refer the 开发者_如何转开发newly built dll ? Do I need to add test dll file in to the repository ?


Jenkins run bat files with %WORKSPACE% as the current directory.

As the error message indicates, the relative path to the test container is wrong. I can think of two things that can be the issue here:

  • The folder structure under %WORKSPACE% does not match your relative path. Adding a cd by its own in the bat file will reveal on the build output where this is. You can also use the links in the Jenkins web ui to browse the workspace.

  • You are building a different msbuild target in Jenkins, for example release. Then \bin\debug might not exist.


The folder "SYSTEM_My_Computer_Name 2011-06-08 13_04_11" is not created by Jenkins during the build, but it is created by the mstest when it is running the test. The root folder when the mstest is invoked is the workspace root folder, so the testcontainer file should be specify from the workspace root.

For example, say if the dll file is under C:\jenkins\jobs\\workspace\TestProject1\bin\debug\TestProject2.dll(assume your jenkins is installed under c:\jenkins).

The command should be (relative to the workspace root folder):

mstest /testcontainer:TestProject1\bin\debug\TestProject2.dll /resultsfile:results.trx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号