From 2fc048e335c7e961152f10ab36ed084d7d28cf92 Mon Sep 17 00:00:00 2001 From: Ivan Kalinin Date: Wed, 7 Dec 2022 15:27:34 +0300 Subject: [PATCH] [engine] Do not allow to overwrite default composite paths --- .../ROOT/pages/tests-configuration.adoc | 41 +++++++++++++++++++ .../resources/org/vividus/engine/spring.xml | 2 +- .../suite/failFast/suite.properties | 2 +- .../suite/integration/suite.properties | 2 +- .../properties/defaults/default.properties | 4 +- .../deprecated/depreacted.properties | 1 + 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/modules/ROOT/pages/tests-configuration.adoc b/docs/modules/ROOT/pages/tests-configuration.adoc index a726f4acd4..00ba6ceefb 100644 --- a/docs/modules/ROOT/pages/tests-configuration.adoc +++ b/docs/modules/ROOT/pages/tests-configuration.adoc @@ -107,6 +107,10 @@ NOTE: The properties marked with *bold* are mandatory. |`report.text-length-diff-threshold` |`100` |Defines text threshold length to enable unified diff report publishing on failure, for variable comparisons. If you want to have this report despite the size of the compared data set 0. + +|`engine.composite-paths` +| +|Paths to the composite steps e.g. `steps/*.steps` |=== === Profiles @@ -726,6 +730,43 @@ http.auth.password=ENC(WVnXhzG704KRZZFYL7hfpA4YoSm8V2F5eNXyr7CRYCichteHvNS3nB23z Please see <<_externalized_configuration>> to get more information about how encryptor password can be passed to the tests. +== Composite steps + +https://jbehave.org/reference/stable/composite-steps.html[Composite steps] allows to reuse set of actions via step with a custom wording. + +=== How to use composite steps + +. Define composite step: ++ +.Compsite step definition +[source,gherkin] +---- +Composite: When I login with username `$username` and password `$password` +When I enter `` in field located `id(username)` +When I enter `` in field located `id(password)` +When I click on element located `id(signInButton)` +---- + +. Configure composite paths ++ +.Compsite steps paths configuration +[source,gherkin] +---- +engine.composite-paths=steps/ui/*.steps +---- + +. Use your step in the story ++ +.Composite step usage example +[source,gherkin] +---- +Scenario: Verify login +Given I am on the main application page +When I login with username `admin` and password `pa$$w0rd` +---- + +TIP: Users are allowed to use composite steps in composite step definition. + == Steps aliases VIVIDUS allows to define set of aliases for steps in JSON format and then use them in stories. diff --git a/vividus-engine/src/main/resources/org/vividus/engine/spring.xml b/vividus-engine/src/main/resources/org/vividus/engine/spring.xml index c8f801312b..14fec4ab6f 100644 --- a/vividus-engine/src/main/resources/org/vividus/engine/spring.xml +++ b/vividus-engine/src/main/resources/org/vividus/engine/spring.xml @@ -55,7 +55,7 @@ - + diff --git a/vividus-tests/src/main/resources/properties/suite/failFast/suite.properties b/vividus-tests/src/main/resources/properties/suite/failFast/suite.properties index 8abbbab4d4..d2484d5ef9 100644 --- a/vividus-tests/src/main/resources/properties/suite/failFast/suite.properties +++ b/vividus-tests/src/main/resources/properties/suite/failFast/suite.properties @@ -4,4 +4,4 @@ batch-1.threads=2 batch-2.resource-location=story/integration/failFast batch-2.resource-include-patterns=Should not be executed.story -bdd.configuration.composite-paths=steps/*.steps +engine.composite-paths=steps/*.steps diff --git a/vividus-tests/src/main/resources/properties/suite/integration/suite.properties b/vividus-tests/src/main/resources/properties/suite/integration/suite.properties index 9c4fd09e9c..8a084ed5c9 100644 --- a/vividus-tests/src/main/resources/properties/suite/integration/suite.properties +++ b/vividus-tests/src/main/resources/properties/suite/integration/suite.properties @@ -1,6 +1,6 @@ csv.escape-char=\\ bdd.configuration.skip-story-if-given-story-failed=true -bdd.configuration.composite-paths=steps/*.steps +engine.composite-paths=steps/*.steps rest-api.http.cookie-store-level=scenario bdd.variables.global.examples-table-path=/data/tables/locales/ca/locale-based.table diff --git a/vividus/src/main/resources/properties/defaults/default.properties b/vividus/src/main/resources/properties/defaults/default.properties index 379c338659..cc462c2544 100644 --- a/vividus/src/main/resources/properties/defaults/default.properties +++ b/vividus/src/main/resources/properties/defaults/default.properties @@ -10,8 +10,8 @@ batch.fail-fast=false story.fail-fast=false scenario.fail-fast=false -bdd.configuration.all-composite-paths=${bdd.configuration.composite-paths},steps/defaults/*.steps -bdd.configuration.composite-paths= +bdd.configuration.all-composite-paths=${engine.composite-paths},steps/defaults/*.steps +engine.composite-paths= engine.alias-paths= bdd.configuration.formats= bdd.configuration.dry-run=false diff --git a/vividus/src/main/resources/properties/deprecated/depreacted.properties b/vividus/src/main/resources/properties/deprecated/depreacted.properties index e303cd665a..06fdd9d209 100644 --- a/vividus/src/main/resources/properties/deprecated/depreacted.properties +++ b/vividus/src/main/resources/properties/deprecated/depreacted.properties @@ -3,3 +3,4 @@ bdd.story.fail-fast=story.fail-fast bdd.scenario.fail-fast=scenario.fail-fast bdd.story-loader.batch-(\\d+)(.+)=batch-$1$2 bdd.batch-(\\d+)(.+)=batch-$1$2 +bdd.configuration.composite-paths=engine.composite-paths