Stats: Visual 2015 C# Selenium WebDriver2.53.1InternetExplorer 11
为了清晰起见,试图将方法名添加到我的报告中。我在用
MethodBase m = System.Reflection.MethodBase.GetCurrentMethod();然后我打电话
m.Name 希望看到方法名,但在我的报告中,它调用了".ctor()"
有关于如何调用实际方法名的建议吗?
发布于 2016-08-15 13:59:29
ctor()是类的默认构造函数。这意味着您正在调用GetCurrentMethod(),而调用它的类仍在构造中。
您还可能希望获得类名(请参阅here):
string className = MethodBase.GetCurrentMethod().DeclaringType.Name;https://stackoverflow.com/questions/38956287
复制相似问题