-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated GingerSpec dependency to 2.2.1. Upgraded version in pom for 1…
….15 release. Fixed formating of feature files and added new example scenario
- Loading branch information
jose.fernandez
committed
Apr 13, 2021
1 parent
de8ff90
commit fbf687d
Showing
4 changed files
with
71 additions
and
59 deletions.
There are no files selected for viewing
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
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
74 changes: 43 additions & 31 deletions
74
src/main/resources/archetype-resources/src/test/resources/features/rest_example.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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
@rest | ||
Feature: Testing a RestFull API | ||
|
||
The @rest annotation is necessary when using GingerSpec Rest steps, here is why: | ||
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#rest-tag | ||
|
||
This example uses https://jsonplaceholder.typicode.com, Fake Online REST API for Testing and Prototyping | ||
|
||
Execute this test like this: | ||
mvn verify -Dcucumber.filter.tags="@rest" | ||
|
||
You can check a more complete list of steps and examples at: | ||
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#rest-steps | ||
|
||
Scenario: A successful response with a valid body is returned | ||
Given I securely send requests to 'jsonplaceholder.typicode.com:443' | ||
When I send a 'GET' request to '/posts' | ||
Then the service response status must be '200' | ||
And I save element '$.[0].userId' in environment variable 'USER_ID' | ||
Then '${USER_ID}' matches '1' | ||
|
||
Scenario: Data in local file is altered using a datatable before sending | ||
Given I securely send requests to 'jsonplaceholder.typicode.com:443' | ||
When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json' with: | ||
| $.title | UPDATE | This is a test 2 | | ||
Then the service response status must be '201' | ||
And I save element '$' in environment variable 'response' | ||
And 'response' matches the following cases: | ||
| $.title | contains | 2 | | ||
| $.body | contains | This is a test | | ||
| $.userId | not equal | 2 | | ||
|
||
Scenario: This is an example of a custom REST step | ||
Given I verify that a successful response with a valid body is returned | ||
The @rest annotation is necessary when using GingerSpec Rest steps, here is why: | ||
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#rest-tag | ||
|
||
This example uses https://jsonplaceholder.typicode.com, Fake Online REST API for Testing and Prototyping | ||
|
||
Execute this test like this: | ||
mvn verify -Dcucumber.filter.tags="@rest" | ||
|
||
You can check a more complete list of steps and examples at: | ||
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#rest-steps | ||
|
||
Scenario: A successful response with a valid body is returned | ||
Given I securely send requests to 'jsonplaceholder.typicode.com:443' | ||
When I send a 'GET' request to '/posts' | ||
Then the service response status must be '200' | ||
And I save element '$.[0].userId' in environment variable 'USER_ID' | ||
Then '${USER_ID}' matches '1' | ||
|
||
Scenario: Data in local file is altered using a datatable before sending | ||
Given I securely send requests to 'jsonplaceholder.typicode.com:443' | ||
When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json' with: | ||
| $.title | UPDATE | This is a test 2 | | ||
Then the service response status must be '201' | ||
And I save element '$' in environment variable 'response' | ||
And 'response' matches the following cases: | ||
| $.title | contains | 2 | | ||
| $.body | contains | This is a test | | ||
| $.userId | not equal | 2 | | ||
|
||
Scenario: Add the body to be sent directly | ||
Given I securely send requests to 'jsonplaceholder.typicode.com:443' | ||
When I send a 'POST' request to '/posts' with body | ||
""" | ||
{ | ||
"userId": 1, | ||
"title": "This is a test", | ||
"body": "This is a test" | ||
} | ||
""" | ||
Then the service response status must be '201' | ||
|
||
Scenario: This is an example of a custom REST step | ||
Given I verify that a successful response with a valid body is returned |
52 changes: 26 additions & 26 deletions
52
src/main/resources/archetype-resources/src/test/resources/features/selenium_example.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 |
---|---|---|
@@ -1,34 +1,34 @@ | ||
@web | ||
Feature: Testing basic functionality of a web page | ||
|
||
The @web annotation is necessary to be included when working with selenium, here is why: | ||
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#web-tag | ||
The @web annotation is responsible of initializing the driver. Read more here: | ||
https://github.com/veepee-oss/gingerspec/wiki/Running-Selenium-tests | ||
|
||
You can run this feature using the following command: | ||
mvn verify -Dcucumber.filter.tags="@web" | ||
You can run this feature using the following command: | ||
mvn verify -Dcucumber.filter.tags="@web" | ||
|
||
You can check a more complete list of selenium steps and examples at: | ||
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#selenium-steps | ||
You can check a more complete list of selenium steps and examples at: | ||
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#selenium-steps | ||
|
||
Scenario: Fill the form and click the submit button | ||
Given I go to 'http://demoqa.com/text-box' | ||
And I type 'John' on the element with 'id:userName' | ||
And I type 'john.smith@email.com' on the element with 'id:userEmail' | ||
And I type '123 fake address' on the element with 'id:currentAddress' | ||
When I scroll down until the element with 'id:submit' is visible | ||
And I click on the element with 'id:submit' | ||
Then at least '1' elements exists with 'id:output' | ||
Scenario: Fill the form and click the submit button | ||
Given I go to 'http://demoqa.com/text-box' | ||
And I type 'John' on the element with 'id:userName' | ||
And I type 'john.smith@email.com' on the element with 'id:userEmail' | ||
And I type '123 fake address' on the element with 'id:currentAddress' | ||
When I scroll down until the element with 'id:submit' is visible | ||
And I click on the element with 'id:submit' | ||
Then at least '1' elements exists with 'id:output' | ||
|
||
Scenario: Interacting with radio buttons and doing double click | ||
Given I go to 'http://demoqa.com/radio-button' | ||
And I click on the element with 'xpath://input[@id='yesRadio']/following-sibling::label' | ||
And at least '1' elements exists with 'id:yesRadio' | ||
And the element on index '0' IS selected | ||
And I wait '3' seconds | ||
Given I go to 'http://demoqa.com/buttons' | ||
And I double click on the element with 'id:doubleClickBtn' | ||
And I right click on the element with 'id:rightClickBtn' | ||
And I click on the element with 'xpath://button[.='Click Me']' | ||
Scenario: Interacting with radio buttons and doing double click | ||
Given I go to 'http://demoqa.com/radio-button' | ||
And I click on the element with 'xpath://input[@id='yesRadio']/following-sibling::label' | ||
And at least '1' elements exists with 'id:yesRadio' | ||
And the element on index '0' IS selected | ||
And I wait '3' seconds | ||
Given I go to 'http://demoqa.com/buttons' | ||
And I double click on the element with 'id:doubleClickBtn' | ||
And I right click on the element with 'id:rightClickBtn' | ||
And I click on the element with 'xpath://button[.='Click Me']' | ||
Scenario: This is an example of a custom Selenium step | ||
Given Fill the form and click the submit button | ||
Scenario: This is an example of a custom Selenium step | ||
Given Fill the form and click the submit button |