Skip to main content

Posts

Showing posts with the label bdd

ScenarioContext.Current vs Context Injection in Specflow

Within ScenarioContext in SpecFlow, there are two distinct ways to share data between steps in a scenario: context injection and current injection. Both approaches accomplish the same goal, but they are implemented differently. ScenarioContext.Current: A static attribute of the ScenarioContext class in SpecFlow is called ScenarioContext.Current. It offers a method for storing and retrieving data from various steps in the same scenario. By putting values in the scenario context during one step and retrieving them in another, you can use ScenarioContext.Current to communicate data between steps. Example: While ScenarioContext.Current is convenient, it has some drawbacks, such as being static and potentially leading to difficulties with running scenarios in parallel . Therefore, w ith SpecFlow 3.0, ScenarioContext.Current is marked obsolete.     Context Injection: Context injection allows you to use the step class's constructor to directly inject the scenario conte

Online Gherkin Editor

IDEs such as Eclipse, IntelliJ, VS Code, and similar IDEs, are ideal for SDETs but not for POs and BA Amigos who want to contribute. There are a few tools available like  https://cucumber.io/tools/cucumberstudio , etc. that provide Gherkin editors as well as a slew of other useful capabilities, but they are paid. If you are looking for something that is free, simple to use, and accessible to everyone, you can use: https://app.specflow.org/gherkin-editor/ The editor provides example scenarios for you to reference when you initially load the page. You can enter your own content into the text area, and the editor will highlight it. If you wish, you can even change the language via a dropdown menu.

Cucumber interchangeable keywords

  Did you know that following keywords are interchangeable in cucumber, but should be better use depending on the context of your flow? Feature | Ability | Business Need Scenario Outline | Scenario Template: Examples | Scenarios #bdd   #cucumber   #syntax   #keywords   #tips   #automation   #gherkin