I am automating tests as end-to-end scenarios, therefore I have multiple Thens, e.g.
Scenario: My scenario
Given a
When b
Then check something 1
When c
Then check something 2
When d
And e
Then check something 3
I am aware that you can access the test's name TestContext.CurrentContext.Test.Name which you can insert into an error log, but I can't seem to find a way to get the step name.
When the scenario fails, I want to know which Then statement it failed on, e.g...
string errorLog += "Scenario \"" + TestContext.CurrentContext.Test.Name + "\" failed on test step: \"" + testStepName + "\"."
...should produce something like this:
Scenario "My scenario" failed on test step: "Then check something 2".
Is this possible?
thanks
Aucun commentaire:
Enregistrer un commentaire