-
Notifications
You must be signed in to change notification settings - Fork 0
Simple SpecFlow Examples #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
psiberknetic
wants to merge
13
commits into
master
Choose a base branch
from
getting-started-with-simple-examples
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ecf8f14
Implement simple addition test code
psiberknetic 85425a7
Add new scenario to add more numbers
psiberknetic 32d0a6f
Implement new testing methods
psiberknetic 3fa20aa
This time keep the code SpecFlow generated
psiberknetic 3139c8f
Implement the testing code utilizing the variables
psiberknetic 6c94227
Add additional scenarios which use the variables
psiberknetic 162c3e2
fixup! Add additional scenarios which use the variables
psiberknetic 0f978a6
Add a new project with a funtion we want to test
psiberknetic 7c0c00a
Implement IsStoreOpen function
psiberknetic 61a5290
Finish implementation and add test scenarios
psiberknetic 9c4b2f5
Add a couple additional edge cases. Look! Tests pass
psiberknetic d7db084
Add additional documentation to feature
psiberknetic 321ce61
Simply test scenario file with outline
psiberknetic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: TestAddingNumbersWithVariables | ||
In order to avoid writing a lot of extra testing code | ||
I want to be able to use variables in my SpecFlow tests | ||
|
||
@mytag | ||
Scenario: Add 1 and 2 | ||
Given I have the numbers 1 and 2 | ||
When I add them together | ||
Then they should add up to 3 | ||
|
||
Scenario: Add 3 and 4 | ||
Given I have the numbers 3 and 4 | ||
When I add them together | ||
Then they should add up to 7 | ||
|
||
Scenario: Add 101 and 1332 | ||
Given I have the numbers 101 and 1332 | ||
When I add them together | ||
Then they should add up to 1433 |
220 changes: 220 additions & 0 deletions
220
GettingStarted/2_TestAddingNumbersWithVariables.feature.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Feature: Check to see if the store is open | ||
As a potential customer | ||
I want to know if your store is open | ||
So I don't waste my time driving there if it isn't | ||
Store Hours: | ||
M-Th 8-10 | ||
Fri 8-11 | ||
Sat 10-8 | ||
Sun 10-6 | ||
|
||
@mytag | ||
Scenario: Check if store is open at 12/11/2019 5:00PM | ||
Given It is currently 12/11/2019 at 5:00PM | ||
Then The store is open | ||
|
||
Scenario: Check if store is open at 12/15/2019 11:00PM | ||
Given It is currently 12/15/2019 at 11:00PM | ||
Then The store is closed | ||
|
||
Scenario: Open time edge case - store opens at 8AM | ||
Given It is currently 12/11/2019 at 8:00AM | ||
Then The store is open | ||
|
||
Scenario: Close time edge case - store closes at 10:00PM | ||
Given It is currently 12/11/2019 at 10:00PM | ||
Then The store is closed | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to use Given, When and Then for every scenario. If you don't need one, don't use them. Some tests are simple enough that you don't need to try to fit that template.
In the "Check if the store is open" example above, just the Given and Then lines provide extremely readable test scenarios.