tagged [mstest]

No tests to execute msTest

No tests to execute msTest I'm trying to run .NET unit tests on the command line using MSTest My command is When run it returns > Starting execution... No tests to execute. The unit test runs perfect...

Visual Studio 15.8.1 not running MS unit tests

Visual Studio 15.8.1 not running MS unit tests 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 re...

23 Aug at 13:29

MSTest Equivalent for NUnit's Parameterized Tests?

MSTest Equivalent for NUnit's Parameterized Tests? NUnit supports a feature where you can specify a set of data inputs for a unit test to be run multiple times. What's the best way to accomplish this ...

MS Test: Getting executing testlocation?

MS Test: Getting executing testlocation? How do I find the equivalent of a path to the executing assembly when running tests under MS Test in VS 2010? I need to know where the test is running from, so...

19 Apr at 00:0

How to run ClassCleanup (MSTest) after each class with test?

How to run ClassCleanup (MSTest) after each class with test? I have several classes with tests suites. Each test class starts from ClassInitialize and finishes by ClassCleanup. My problem is that Clas...

7 Mar at 21:23

DataTestMethod vs TestMethod

DataTestMethod vs TestMethod I started to use MSTest 2 `DataRow` attributes to check multiple cases in a single test: It works nicely, both in NCrunch and in CI. Only now I noticed that there is speci...

25 Oct at 11:33

How can I get "Copy to Output Directory" to work with Unit Tests?

How can I get "Copy to Output Directory" to work with Unit Tests? When I build a unit test project before the tests are executed the test output is copied to a TestResults folder and then the tests ar...

How to set test category for all tests in the class

How to set test category for all tests in the class I am using [MSTest](https://en.wikipedia.org/wiki/MSTest), and I want to set the same test category for all methods in test class at once, without s...

19 Nov at 15:34

Why does TestInitialize get fired for every test in my Visual Studio unit tests?

Why does TestInitialize get fired for every test in my Visual Studio unit tests? I'm using Visual Studio 2010 Beta 2. I've got a single `[TestClass]`, which has a `[TestInitialize]`, `[TestCleanup]` a...

private TestInitialize method is not initializing objects

private TestInitialize method is not initializing objects I have a test class that should basically be like the following: ``` [TestClass] public class MyTest { private MyClass o1; private MyClass...

MsTest ClassInitialize and Inheritance

MsTest ClassInitialize and Inheritance I have a base class for my tests which is composed in the following way: Now I am trying to create

20 Dec at 18:22

How can we run a test method with multiple parameters in MSTest?

How can we run a test method with multiple parameters in MSTest? NUnit has a feature called Values, like below: This means that the test method will run six times: We're using MSTest now, b

What is the usage of Assert.Equals?

What is the usage of Assert.Equals? I am working on Unit Testing for my current project and came across something odd. The .Net UnitTesting library has both Assert.Equals and Assert.AreEqual. The [rem...

1 Apr at 18:46

How To Read UnitTest Project's App.Config From Test With HostType("Moles")

How To Read UnitTest Project's App.Config From Test With HostType("Moles") I have the folowing tests: ``` [TestClass] public class GeneralTest { [TestMethod] public void VerifyAppDomainHasConfigur...

11 Nov at 14:55

Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks"

Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks" I can't run my unit tests. I have the next error: ...

Visual Studio 2012 testing with csla and entity framework

Visual Studio 2012 testing with csla and entity framework In VS2010 my MSTest test run just fine. When running in VS2012 I am getting an error. The test sets the Csla.ApplicationContext.User with a Cu...

NUnit vs. MbUnit vs. MSTest vs. xUnit.net

NUnit vs. MbUnit vs. MSTest vs. xUnit.net There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: [http://xunit.github.io/docs/comparisons.html](htt...

Prevent MSTest from copying / deploying every dll

Prevent MSTest from copying / deploying every dll When running MSTest from Visual Studio - the unit test execution time is relatively quick. When running MSTest from the command line, with /testsettin...

PropertyChanged event testing: is this a good way?

PropertyChanged event testing: is this a good way? I'm developing WPF applications using MVVM pattern. I have ViewModel with code like this: `OnPropertyChanged

8 Dec at 08:20

Are multiple asserts bad in a unit test? Even if chaining?

Are multiple asserts bad in a unit test? Even if chaining? Is there anything wrong with checking so many things in this unit test?: ``` ActualModel = ActualResult.AssertViewRendered() // check 1 ...

12 Mar at 04:3

What is the replacement for TestContext.DataRow["MyColumnName"]

What is the replacement for TestContext.DataRow["MyColumnName"] Using MSTest in a .Net Core Unit test project. I am attempting to use a csv datasource to provide the data for a test method. Previously...

6 Jul at 15:59

MSTest Shows Partial Code Coverage on Compound Boolean Expressions

MSTest Shows Partial Code Coverage on Compound Boolean Expressions From Microsoft's documentation, partially covered code is I'm pretty stumped on this one (simplified for brevity): Given this method:

18 Oct at 06:53

AssemblyInitialize method doesnt run before tests

AssemblyInitialize method doesnt run before tests I am using MsTest V2 framewrok for my tests. I have Test automation framework (TAF) project and project with tests. Tests project inherited from TAF a...

4 Jan at 10:13

Explicitly call static constructor

Explicitly call static constructor I want to write unit test for below class. If name is other than "MyEntity" then mgr should be blank. Using Manager private accessor I want to change name to "Test"...

Ignore IgnoreAttribute

Ignore IgnoreAttribute 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...

12 Apr at 08:35