mstest

Running Universal Windows unit tests from the command line

笑着哭i 提交于 2019-11-26 17:39:25
问题 How do you run Universal Windows (UWP) unit test projects from the command line? I am using the MSTestFramework. 回答1: Short answer: vstest.console.exe /Platform:x64 AppPackages\UnitTestProject1_1.0.0.0_x64_Debug_Test\UnitTestProject1_1.0.0.0_x64_Debug.appx Long answer: Create the project by selecting Universal / Unit Test App (Universal Windows) template: Build it with command line using in the folder where the solution file is msbuild /p:Platform=x64;Configuration=Debug Try running the

How do I use MSTest without Visual Studio?

♀尐吖头ヾ 提交于 2019-11-26 17:23:51
Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it? It doesn't have a GUI (apart from Visual Studio) but there's a command line tool: MSTest.exe Here is the official documentation on running MSTest tests . boris MSTest can be used without installing Visual Studio. You will need to install Visual Studio Test Agent , which is a free download from Microsoft. I think this approach is better from a licensing perspective than manually copying MSTest.exe and its

How Does MSTEST/Visual Studio 2008 Team Test Decide Test Method Execution Order?

戏子无情 提交于 2019-11-26 17:12:13
问题 I was under the impression that the test methods in a unit test class would be executed in the order that they appear in the class file. Apparently this is not true. It also doesn't appear to be purely based off of alphabetical order either. How does MSTEST decide execution order? EDIT: I was able to track down the answer after digging a bit. See below. 回答1: I was able to track down the answer. According to Microsoft employee Guillermo Serrato: MSTest executes all tests synchronously, the

How to run a test method with multiple parameters in MSTest?

不打扰是莪最后的温柔 提交于 2019-11-26 15:48:28
NUnit has a feature called Values, like below: [Test] public void MyTest( [Values(1,2,3)] int x, [Values("A","B")] string s) { // ... } This means that the test method will run 6 times: MyTest(1, "A") MyTest(1, "B") MyTest(2, "A") MyTest(2, "B") MyTest(3, "A") MyTest(3, "B") We're using MSTest now, is there any equivalent for this so that I can run the same test with multiple parameters? [TestMethod] public void Mytest() { // ... } jeroenh It is unfortunately not supported in MSTest. Apparently there is an extensibility model and you can implement it yourself . Another option would be to use

How do I use Assert to verify that an exception has been thrown?

喜欢而已 提交于 2019-11-26 15:35:29
How do I use Assert (or other Test class?) to verify that an exception has been thrown? For "Visual Studio Team Test" it appears you apply the ExpectedException attribute to the test's method. Sample from the documentation here: A Unit Testing Walkthrough with Visual Studio Team Test [TestMethod] [ExpectedException(typeof(ArgumentException), "A userId of null was inappropriately allowed.")] public void NullUserIdInConstructor() { LogonInfo logonInfo = new LogonInfo(null, "P@ss0word"); } ojrac Usually your testing framework will have an answer for this. But if it's not flexible enough, you can

How do you run SpecFlow scenarios from the command line using MSTest?

荒凉一梦 提交于 2019-11-26 14:32:00
问题 I've got Visual Studio 2010, and we have two VS solutions we work with. The first is the web application, and the second is strictly for SpecFlow tests. Having two instances of Visual Studio running at the same time just to run SpecFlow features is eating all the available RAM causing things to slow down. I've done some searching on Google and here on StackOverflow, plus perused the MS documentation on the MSTest command line tool, but I haven't found the answer. The full SpecFlow test suite

What would be an alternate to [TearDown] and [SetUp] in MSTest?

拈花ヽ惹草 提交于 2019-11-26 11:55:31
问题 When I use MSTest Framework, and copy the code that Selenium IDE generated for me, MSTest doesn\'t recognize [TearDown] and [SetUp] . What is the alternative to this? 回答1: You would use [TestCleanup] and [TestInitialize] respectively. 回答2: Keep in mind that your Initialize/Cleanup methods have to use the right signature. http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.classinitializeattribute.aspx [AssemblyInitialize()] public static void AssemblyInit

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

爷,独闯天下 提交于 2019-11-26 09:15:24
问题 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 separated from individual tests, and the file paths appear to be stored as absolute paths unless the files are under the solution folder. Am I not supposed to be able to add a deployment item using the [DeploymentItem] attribute on either a [TestClass]

How to write to Console.Out during execution of an MSTest test

落爺英雄遲暮 提交于 2019-11-26 08:00:07
问题 Context: We have some users reporting issues with a file upload feature in our web application. It only happens occasionally and without any special pattern. We have been trying to figure it out for a long time, adding debug information anywhere we can think it might help, crawling the logs etc, but we have not been able to reproduce or figure it out. Problem: I\'m now trying to reproduce this by using MSTest and WatiN to repeat the operation that is supposed to fail a large number of times

Does MSTest have an equivalent to NUnit's TestCase?

给你一囗甜甜゛ 提交于 2019-11-26 07:29:40
问题 I find the TestCase feature in NUnit quite useful as a quick way to specify test parameters without needing a separate method for each test. Is there anything similar in MSTest? [TestFixture] public class StringFormatUtilsTest { [TestCase(\"tttt\", \"\")] [TestCase(\"\", \"\")] [TestCase(\"t3a4b5\", \"345\")] [TestCase(\"3&5*\", \"35\")] [TestCase(\"123\", \"123\")] public void StripNonNumeric(string before, string expected) { string actual = FormatUtils.StripNonNumeric(before); Assert