我有一种测试方法,其中我调用了一个函数,并且在该函数中它进一步调用评估函数,如下所述。
protected bool Evaluate(bool condition, string message)
{
if (!condition)
{
Driver.Browser.GetScreenShot(@SKPConfigSettings.Logging.ScreenShotPath, TestContext.TestName, Core.Drivers.Enums.ScreenshotFormat.Png, true);
Logger.LogError(message);
Logger.LogError(Constants.Messages.TCFail);
return false;
}
else
return true;
}
问题总是,TestContext.TestName
它null
没有获取方法名称。它在测试方法中获取方法名称,但不是以这种方式。任何人都可以提供解决方案吗?