1

i'm currently working on a task in a project. We have many Test-Projects in the solution reprository, which are using the DeploymentItem() attribute(all of the Tests are working).

My Problem:

I created a new Directory in the root of the reprository and in the Directory is a new Test-Project. The new tests are not deploying items or something else and using a wrong output path.(All tests not working because no items are deploying)

All old Test-Projects are using "TestResults" Directory. After every build/run of a test a new sub directory ist created named like "Deploy_xxx_Date". My Test-Project is using as output path the default directory bin/Debug. How can i change it that my Project is also using the default TestResults Directory automaticly? And which is the best way to Deploy items?

Hint:

output of old Tests: C:..\RootOfProject\SolutionDir\TestResults\generatedFolderWithDeploymentItems

output of my Tests: C:..\RootOfProject\Tests\ProjectDir\bin\Debug\NothingDeployed

my Project also should have this output Directory: C:..\RootOfProject\SolutionDir\TestResults\FolderWithDeploymentItems

Error after a test is running:

Test file 'C:Tests\TESTPROJECT\bin\Debug\ItemWhichShouldBeDeployed' does not exist.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
HaGem
  • 13
  • 2

2 Answers2

0

You should change the properties of the item in the Test project that need be copied as Deployment Item. Right click on the item and set following options Build Action : None and Copy to output Directory : Copy always or Copy if newer (see below), save the project and try again.

enter image description here

vendettamit
  • 14,315
  • 2
  • 32
  • 54
0

@vendettamit It worked thank you. Now i have another problem: I have different Testprojects in different testdirectories. ...\rootRepository\anotherDirectory\Testing\Testproject1.csproj ...\rootRepository\NewTestDirectoryWhereAllTestsFrom_AnotherDirectory_ShouldBePostponed\Testproject2Copy_ThisIsAnOtherTestProject.csproj

If i only run the testproject "Testproject2Copy_ThisIsAnOtherTestProject.csproj" everthing is working correctly, but if i run "Testproject2Copy_ThisIsAnOtherTestProject.csproj" and "Testproject1.csproj" together the i get for all tests in Testproject2Copy_ThisIsAnOtherTestProject.csproj the error: Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Test file '......\TestResults\Deploy_xxxDate\Out..\example.cmd' does not exist.. Aborting test execution.

HaGem
  • 13
  • 2