vs-unit-testing-framework

wildcard test containers to mstest. exe

最后都变了- 提交于 2019-12-12 08:23:11
问题 Is it possible to pass wildcard testcontainer values to the command-line mstest.exe rather than manually hardcoding multiple testcontainer values? Such as Mstest.exe /testcontainer: tests .dll I'm wanting to manually invoke mstest in our tfs 2012 upgrade template.xaml build processso tthat it behaves like a autodiscovery way similar to running tests in default template.xaml If not could this be written into a bat script to loop through folders from a given start folder? 回答1: MSTest doesn't

Read/Load multiple XML in a single test initialize with NDbUnit

╄→尐↘猪︶ㄣ 提交于 2019-12-11 15:14:35
问题 I am trying to use the NDbUnit. I have created seperate XSD for each table instead of one large XSD for complete database. My tests run fine when I use only single XSD and singe xml read. However for a perticular test, I need to have data in two or three different (but related) tables. If I try to read more than one xsd and xml, then it throws exception. Here is my code [ClassInitialize()] public static void MyClassInitialize(TestContext testContext) { IDbConnection connection = DbConnection

Can't overload async/await methods with NUnit Test Adapter

徘徊边缘 提交于 2019-12-11 11:59:56
问题 I'm getting a System.Reflection.AmbiguousMatchException when at least one of the methods are async and the method names match when the NUnit tests are run using the NUnit Test Adapter 2.0.0.0 in Visual Studio. I'm able to run the tests without problem when I use the ReSharper unit test runner and when I use the NUnit GUI test runner ( NUnit-2.6.4.msi ). Is this a bug in the NUnit Test Adapter? [TestFixture] public class SimpleRepro { [Test] [TestCase("I'm valid")] [TestCase("So am I!")]

Visual Studio C# unit testing - Run Unit test with varied/multiple test initializations, Run same unit test multiple times?

浪子不回头ぞ 提交于 2019-12-09 11:10:41
问题 What i want to do is this : Create a bunch of Unit Tests. Create a variety of different permutations/combinations of initialization of mocks, input variables etc. Run each given unit test with a against a set of such initializations based on some parameters. How would i go about doing something like this? Is there already any framework to handle this (I.e. run a given test multiple times while changing initialization)? Can you suggest any design or ideas with which i could make something to

Find out the next test method to execute in MS TestInitialize

浪尽此生 提交于 2019-12-08 16:35:41
问题 I keep the test data for specific test method in folder named the same as function. I previously had the same function call in each [TestMethod] , ClearAllAndLoadTestMethodData() which determined the method name via StackTrace . Now, I moved this function to [TestInitialize] . How can I find the name of the method that is about to be executed? I thought TestContext provide this. I have access to it via [AssemblyInitialize()] and on first run its property Name is set to name of the testmethod.

After installing .NET 4.5, previous Unit-Test project fails to build

不打扰是莪最后的温柔 提交于 2019-12-08 14:36:08
问题 I have a .NET 4.0 WPF solution that includes a Unit Test project which tests the different commands used in the viewmodels. Everything was fine. Then I installed .NET framework 4.5 and then VS2012, and started getting error messages like - XYZProject.UsersViewModel_Accessor.AddUserToAccountsCommand' is not supported by the language Before installing VS2012 the UnitTestFramework.dll was referenced from - C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\ which was

ClassInitialize attribute in unit test based class not called

微笑、不失礼 提交于 2019-12-08 14:25:55
问题 I added these method in a TestBase class : [ClassInitialize] public static void InitializBeforeAllTests() { } But when I run in Debug an unit test Test1() : [TestClass] public class TestMapping : TestBase { [TestMethod] public void Test1() { } The TestBase.InitializBeforeAllTests() method is never called. Why? 回答1: When declaring ClassInitialize attribute on a method, the method has to be static, public, void and should take a single parameter of type TestContext . If you're having also other

Add Fakes Assembly option missing

被刻印的时光 ゝ 提交于 2019-12-06 23:36:33
问题 I'm trying to get the Microsoft Fakes up and running in a Unit test project that I've set up in my solution. For some reason the Add Fakes Assembly option is missing which means I can't create mockups of assemblies. And since this is the only alternative to add the Microsoft.QualityTools.Testing.Fakes assembly I can't use the Shim functionality either. I've recently installed Visual Studio 2012 Professional and installed update 3 and this is the first go in Visual Studio 2012 . And I haven't

Add Fakes Assembly option missing

荒凉一梦 提交于 2019-12-05 03:29:54
I'm trying to get the Microsoft Fakes up and running in a Unit test project that I've set up in my solution. For some reason the Add Fakes Assembly option is missing which means I can't create mockups of assemblies. And since this is the only alternative to add the Microsoft.QualityTools.Testing.Fakes assembly I can't use the Shim functionality either. I've recently installed Visual Studio 2012 Professional and installed update 3 and this is the first go in Visual Studio 2012 . And I haven't changed any settings. Although I have installed ReSharper , could this be the culprit? Both Visual

How to get test result status from MSTest?

本秂侑毒 提交于 2019-12-04 12:42:35
In NUnit, I can get the test result from context.Result.State . If its NUnit.Framework.TestState.Success , then I know the test passed. In MSTest, how do I get that info? I saw context.Properties.Keys , but none of them speak of the status of the test result. Use the TestContext.CurrentTestOutcome property in the TestCleanup method: [TestClass] public class UnitTest { private TestContext TestContext { get; set; } [TestCleanup] public void TestCleanup() { if (TestContext.CurrentTestOutcome == UnitTestOutcome.Passed) //do something } [TestMethod] public void TestMethod() { } } 来源: https:/