diff --git a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/glue/CustomStepsDefinition.java b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/glue/CustomStepsDefinition.java index 5bdbdce..daeadd8 100644 --- a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/glue/CustomStepsDefinition.java +++ b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/glue/CustomStepsDefinition.java @@ -9,7 +9,12 @@ /** * Glue code of your applications. Use this class to create your own - * step definitions or cucumber hooks. + * step definitions or cucumber hooks. For more info check: + * https://cucumber.io/docs/cucumber/step-definitions/ + * https://cucumber.io/docs/cucumber/api/#hooks + * + * For more info on how to create your own steps, you can check: + * https://github.com/veepee-oss/gingerspec/wiki/Creating-your-own-steps */ public class CustomStepsDefinition extends BaseGSpec { diff --git a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/CucumberRunnerIT.java b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/CucumberRunnerIT.java index 12ff15a..f1752b8 100644 --- a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/CucumberRunnerIT.java +++ b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/CucumberRunnerIT.java @@ -5,11 +5,10 @@ /** - * This is an example on how to call an specific feature to be executed. + * This is the runner class responsible of running the included *.feature files in the project. * Glue files can be specified in the {@link CucumberOptions} annotation * - * Check out the utils.BaseTest class, there you can create TestNG hooks - * and more :) + * Also check out the {@link BaseTest} class, there you can create TestNG hooks and more :) */ @CucumberOptions(plugin = { "json:target/CucumberRunnerIT.json", diff --git a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/TestRunnerIT.java b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/TestRunnerIT.java index fbc9a3a..1507277 100644 --- a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/TestRunnerIT.java +++ b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/runners/TestRunnerIT.java @@ -8,6 +8,9 @@ /** * This is an example of a simple TestNG test. For more information, you can check * https://testng.org/doc/ + * + * For more info on how to run your TestNG tests directly in Intellij IDEA check: + * https://github.com/veepee-oss/gingerspec/wiki/Setting-up-your-IDE#running-testng-test */ public class TestRunnerIT { diff --git a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/utils/BaseTest.java b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/utils/BaseTest.java index 18505f1..8f033de 100644 --- a/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/utils/BaseTest.java +++ b/src/main/resources/archetype-resources/src/test/java/__groupId__/__artifactId__/utils/BaseTest.java @@ -9,7 +9,7 @@ import java.lang.reflect.Method; /** - * Use this class to define your own TestNG hooks + * Use this class to define your own TestNG hooks. For more info on TestNG hooks check: * https://testng.org/doc/documentation-main.html#annotations */ abstract public class BaseTest extends BaseGTest { diff --git a/src/main/resources/archetype-resources/src/test/resources/features/rest_example.feature b/src/main/resources/archetype-resources/src/test/resources/features/rest_example.feature index 9d31a1d..6f22fa8 100644 --- a/src/main/resources/archetype-resources/src/test/resources/features/rest_example.feature +++ b/src/main/resources/archetype-resources/src/test/resources/features/rest_example.feature @@ -1,36 +1,23 @@ @rest -Feature: Testing a RestFull API +Feature: Testing a RestFull API example - 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 is an example of how to use the provided Rest steps of GingerSpec to test an API. For a + complete list of all steps, check https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#rest-steps - 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 run this feature directly in Intellij IDEA, for more info check: + https://github.com/veepee-oss/gingerspec/wiki/Setting-up-your-IDE#running-cucumber-test + Or by running the following command in the terminal: 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 + This example uses https://jsonplaceholder.typicode.com, Fake Online REST API for Testing and Prototyping - Scenario: A successful response with a valid body is returned + Scenario: Check 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 + Scenario: Send a POST request with body example Given I securely send requests to 'jsonplaceholder.typicode.com:443' When I send a 'POST' request to '/posts' with body """ @@ -42,5 +29,16 @@ Feature: Testing a RestFull API """ Then the service response status must be '201' + Scenario: Send a POST request with body from file + 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 \ No newline at end of file diff --git a/src/main/resources/archetype-resources/src/test/resources/features/selenium_example.feature b/src/main/resources/archetype-resources/src/test/resources/features/selenium_example.feature index 2296683..eb6b059 100644 --- a/src/main/resources/archetype-resources/src/test/resources/features/selenium_example.feature +++ b/src/main/resources/archetype-resources/src/test/resources/features/selenium_example.feature @@ -1,14 +1,12 @@ @web Feature: Testing basic functionality of a web page - The @web annotation is responsible of initializing the driver. Read more here: - https://github.com/veepee-oss/gingerspec/wiki/Running-Selenium-tests + This is an example of how to use the provided Selenium steps of GingerSpec to perform actions on a web page. For a + complete list of all steps, check https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#selenium-steps - 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 run this feature directly in Intellij IDEA, for more info check: + https://github.com/veepee-oss/gingerspec/wiki/Setting-up-your-IDE#running-cucumber-test + Or by running the following command in the terminal: mvn verify -Dcucumber.filter.tags="@web" Scenario: Fill the form and click the submit button Given I go to 'http://demoqa.com/text-box'