deploymentitem

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

二次信任 提交于 2020-01-20 06:11:28
问题 I have some data driven unit tests that were working just fine in Visual Studio 2010. These tests were implemented using the following pattern. [TestMethod()] [DeploymentItem("path_to_data_dir_relative_to_solution\\my_data.xml")] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\my_data.xml", "Token", DataAccessMethod.Sequential)] public void MyTestMethod() { // Arrange const string EXPECTED_PARAM_NAME = "table"; string data = TestContext.DataRow["Data"]

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

妖精的绣舞 提交于 2020-01-20 06:11:05
问题 I have some data driven unit tests that were working just fine in Visual Studio 2010. These tests were implemented using the following pattern. [TestMethod()] [DeploymentItem("path_to_data_dir_relative_to_solution\\my_data.xml")] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\my_data.xml", "Token", DataAccessMethod.Sequential)] public void MyTestMethod() { // Arrange const string EXPECTED_PARAM_NAME = "table"; string data = TestContext.DataRow["Data"]

MSTest - DeploymentItem attribute unavailable on windows store test project

折月煮酒 提交于 2019-12-24 13:14:19
问题 As the title says - I can't find a way of including a file with a windows store test project. (A standard .NET test project works fine) Right click on the solution and execute : Add new project -> C# -> Windows Store -> Unit test library (Windows store apps) You get this boilerplate, to which I have added the DeploymentItem attribute: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; namespace

DeploymentItem fails copying directories when there are multiple test projects per solution

只愿长相守 提交于 2019-12-22 18:15:22
问题 I have a number of test classes and methods that copy a particular directory like so: [TestClass, DeploymentItem("LanguageData", "LanguageData")] public class OcrTests { [TestMethod] public void Can_Capture_Field() { // some code that expects the LanguageData directory to be in the test results Out directory } // etc } [TestClass] public class OcrBuilderTests { [TestMethod, DeploymentItem("LanguageData", "LanguageData")] public void Can_Build_Specific_Ocr_Engine_Implementation() { // some

DeploymentItem fails copying directories when there are multiple test projects per solution

一曲冷凌霜 提交于 2019-12-06 10:47:51
I have a number of test classes and methods that copy a particular directory like so: [TestClass, DeploymentItem("LanguageData", "LanguageData")] public class OcrTests { [TestMethod] public void Can_Capture_Field() { // some code that expects the LanguageData directory to be in the test results Out directory } // etc } [TestClass] public class OcrBuilderTests { [TestMethod, DeploymentItem("LanguageData", "LanguageData")] public void Can_Build_Specific_Ocr_Engine_Implementation() { // some more code that expects the LanguageData directory to be in the test results Out directory } // etc } Those

DeploymentItem behaving differently in VS2010 and VS2012

浪尽此生 提交于 2019-12-04 19:19:47
问题 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", "models")] public class UnitTests { ... } In 2010, it's correctly copying dependent files from the SolutionDirectory\SubDir\SubDir2\models directory. In 2012, it's attempting to copy from the directory where the tests are deployed SolutionDirectory

DeploymentItem behaving differently in VS2010 and VS2012

断了今生、忘了曾经 提交于 2019-12-03 12:30:39
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", "models")] public class UnitTests { ... } In 2010, it's correctly copying dependent files from the SolutionDirectory\SubDir\SubDir2\models directory. In 2012, it's attempting to copy from the directory where the tests are deployed SolutionDirectory\UnitTests\bin\debug\SubDir\SubDir2\models I'm looking for a way to restore the old behavior. If you

What is the relative path root of DeploymentItemAttribute?

若如初见. 提交于 2019-12-03 11:46:54
问题 Using MSTest, what is the relative path root of the DeploymentItemAttribute. 回答1: Per the MSDN page... Relative paths are relative to the RelativePathRoot setting found in the .testrunconfig file. That setting is, by default, the Solution directory . So, if you have this project structure SecretProject\ ComponentA\ ComponentA.Test\ Resources\ required.xml ComponentA.Test.csproj Tests.cs SecretProject.sln And you want to deploy required.xml , you're going to create a DeploymentItemAttribute

What is the relative path root of DeploymentItemAttribute?

有些话、适合烂在心里 提交于 2019-12-03 02:05:39
Using MSTest , what is the relative path root of the DeploymentItemAttribute . Per the MSDN page... Relative paths are relative to the RelativePathRoot setting found in the .testrunconfig file. That setting is, by default, the Solution directory . So, if you have this project structure SecretProject\ ComponentA\ ComponentA.Test\ Resources\ required.xml ComponentA.Test.csproj Tests.cs SecretProject.sln And you want to deploy required.xml , you're going to create a DeploymentItemAttribute like this [TestClass] public class Tests { [TestMethod] [DeploymentItem("ComponentA.Test\Resources\required

DeploymentItem not deploying files

流过昼夜 提交于 2019-11-30 14:38:46
问题 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 TestFile in this folder there are multiple files, lets say a.txt, b.txt. Now in my Unit-test class I added DeploymentItem attribute. But file is not being copied. Here is my code. [TestClass] [DeploymentItem("TestFile")] public class CustomLibraryTest