1
votes

I'm having a little problem with Running Test on VS TFS 2008 Continuous Build. The problem is that MSTest.exe search config file under "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\" path, so the error is:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MyConfig.config could not be found.

There is a way to specify to MSTest.exe where found config files?

How I can specify that in the TFSBuild.proj?

My TFSBuild.proj file contains these settings:

<PropertyGroup>
  <RunTest>true</RunTest>
</PropertyGroup>

and

<ItemGroup>
  <MetaDataFile Include="$(BuildProjectFolderPath)/../../MyProj.Complete.vsmdi">
   <TestList>Continuous  Integration Test</TestList>
   <RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
  </MetaDataFile>
</ItemGroup>

Thanks a lot!

1

1 Answers

0
votes

Use DeploymentItemAttribute in your Unit Tests code. So you can control what files and where are deployed during a test run. For example:

[DeploymentItemAttibute("MyConfig.config", "MyConfig.config")]
[TestMethod]
(...)

This will copy MyConfig.config file to the current directory before a test run. Hope that helps,