0

I have a Unit-TestClass. To test some functions for who i need database-access, i define the DeploymentItemAttribute at the head of the class directly after the TestClassAttribute.

For some reasons, running the Testclass shows very different beheaivor depending on if i run all the test of my TestProject or Testing only this units by pressing STRG+R, T.

By using CTRL+R, T, all tests of the class will succeed. By running all the tests of the testproject, they will fail because they can't find the file. By right-clicking on the Testclass in the solution-explorer and click "Run Unit-Tests", they will also fail.

I configured the file correctly. It will "always copy". More strangely, switching the deployment-flag in the testconfigurations will also invert the results.

user2762996
  • 566
  • 1
  • 5
  • 16
  • Does it make a difference if you specify it on each test method rather than just on the class? I have found that the deployment item doesn't always get picked up if you just specify it at class level. – Jay Jan 31 '14 at 13:06

1 Answers1

1

Relying on my memory I can tell that by using CTRL+R, T you invoke default Microsoft's test runner, which deals with DeploymentItemAttribute as one would expect.
But when you say:

By running all the tests of the testproject, they will fail because they can't find the file. By right-clicking on the Testclass in the solution-explorer and click "Run Unit-Tests", they will also fail.

I'm more then sure that these commands are provided by ReSharper, hence tests are run using ReSharper's test runner, which in the past had issues with this attribute.

As for the solutions to this problem there are some mentioned here and here, but they might depend on the version of ReSharper so you might want to google it up for your specific version.

Community
  • 1
  • 1
Yurii
  • 4,811
  • 7
  • 32
  • 41