Questions tagged [deploymentitem]

27 questions
100
votes
20 answers

Problems with DeploymentItem attribute

I'm currently maintaining an "old" system written in C#.net, removing some obsolete features and doing some refactoring. Thanks god, the previous guy wrote some unit tests (MSTests). I quite comfortable with JUnit tests, but didn't do yet much with…
Juri
  • 32,424
  • 20
  • 102
  • 136
77
votes
7 answers

Do MSTest deployment items only work when present in the project test settings file?

I can't seem to grasp how MSTest deployment items are supposed to be configured. I have been able to get them working properly by modifying the project's test settings file, but this is less then ideal -- the deployment item configuration is…
arathorn
  • 2,098
  • 3
  • 20
  • 29
19
votes
3 answers

DeploymentItem not deploying files

I am using MS unit testing framework for testing my C# library. I have to open a file which I'm deploying using DeploymentItem attribute. But it is not deploying file to the Test deployment directory. In my Unit-test project, I created a folder…
16
votes
3 answers

What is the relative path root of DeploymentItemAttribute?

Using MSTest, what is the relative path root of the DeploymentItemAttribute.
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
10
votes
4 answers

C# DeploymentItem fails to copy file for MSTest unit test

I'm having trouble getting an XSL file to be copied to the same directory as the test assembly when I use the DeploymentItem attribute on an MSTest unit test. I followed the chosen answer for this question and the file I need copied has its "Copy…
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
9
votes
2 answers

DeploymentItem behaving differently in VS2010 and VS2012

I have a VS2010 solution that I'm trying to upgrade to VS2012. I'm having a problem with the MSTest unit tests in VS2012. All of the tests include DeploymentItem attributes on the test class. [TestClass] [DeploymentItem(@"SubDir\SubDir2\models",…
7
votes
1 answer

DeploymentItem-Attribut for all files and folders in folder

I want to deploy all files in folders which are in a directory within a unit-test. To deploy eacht item through the DeploymentItem-Attribut is too much. I tried something like [DeploymentItem(".\\")] or [DeploymentItem("*.*")] but both don't work.…
Tomtom
  • 9,087
  • 7
  • 52
  • 95
5
votes
2 answers

MsTest: how to set the deployment item relative to either $(ProjectDir) or $(OutDir)

I want to add an deployment item to my test. As far as I understood up until now, the path is relative to the solution. I want the path to be relative to the project. Otherwise, the project can't be used in multiple solutions. How can I configure…
Tobias Langner
  • 10,634
  • 6
  • 46
  • 76
5
votes
1 answer

MSTest VS2010 - DeploymentItem copying files to different locations on different machines

I have found that DeploymentItem [TestClass(), DeploymentItem(@"TestData\")] is not copying my test data files to the same location when tests are built and run on different machines. The test data files are copied to the "bin\debug" directory in…
Jack
  • 2,153
  • 5
  • 28
  • 43
5
votes
2 answers

C# using static variable as parameter to DeploymentItem

I want to use a static variable as the parameter to DeploymentItem on an MSTest unit test but it doesn't seem I'm able to do so. There's an XSL file that needs to be copied along with the DLL file when the unit test runs, and I defined the location…
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
5
votes
1 answer

Why does data driven unit test fail in vs2012 when it worked fine in vs2010?

I have some data driven unit tests that were working just fine in Visual Studio 2010. These tests were implemented using the following…
5
votes
1 answer

DeploymentItem in vs2012 Doesn’t copy files

I want to add a deployment item to my test. My solution structure looks like: MySolution\ -- TestData\ --addresses.xml -- ProjectName.TestProject\ --Internal\ --MyTestClass.cs I’ve tried to add the file with the following…
musium
  • 2,942
  • 3
  • 34
  • 67
4
votes
1 answer

How do I remove stale DeploymentItems in unit tests?

consider the following test class: [TestClass] public class ExampleTests { [TestMethod] public void FileDoesNotExists() { Assert.IsFalse(System.IO.File.Exists("testfile.txt")); } [TestMethod] …
Yaur
  • 7,333
  • 1
  • 25
  • 36
4
votes
1 answer

How can I get the name of the DeploymentItem?

I would like to get rid of some duplication in this code. Following the DRY principle. As you can see, the name of the file/deploymentItem is repeated. [TestMethod] [DeploymentItem("TestData/TestExcel.xlsx")] <-- public void…
Peter Gfader
  • 7,673
  • 8
  • 55
  • 56
2
votes
1 answer

MS Test, Multiple Test Projects in Solution, and DeploymentItemAttribute

I have two unit test projects in my VS 2010 solution. Each project has a Data directory with input data needed for the unit tests. I annotated the test classes that need the data with [DeploymentItem("Data")] When I run tests individually, the run…
Eric J.
  • 147,927
  • 63
  • 340
  • 553
1
2