mstest

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

Unit Test Adapter threw exception: Unable to load one or more of the requested types

南笙酒味 提交于 2019-12-03 11:18:25
I am attempting to run SpecFlow tests from the Visual Studio 2010 Command Prompt, and I am getting a rather obtuse error message: Unit Test Adapter threw exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.. Some info about my VS2010 Project setup: Windows 7 Enterprise, 64 bit (Version 6.1.7601 Service Pack 1 Build 7601) Visual Studio 2010 Premium (v10.0.40219.1 SP1Rel) Using Coded UI Tests Using SpecFlow 1.9.0, which delegates to the CodedUI test API MSTest .NET v4.0.30319 Whole solution is compiling to 32 bit code (I have

How To Read UnitTest Project's App.Config From Test With HostType(“Moles”)

狂风中的少年 提交于 2019-12-03 11:15:34
I have the folowing tests: [TestClass] public class GeneralTest { [TestMethod] public void VerifyAppDomainHasConfigurationSettings() { string value = ConfigurationManager.AppSettings["TestValue"]; Assert.IsFalse(String.IsNullOrEmpty(value), "No App.Config found."); } [TestMethod] [HostType("Moles")] public void VerifyAppDomainHasConfigurationSettingsMoles() { string value = ConfigurationManager.AppSettings["TestValue"]; Assert.IsFalse(String.IsNullOrEmpty(value), "No App.Config found."); } } The only difference between them is [HostType("Moles")] . But the first passes and the second fails.

How do you get the iteration / line number from TestContext in data driven tests?

牧云@^-^@ 提交于 2019-12-03 11:07:23
I've implemented a data driven test using MsTest framework. I was wondering if there was a way to get the iteration / line number of the current test code from the TestContext object? As far as I can see, the only property relevant to DDT is DataRow that enables getting info for the current iteration from the data source, but I don't see any property that gives me what I need. Try this: int currentIteration = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow); private readonly PropertyInfo _rowIdProp = typeof(System.Data.DataRow).GetProperty("rowID", BindingFlags.NonPublic |

How to get TeamCity to run tests using MSTest?

南楼画角 提交于 2019-12-03 11:00:39
问题 I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters: Path to MSTest.exe: %system.MSTest.10.0% List assembly files: Projects\Metadude. .Tests\bin\Debug\Metadude. .Test.dll MSTest run configuration file: Local.testsettings However when this step runs, it does not execute any tests. This is the output from the log: [02:13:49]: Step 2/2: Run Unit Tests (MSTest) [02:13:49]: [Step 2/2] Starting: "D:\Program Files (x86)\TeamCity

How to get MSTest to find my test data files?

五迷三道 提交于 2019-12-03 10:43:28
问题 I have a few tests that need to be fed with external data from excel files. The files are included in the test project, and in Visual Studio, I have edited the test settings file (Local.testsettings) to deploy the data files. This makes it work fine i VS. We are, however, also running continous integration with TeamCity, and in TeamCity this doesn't work. My data files are unavailable to the test. Seems that the tests are run from a temporary folder named "C:\TeamCity\buildAgent\temp\buildTmp

CodedUI tests - start a browser once for the entire set of tests

China☆狼群 提交于 2019-12-03 10:39:17
I'm writing some codedUI tests in VS2010 to test a web application. I'd like to be able to open the browser once for the entire set of tests in the solution and then close it again when the tests finish. I've tried AssemblyInitialize attribute on a method, with my BrowserWindow.Launch in there, but it gives me the following exception when I run it: Assembly Initialization method OrdersGridTesting.SuiteSetup.Login threw exception. Microsoft.VisualStudio.TestTools.UITest.Extension.TechnologyNotSupportedException: Microsoft.VisualStudio.TestTools.UITest.Extension.TechnologyNotSupportedException:

Develop and run MSTest unit tests in Visual Studio 2010 without including .vsmdi and .testsettings

半世苍凉 提交于 2019-12-03 10:37:17
问题 I know this is somehow possible, as we have a project that contains MSTest unit tests that are runnable via the VS2010 test runner. We can even add new test methods or classes to the existing projects, and the runner will pick them up and include them in the test run. The problem comes when I try to add a new unit test project to the solution. If I add a project of the type "test project" to the solution, VS2010 will generate the test metadata and settings files that were not needed for

How can I reset an EF7 InMemory provider between unit tests?

安稳与你 提交于 2019-12-03 10:27:07
问题 I am trying to use the EF7 InMemory provider for unit tests but the persistent nature of the InMemory database between tests is causing me problems. The following code demonstrates my issue. One test will work and the other test will always fail. Even though I set the _context to null between tests the second test run will always have 4 records in it. [TestClass] public class UnitTest1 { private SchoolContext _context; [TestInitialize] public void Setup() { Random rng = new Random(); var

Visual Studio required to run MSTest test on Team City Build Server?

冷暖自知 提交于 2019-12-03 09:59:20
问题 We are setting up a Team City build server. On previous VS 2008 projects a full version of Visual Studio has been installed on the build server. We are now starting a VS 2010 project. Is it possible to run MSTest tests on the Team City build server without installing Visual Studio? 回答1: Download the Visual Studio Agents 2010 ISO: http://www.microsoft.com/en-us/download/details.aspx?id=1334 Mount/Extract the files and copy them to the agent server Run AutoRun and select to install Microsoft