How to get the unit test name from the within unit test?
I have the below method inside a BaseTestFixture Class:
public string GetCallerMethodName()
When using Visual Studio to run your tests if you add a TestContext property in your test class you can get this information easily.
[TestClass]
public class MyTestClass
{
public TestContext TestContext { get; set; }
[TestInitialize]
public void setup()
{
logger.Info(" SETUP " + TestContext.TestName);
// .... //
}
}