Specflow:
Specflow
is a testing framework which supports Behavior Driven Development (BDD) used in
.NET technology. It defines a test case behavior in plain meaningful English
test using a simple grammar language which is called "Gherkin".
Feature: A
feature file is an entry point to the Specflow test. It's an essential part of
specflow as it serves as an automation test script as well as live documents. A
feature file can contain a scenario or can contain many scenarios in a single
feature file but it usually contains a list of scenarios.
Feature file can be added to the
project with feature extension and your test scenario will be written in Gherkin
language in the format of Given, When, And, Then.
Example:
Feature: API Application
Scenario: Get API response using given endpoint
Given I have an endpoint "/endpoint/"
And
I have a base url "http://mydomain.com"
when
I call GET method of API
Then
I get API response in JSON format
Step Definition: The step argument transformation is a method that provides
a conversion from text (specifies by a regular expression) to an arbitrary .NET
type scoped bindings can be used to restrict the scope of step definition or
hook.
Step definition is a .cs file and a
sealed class which can’t be inherited. Also class having a [Binding] attribute
above on the class name which means the step class is binding with feature
file. All methods having Given, When, And, Then attribute above on the methods
with given statements same a feature file.
namespace APIAutomation.Steps
{
[Binding]
public class API
Application
{
[Given (@"I have
an endpoint (.*)")]
public void GivenIHaveAnEndpoint(string endpoint)
{
ScenarioContext.Current.Pending
();
}
}
}
Specflow >>>>> Download Now
ReplyDelete>>>>> Download Full
Specflow >>>>> Download LINK
>>>>> Download Now
Specflow >>>>> Download Full
>>>>> Download LINK k7