Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run MS tests from the build folder on TeamCity server

I'm trying to run MS tests from the build folder on the TeamCity.

Main reason is that our application uses several configuration files (csv files with 'Copy to Output Directory' option set), that are loaded from its run folder. Those are not test files, but required application files, so using MSTest deploy attribute is not an option.

Locally, R# and VS2013 run tests correctly, on the TeamCity (8.1) I get an error - csv files are missing.

I tried using .runsettings file ("Build Step configuration/MSTest run configuration file") to specify <DeploymentEnabled>False</DeploymentEnabled> however MSTest (12.0.21005.1) returns this error:

"The file 'C:\TeamCity\buildAgent\work\d6160ab253397620\tests.runsettings' has unknown format and cannot be converted to the current version."

The file is dead simple (copied from msdn):

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- MSTest adapter -->
  <MSTest>
    <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>False</DeploymentEnabled>
  </MSTest>
</RunSettings>

I'm banging my head over this for the last 2 hours and I can't believe, that something so simple is so hard to accomplish using MSTest.

[Edit]

It seems that the file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings
  id="b8968a45-0b6a-40a9-bcf7-7573da114965"
  name="MSTest"
  enableDefaultDataCollectors="false"
  xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description><!--_locID_text="Description1"-->These are default test settings for a local test run.</Description>
  <Deployment enabled="false" />
</TestSettings>

...but it still doesn't work: tests are run in a custom folder and csv files are not copied.

like image 970
Pawel Lesnikowski Avatar asked Nov 11 '22 03:11

Pawel Lesnikowski


1 Answers

Pawel, just stumbled on your question and:

  1. Tried yours updated version of .runsettings - it is working OK
  2. If TC does not see CSV files maybe add following key to msbuild script - after compile:

<Copy SourceFiles="$(MSBuildProjectDirectory)\bin\FROM\.config"  DestinationFolder="$(MSBuildProjectDirectory)\BuildOutput\TO\.config"></Copy>
like image 58
Rurouni Kenshin Avatar answered Dec 04 '22 04:12

Rurouni Kenshin