mstest


Specify MSTest parameters in MSBuild

北战南征 提交于 2020-01-25 04:46:25
问题 I'm trying to prevent certain (MSTest) unit tests from being run on our build server. I'd really like to just add a TestCategory, and then specify: /category:"!RequiresLoginCredentials" But I'm not sure how to indicate that in the msbuild project file. The relevant section of the build file currently has: <ItemGroup> <!-- TEST ARGUMENTS If the RunTest property is set to true then the following test arguments will be used to run tests. Tests can be run by specifying one or more test lists and

Dotnet test on .NET Core 1.1 in VSTS: No Test Discoverer is Registered

♀尐吖头ヾ 提交于 2020-01-23 07:21:11
问题 I'm using VS 2017 with the new csproj in a .NET Standard class library, trying to test the library with a .NET Core 1.1 test project using MSTest testing framework with the dotnet test command. Running locally works perfectly fine; when I send the build to continuous integration, I get the error: No test discoverer is registered to perform discovery of test cases. How do I get this discoverer registered, and my tests running, in VSTS? 回答1: This is my build process on VSTS (detailed on my blog

Running NUnit tests in Visual Studio 2010 with code coverage

不打扰是莪最后的温柔 提交于 2020-01-22 05:34:34
问题 We have recently upgraded from Visual Studio 2008 to Visual Studio 2010. As part of our code base, we have a very large set of NUnit tests. We would like to be able to run these unit tests within Visual Studio, but with code coverage enabled . We have ReSharper, so can run the tests within Visual Studio, but it does not allow the code coverage tool to do its thing and generate the coverage statistics. Is there any way to make this work, or will we have to convert the tests over to MSTest?

Code coverage in VS2013 show coverage of Test and not actual code

蹲街弑〆低调 提交于 2020-01-17 15:23:19
问题 I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code. I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test . Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown. Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into

Code coverage in VS2013 show coverage of Test and not actual code

别说谁变了你拦得住时间么 提交于 2020-01-17 15:23:11
问题 I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code. I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test . Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown. Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into

parallel execution of tests in same class in mstest

ε祈祈猫儿з 提交于 2020-01-17 06:16:09
问题 I am trying to execute test cases in same class parallely using MStest framework. I have used .runsettings(maxcpucount) file and testsettings(paralleltestcount) file but these are only running tests of different projects in parallel.I am unable to achieve this when I have tests in same class. 回答1: You cannot run in-class tests in parallel using MSTest. Microsoft has this in their backlog tasks (microsoft github). In the mean time you can use NUnit to achieve this. Try this blog: http:/

How to log unit test entry and leave in MSTest

拈花ヽ惹草 提交于 2020-01-14 22:47:56
问题 I'm using MSTest and I want to write log entry before test executes and after it finishes. Obviously I don't want to add custom logging code at the beginning and end of each test - it would only make the test unreadable and seemed like a lot of effort (I have > 500 tests) Using TestInitialize and TestCleanup seemed like the way to go but I can't get the test name. Does anyone knows how to do this? 回答1: In MSTest, the name of the test case is available in the test context property. So to

Maintain context between unit test methods in VS Test Project

五迷三道 提交于 2020-01-14 07:53:06
问题 I want to run the following unit tests, in order: Create new customer with a random number for name, password etc. Retrieve the just created customer and assert that its properties contain the same random number Call the ForgotPassword function on same user, with the same random number for user name As seen clearly, I need to generate a random number once, and share it across 3 test methods. I cannot seem to find a way to do that. I thought of using the TestContext object, but that gets

Is there an MS Test Runner that is faster

℡╲_俬逩灬. 提交于 2020-01-14 07:51:29
问题 MS Test is killing me. It is so slow compared to NUnit. I am stuck with it because I need to be able to get Test Results into TFS easy. (Plus it works better with Pex and I am using that too). But I would really like it to go faster. Even just a bit faster would be nice. Has anyone made a test runner for MS Test tests that goes faster than the one embedded in Visual Studio? 回答1: The Gallio platform provides a test adapter for MSTest. You can then run your tests with any runner supporting

Assert in Try..Catch block is caught

浪子不回头ぞ 提交于 2020-01-14 07:35:48
问题 Just came across some interesting behavior - Assert being caught by Catch block. List<Decimal> consArray = new List<decimal>(); try { Decimal d; Assert.IsTrue(Decimal.TryParse(item.Value, out d)); consArray.Add(d); } catch (Exception e) { Console.WriteLine(item.Value); Console.WriteLine(e); } Assert throws AssertFailedException and its caught by catch . Always thought that if Assert fails then test is failed and consecutive execution is aborted. But in that case - test moves along. If nothing

工具导航Map