How can I get unit tests to run as part of a TFS2008 build?

我与影子孤独终老i 提交于 2019-12-22 12:18:25

问题


I'm trying to get my continuous integration setup to run my unit tests for me, so I've set

<RunTest>true</RunTest>

And I've setup the tests to auto-discover:

<ItemGroup>
  <TestContainer Include="$(OutDir)%2a.Test.dll" />
</ItemGroup>

Running the build on my development machine runs my unit tests, and reports that the Build succeeded; When run as an automated build, the tests run (according to the BuildLog), but I'm seeing this in the log:

Publishing results of test run tfs_service@TFS-BUILD 2012-04-13 14:13:59_Any CPU_Release to http://mycompany-tfs:8080/Build/v1.0/PublishTestResultsBuildService2.asmx...

.The drop share directory "\tfs-build\Builds\Test\MyProduct Test_20120413.2" could not be accessed.

The drop share directory "\tfs-build\Builds\Test\MyProduct Test_20120413.2" could not be accessed.

MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.

The previous error was converted to a warning because the task was called with ContinueOnError=true.

This is odd, as the binaries publish quite merrily.

I tried to diagnose the issue, by logging on to the console of the build server, running up a Visual Studio 2008 Command Prompt, navigating to the source location, and invoking MSBuild, it doesn't appear to even attempt to invoke the unit tests?

Ultimately, I'm more interested in playing "guess why the drop of the results failed" - could it be the embedded space in my build definition name? What else could I check, given the binaries publish OK?


回答1:


The unit tests are running, the problem is that the results are not being published correctly. When unit tests are run, the results are published to the tfs server and then copied to the drop location. Because of this, the drop share needs to allow the TFS build service account to write to this folder.

http://blogs.msdn.com/b/vstsqualitytools/archive/2010/10/24/test-agent-test-controller-and-mstest-faq.aspx



来源:https://stackoverflow.com/questions/10142647/how-can-i-get-unit-tests-to-run-as-part-of-a-tfs2008-build

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