Skip to content

Commit

Permalink
Demo: BindingRestrictions for Tag level
Browse files Browse the repository at this point in the history
  • Loading branch information
tgetmanova committed May 15, 2017
1 parent 5ad9989 commit e4e6e9a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ Scenario: Reading the electronic book with the reader
When I opened the 'Der schwarze Obelisk' book


Scenario: Reading the paper book
Scenario: Reading the paper book - scenario restriction
Given I have bought book 'Der schwarze Obelisk' in hard-cover
# This step is should be implemented separately with specific logic for the current scenario:
When I opened the 'Der schwarze Obelisk' book


# we use tag to mark scenario
@paperFunctionality
Scenario: Reading the paper book - restriction with tag
Given I have bought book 'Der schwarze Obelisk' in hard-cover
# This step is should be implemented separately with specific logic for the current scenario:
When I opened the 'Der schwarze Obelisk' book

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void WhenIOpenedTheBook(string title)
}

//// This is specific binding , restricted to certain Scenario:
[Scope(Scenario = "Reading the paper book")]
[Scope(Scenario = "Reading the paper book - scenario restriction")]
[When(@"I opened the '(.*)' book")]
public void WhenIOpenedTheBookAnotherBinding(string title)
{
Expand All @@ -104,9 +104,27 @@ public void WhenIOpenedTheBookAnotherBinding(string title)
"Incorrect Feature name for which step binding is being executed");

Assert.AreEqual(
"Reading the paper book",
"Reading the paper book - scenario restriction",
ScenarioContext.Current.ScenarioInfo.Title,
"Incorrect Scenario name for which step binding is being executed");
}
}

//// we use scenario tag to bind this method
[Scope(Tag = "paperFunctionality")]
[When(@"I opened the '(.*)' book")]
public void WhenIOpenedTheBookAnotherBindingWithTag(string title)
{
//// Here we can write logic for opening paper book and paging

Assert.AreEqual(
"BindingRestrictionsDemoFeature",
FeatureContext.Current.FeatureInfo.Title,
"Incorrect Feature name for which step binding is being executed");

Assert.AreEqual(
"Reading the paper book - restriction with tag",
ScenarioContext.Current.ScenarioInfo.Title,
"Incorrect Scenario name for which step binding is being executed");
}
}
}

0 comments on commit e4e6e9a

Please sign in to comment.