Jenkins MSTest 问题
我已将 Jenkins 配置为使用 Mercurial 作为源代码控制管理的项目的 CI。我在 Jenkins 中使用 MSTest 插件来查看测试结果,并且我编写了一个 bat 命令来生成测试结果文件,
del results.trx
mstest /testcontainer:Example\TestProject1\bin\debug\TestProject2.dll /resultsfile:results.trx
它在控制台中给出错误,提示文件“Example\TestProject1\bin\debug\TestProject2.dll”未找到
”每次构建都会在 %WORKSPACE% 下创建一个具有新名称的文件夹(SYSTEM_My_Computer_Name 2011-06-08 13_04_11),其中测试 dll 位于名为的目录中,因为目录名称。每次构建都会更改吗?
当我使用像“c:\Example\TestProject1\bin\debug\TestProject2.dll”这样的绝对url时,它工作正常,
我们如何引用新构建的dll? 我需要将测试 dll 文件添加到存储库中吗?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jenkins 以
%WORKSPACE%
作为当前目录运行 bat 文件。正如错误消息所示,测试容器的相对路径错误。我可以想到这里可能出现的两件事:
%WORKSPACE%
下的文件夹结构与您的相对路径不匹配。在bat 文件中单独添加一个cd
将在构建输出中显示它的位置。您还可以使用 Jenkins Web UI 中的链接浏览工作区。您正在 Jenkins 中构建不同的 msbuild 目标,例如 release。那么\bin\debug可能不存在。
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 acd
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.
文件夹“SYSTEM_My_Computer_Name 2011-06-08 13_04_11”不是由 Jenkins 在构建期间创建的,而是由 mstest 在运行测试时创建的。调用 mstest 时的根文件夹是工作空间根文件夹,因此应从工作空间根目录指定 testcontainer 文件。
例如,假设 dll 文件位于 C:\jenkins\jobs\\workspace\TestProject1\bin\debug\TestProject2.dll 下(假设您的 jenkins 安装在 c:\jenkins 下)。
该命令应为(相对于工作区根文件夹):
mstest /testcontainer:TestProject1\bin\debug\TestProject2.dll /resultsfile:results.trx
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