mstest

Simulate a delay in execution in Unit Test using Moq

╄→гoц情女王★ 提交于 2020-01-12 14:03:44
问题 I'm trying to test the following: protected IHealthStatus VerifyMessage(ISubscriber destination) { var status = new HeartBeatStatus(); var task = new Task<CheckResult>(() => { Console.WriteLine("VerifyMessage(Start): {0} - {1}", DateTime.Now, WarningTimeout); Thread.Sleep(WarningTimeout - 500); Console.WriteLine("VerifyMessage(Success): {0}", DateTime.Now); if (CheckMessages(destination)) { return CheckResult.Success; } Console.WriteLine("VerifyMessage(Pre-Warning): {0} - {1}", DateTime.Now,

What command line arguments does Visual Studio use for running MsTest?

痴心易碎 提交于 2020-01-12 07:35:28
问题 I'm trying to figure out which is the command line arguments used by Visual Studio when you run the MsTest tests, I guess it starts with: MSTest.exe /testmetadata:%SolutionName%.vsmdi /testlist: But I couldn't figure out how to fill the testlist parameter, because both the test list name and id get the following error: The test list path 8c43105b-9dc1-4917-a39f-aa66a61bf5b6 cannot be found. An error occurred while executing the /testlist switch. 回答1: I'm trying to figure out which is the

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

佐手、 提交于 2020-01-12 06:56:12
问题 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

OpenCover MSBuild Integration - No results generated

时光毁灭记忆、已成空白 提交于 2020-01-11 09:21:51
问题 After getting OpenCover to work on my machine, the next step is getting it to work with the build server. I've been trying to integrate OpenCover with MSBuild on a Bamboo Build Server. I have modified Build.proj as follows to run OpenCover after building the solution: <Target Name="TestAndCodeCoverage" DependsOnTargets="Build" > <Message Text="Executing Unit Tests and running OpenCover to check code coverage..." /> <MakeDir Directories="Coverage" /> <Exec Command='"C:\Program Files (x86)

Where is the “Create Unit Tests” selection?

好久不见. 提交于 2020-01-09 02:54:55
问题 I have installed the new Visual Studio 2012 Ultimate. I have created a Test Project with my solution and it contains some default unit tests. However right clicking on new Methods doesn't show the "Create Unit Tests" context menu any longer. See Visual Studio 2010 Ultimate: And Visual Studio 2012 Ultimate: Any idea why that could be? UPDATE: Solution for Visual Studio 2012 and 2013: Microsoft has acknowledged it here and offers an official work around patch to fix it. Download, install and

Where is the “Create Unit Tests” selection?

只愿长相守 提交于 2020-01-09 02:54:11
问题 I have installed the new Visual Studio 2012 Ultimate. I have created a Test Project with my solution and it contains some default unit tests. However right clicking on new Methods doesn't show the "Create Unit Tests" context menu any longer. See Visual Studio 2010 Ultimate: And Visual Studio 2012 Ultimate: Any idea why that could be? UPDATE: Solution for Visual Studio 2012 and 2013: Microsoft has acknowledged it here and offers an official work around patch to fix it. Download, install and

Using structure map with MSTest

a 夏天 提交于 2020-01-05 04:09:18
问题 I have created myself a test project with a single test in it. Within the "TestInitialize" method I'm trying to call my StructureMap setup method where I set which concrete instances should be used for which interfaces. However as soon as the test tries to run I get a {"Operation could destabilize the runtime."} exception. Without using structuremap it works fine (but obiviously I need it in there). Can anyone point me in the right direction as to what might be causing this exception? 回答1:

Duplicate the behaviour of a data driven test

时光总嘲笑我的痴心妄想 提交于 2020-01-04 15:31:14
问题 Right now, if you have a test that looks like this: [TestMethod] [DeploymentItem("DataSource.csv")] [DataSource( Microsoft.VisualStudio.TestTools.DataSource.CSV, "DataSource.csv", "DataSource#csv", DataAccessMethod.Sequential)] public void TestSomething() { string data = TestContext.DataRow["ColumnHeader"].ToString(); /* do something with the data */ } You'll get as many tests runs as you have data values when you execute this test. What I'd like to do is duplicate this kind of behaviour in

Duplicate the behaviour of a data driven test

狂风中的少年 提交于 2020-01-04 15:30:58
问题 Right now, if you have a test that looks like this: [TestMethod] [DeploymentItem("DataSource.csv")] [DataSource( Microsoft.VisualStudio.TestTools.DataSource.CSV, "DataSource.csv", "DataSource#csv", DataAccessMethod.Sequential)] public void TestSomething() { string data = TestContext.DataRow["ColumnHeader"].ToString(); /* do something with the data */ } You'll get as many tests runs as you have data values when you execute this test. What I'd like to do is duplicate this kind of behaviour in

Help troubleshooting System.BadImageFormatException:

狂风中的少年 提交于 2020-01-04 14:31:27
问题 While debugging through a .NET 3.5 SP1 project which is contacting a local web service, I'm receiving the exception System.BadImageFormatException: "Bad Class Token" Of course there aren't much more details about what's causing the exception. I can tell that the method where this occurs, which is in the same class as it's caller, the debugger fails to reach. This exception occurs on the call of the method that contacts the web service. I do have other methods communicating with the web