-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,160 additions
and
6 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/6.0/My.Test.Library.MsTest.Unit.Tests/Features/BookingService.feature
This file contains 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,57 @@ | ||
Feature: BookingService | ||
Basic booking service that takes a booking request, validates it for correctness, and then attempts to secure the number of tickets against the registered event. | ||
|
||
@validation | ||
Scenario: Invalid request | ||
|
||
Background: an invalid response is returned from the (mocked) request validator interface | ||
Given the request has a validation failure of "Something failed validation" | ||
When the booking request is made | ||
Then the booking request should fail | ||
And the response message should be "Error - Something failed validation" | ||
|
||
@tickets | ||
@event | ||
Scenario: Event cancelled | ||
Given the request is valid | ||
And the request asks for 2 tickets | ||
And the requested event is "Cancelled" | ||
When the booking request is made | ||
Then the booking request should fail | ||
And the response message should be "Error - Event is cancelled" | ||
|
||
@tickets | ||
Scenario: No tickets left | ||
Given the request is valid | ||
And the request asks for 2 tickets | ||
And the requested event has 0 tickets left | ||
When the booking request is made | ||
Then the booking request should fail | ||
And the response message should be "Error - Event is fully booked" | ||
|
||
@tickets | ||
Scenario: Some tickets left | ||
Given the request is valid | ||
And the request asks for 20 tickets | ||
And the requested event has 10 tickets left | ||
When the booking request is made | ||
Then the booking request should succeed | ||
And the response should indicate 10 tickets were purchased | ||
And the response message should be "Partial Success - 10 tickets were purchased" | ||
|
||
@tickets | ||
@happyPath | ||
Scenario: Tickets purchased | ||
Given the request is valid | ||
And the request asks for 5 tickets | ||
And the requested event has 10 tickets left | ||
When the booking request is made | ||
Then the booking request should succeed | ||
And the response should indicate 5 tickets were purchased | ||
And the response message should be "Success - 5 tickets were purchased" | ||
|
||
@event | ||
Scenario: An inconclusive test | ||
Given the request is valid | ||
When the booking request is made | ||
Then the booking test should be inconclusive |
346 changes: 346 additions & 0 deletions
346
src/6.0/My.Test.Library.MsTest.Unit.Tests/Features/BookingService.feature.cs
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
src/6.0/My.Test.Library.MsTest.Unit.Tests/Features/RequestValidator.feature
This file contains 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,47 @@ | ||
Feature: RequestValidator | ||
**This is feature text** which supports markdown | ||
You can find some additional SpecFlow markdown documentation [here](https://docs.specflow.org/projects/specflow-livingdoc/en/latest/Generating/Markdown-and-Embedding-Images.html) | ||
![Image](https://cdn.britannica.com/87/189187-050-C6C16A3B/Smithsonian-Institution-building-Castle-1855.jpg?w=400&h=300&c=crop) | ||
|
||
@validation | ||
Scenario: Invalid booking name | ||
Given a request has been created | ||
And the request has an invalid first name | ||
When the validation request is made | ||
Then the validation request should fail | ||
And the error message should be "Please supply a valid first name" | ||
|
||
@validation | ||
@tickets | ||
Scenario: Invalid tickets requested | ||
Given a request has been created | ||
And the request contains 0 tickets | ||
When the validation request is made | ||
Then the validation request should fail | ||
And the error message should be "Please specify a number of tickets greater than zero" | ||
|
||
Scenario: Various request scenarios | ||
Given a request has been created | ||
And the first name is set to <first_name> with neither <unused_variable_1> nor <unused_variable_2> being used | ||
And the last name is set to <last_name> | ||
And the tickets requested are set to <number_of_tickets> | ||
When the validation request is made | ||
Then the validation request should succeed | ||
And there should be no error message | ||
|
||
Examples: | ||
| first_name | last_name | number_of_tickets | unused_variable_1 | unused_variable_2 | | ||
| John | Smith | 10 | 12 | 1 | | ||
| Paul | Jones | 15 | 13 | 1 | | ||
| Mary | Sue | 1 | 14 | 1 | | ||
| Alex | McCain | 1 | 15 | 1 | | ||
| Mary | Jones | 100 | 43 | 1 | | ||
| The | Emperor | 1 | 42 | 1 | | ||
| Cole | Stevens | 42 | 41 | 1 | | ||
| Jack | Smith | 5 | 40 | 1 | | ||
|
||
@tickets | ||
Scenario: An inconclusive test | ||
Given a request has been created | ||
When the validation request is made | ||
Then the validation test should be inconclusive |
Oops, something went wrong.