Reputation: 39896
I try to use MSTest so as to perform unit tests on native C++ code (so as to try to implement Test Driven Development).
There's an MSTest entry in the "Add New Project" C++ Wizard. It creates some code obviously in C+++/CLI.
However, whenever I try to run these tests, Visual Studio indicates me that the tests are not runnable:
Not Runnable TestMethod2 CargoOCRTests UTA007: Method TestMethod2 defined in class CargoOCRTests.UnitTest1 does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, does not return a value and should not take any parameter. for example: public void Test.Class1.Test().
However I think my two tests functions do respect the prototype VS is complaining about:
namespace CargoOCRTests
{
[TestClass]
public ref class UnitTest1
{
[TestMethod]
void TestMethod1()
{
Assert::IsTrue(true);
};
[TestMethod]
void TestMethod2()
{
Assert::IsTrue(false);
};
};
}
Have you any idea what is the cause ?
Upvotes: 0
Views: 871
Reputation: 4647
You need to mark your test methods as public
public:
[TestMethod]
void TestMethod1() {}
Upvotes: 2