我有长期的自动化用户案例,我想找到简化它们并减少执行时间的方法。我正在使用SpecFlow,并使用小黄瓜和C#(Selenium(编写测试。
如何获取每个小黄瓜步骤的持续时间?
SpecFlow已经输出了每个步骤的持续时间。
例如,当我使用MsTest
单元测试提供程序,在Visual Studio 2015中运行测试,单击Test Explorer
窗口中的Output
超链接时,我可以在Standard Output
部分中看到以下信息:
Given this is a step
-> done: MySteps.GivenThisIsAStep() (0.1s)
When this is another step
-> done: MySteps.WhenThisIsAnotherStep() (0.1s)
Then this is the last step
-> done: MySteps.ThenThisIsTheLastStep() (0.0s)
请注意,括号中有秒数。