mstest

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

run tests in mstest without compiling/building

我们两清 提交于 2020-01-13 08:09:57
问题 is there a way? do I have to wait for building every time I start the test? I want to build from visual studio not from test thanks 回答1: Any time your code changes and you run your test it is going to do a build... so technically you can run your test over and over again and they will only build the first time, but once you run your test why would you run them again without making a code change? Couple of things that I use that make your test run faster are: Check the box for "Only build