Skip to content

Commit

Permalink
Added MSUnit test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
gubpalma committed Apr 8, 2024
1 parent 5a55fff commit 207a804
Show file tree
Hide file tree
Showing 10 changed files with 1,160 additions and 6 deletions.
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

Large diffs are not rendered by default.

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
Loading

0 comments on commit 207a804

Please sign in to comment.