mstest Questions

13

Solved

Error : No tests found to run - while debugging/running C# Unit test cases -- Visual studio 2017 15.5.1 not discovering test cases. Framework Microsoft.NET framework 4.6.1 Added Test adapters as ...
Abscise asked 3/4, 2018 at 9:55

8

Solved

I'm currently converting my MsTest unit tests to xUnit. With xUnit, is there a way to test exception messages? Is it correct to test exception messages as opposed just the exception type?
Orfield asked 21/3, 2011 at 10:50

3

Solved

Want to write unit test for HttpTrigger GET. Have method signature as follow: public static async Task<HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = nul...

3

Solved

Is there a way to set timeouts for a whole test suite in mstest, or just for individual tests? I.E., if I want the total running time of the tests in suite X to be no more than 2 minutes, how do I ...
Vocalise asked 23/10, 2013 at 9:36

12

Solved

This question regards unit testing in Visual Studio using MSTest (this is important, because of MSTest's execution order). Both the method marked [TestInitialize] and the test class constructor wil...
Dichromate asked 2/12, 2008 at 16:15

3

Solved

I'm looking for documentation for .runsettings files as used with vstest. Is there an xsd? I can't seem to find much except for a few example files in the msdn documentation.

25

Solved

I have some unit tests that expects the 'current time' to be different than DateTime.Now and I don't want to change the computer's time, obviously. What's the best strategy to achieve this?
Infiltration asked 11/3, 2010 at 14:31

2

MSTest offers a [ClassInitialize] attribute, which can be placed on a static method to provide one-time initialization. Assume I have a static member in a test class that I wish to initialize in su...
Meekins asked 7/2, 2021 at 17:23

13

Solved

When I updated Visual Studio to the latest version, 1 of my test projects stopped running tests and outputted this message: Test project {} does not reference any .NET NuGet adapter. Test discover...
Ossuary asked 22/8, 2018 at 13:20

17

I can't run my unit tests. I have the next error: Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFra...
Harriman asked 16/10, 2018 at 10:49

19

Visual Studio allows unit testing of private methods via an automatically generated accessor class. I have written a test of a private method that compiles successfully, but it fails at runtime. A ...
Premillenarian asked 3/2, 2012 at 1:50

5

Solved

The tests are present at Test Explorer but run command has no effect. Looking at Output windows, for Test outputs it shows many errors like this: MSTestAdapter failed to discover tests in class 'U...
Bertine asked 24/3, 2020 at 15:22

4

We're using the VS 2010 test runner (MSTest) for automated functional testing. When we run tests from Visual Studio, VS creates a process called QTAgent32.exe, and it runs the tests in that process...
Searby asked 18/11, 2011 at 21:55

4

Solved

I am using Visual Studio 2022 Community Edition. Whenever I delete or rename existing test methods (including copy, paste, then rename), Visual Studio fails to run tests after the changes are made....
Pianoforte asked 18/12, 2022 at 20:52

6

Solved

Some of my mstest unit tests help detect multi-threading race conditions, and as such they are most useful when run many times in a row, but I only want to do this for specific test runs -- not all...
Bastian asked 16/5, 2009 at 15:50

5

Solved

So I have situation when I need skip current test from test method body. Simplest way is to write something like this in test method. if (something) return; But I have a lot complicated tests an...
Opia asked 25/7, 2012 at 12:56

5

Solved

Question: Can anyone tell me why my unit test is failing with this error message? CollectionAssert.AreEquivalent failed. The expected collection contains 1 occurrence(s) of . The actual colle...
Pioneer asked 4/3, 2011 at 14:23

4

I want to write unit test for my controller. I want to check the response codes of actions. For example, Post action should return 201, get should return 200, etc. However, the Action method retu...
Mutation asked 4/10, 2017 at 10:38

4

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
Yasui asked 6/4, 2009 at 6:53

11

Solved

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 ...
Abstruse asked 26/1, 2012 at 16:50

5

Solved

We have MSTest tests which automatically run in hourly production. One of these tests is marked with [Ignore] attribute because it is not yet ready to run it in our production environment. Now I wa...
Buskined asked 12/4, 2012 at 8:35

4

Solved

anybody knows how to run unit test dlls built using mstest from the command line, without running VS considering that on the machine there is .net 4.0 and VS2010 installed
Pascoe asked 30/3, 2012 at 15:44

3

I try to run SpecFlow tests with NUnit test runner in parallel. I am using: C# / .Net Core 3.1 NUnit as testrunner Specflow I have added this line on top of a file (as describe here: https://spec...
Loggia asked 29/6, 2020 at 18:4

3

This statement when run from a console application sets 'x' to true: var x = 3.GetType().IsAssignableTo(typeof(INumber<>)); // x == true The same statement when run inside a unit test sets x...
Morvin asked 2/8, 2023 at 12:55

2

Solved

A few months ago, when our projects were still in .NET 4.7.2, we used to run unit tests on our Azure DevOps Server using the Visual Studio Test task. We used parameter Test files to specify which t...
Radbun asked 14/11, 2021 at 10:35

© 2022 - 2024 — McMap. All rights reserved.