I am currently working on a project using C# and Visual Studio 2012.
I have a hard time trying to figure out why VS 2012 does not want to run all of my tests.
I have one test projects which runs 1 unit test out of 2. No matter what I’ve tried, it does not want to run the other unit test. It is not detected via the Test Explorer, the “Not Run” test does not include the file.
Here’s a basic framework to put it clearly:
(I have edited the framework to include every part of the solution)
Solution
MainProject
ProjectA.Tests (that is the project)
UnitTestsA.cs (Actually run)
UnitTestsB.cs (Neven run)
Here’s the code for the second unit test file:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MagicAdmin.Tests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{ }
}
}
How can I solve this? What do I do wrong?
In order for Visual Studio to recognize your unit tests, you need to rebuild the unit test project. It is possible that the unit test project is not set to build as part of your current build configuration and thus is not being built when you build the solution.