mercredi 4 novembre 2015

Get current Step definition from of a Scenario #SpeckFlow

I'm contributing to a framework called CodeSpec and it is built on top of SpeckFlow.

Using the ScenarioContext I could get the currently executing scenario's title. but I want to get the step definitions too.

Say the scenario is

Scenario: Google for Cats
Given I navigate to "http://google.com"
And I enter value "Cats" to the "searchBox" with the "id" of "lst-ib"
And I click on element "searchButton" with the "xpath" of "id('sblsbb')/button" and wait "4" seconds
Then The page contains text pattern "The domestic cat is"

I could get the title with the following code,

[AfterScenario("UIAutomationReport")]
public static void AfterScenario()
{
    var title = ScenarioContext.Current.ScenarioInfo.Title;
   //title now is "Google for Cats"

}

I want to get the step definitions too like Given I navigate to "http://google.com", And I enter value "Cats" to the "searchBox" with the "id" of "lst-ib", etc.

How can i do this?

Aucun commentaire:

Enregistrer un commentaire