Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sw-tester/bdd-transform-values
It helps to substitute tokens on Gherkin feature files from either Yaml or Json
https://github.com/sw-tester/bdd-transform-values
bdd gherkin java qa qa-automation
Last synced: about 10 hours ago
JSON representation
It helps to substitute tokens on Gherkin feature files from either Yaml or Json
- Host: GitHub
- URL: https://github.com/sw-tester/bdd-transform-values
- Owner: sw-tester
- License: apache-2.0
- Created: 2023-04-30T12:02:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-06-27T14:41:57.000Z (over 1 year ago)
- Last Synced: 2024-12-20T05:23:30.171Z (24 days ago)
- Topics: bdd, gherkin, java, qa, qa-automation
- Language: Java
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BDD-Transform-Values
## Introduction
This library when run as a maven plugin will transform values on feature files in Cucumber-JVM based
automation, and in some cases, this helps to substitute values, mostly for the commonly used data from yaml
files.## Objective
— no hard-coded test data in feature files within automation projects
— auto-generate date values (past or future) to stay relevant before test runs
## Requirement
[Maven](https://maven.apache.org/)
[Cucumber-JVM](https://cucumber.io/docs/installation/java/)
[Jayway's JsonPath()](https://github.com/json-path/JsonPath)
## Installation
Add this block to `pom.xml`
...
io.github.5v1988
bdd-transform-values-maven-plugin
1.0.3
transform-values
...
By default, this plugin will look for substituting values from the file: `token.yaml`.
Optionally, the file with a different name can also be passed as follows:
...
another-file.yaml
...
After adding this plugin dependency on `pom.xml`, along with surefire-plugin, `mvn test` either substitutes values from
yaml file by matching the path or auto-generate like in case of date values. Please also note that
it doesn't modify the original feature files, but the ones in build directory: `target`## Examples
`token.yaml`
```yaml
test-config:
url: https://test.com
account:
email: [email protected]
password: qa-test123!
name: Tommy
``````gherkin
Feature: Login feature@example1
Scenario: To verify that the user logins successfully [without plugin]
Given User opens the app url: "https://test.com"
When User enters account details: "[email protected]" and "qa-test123!"
Then User verifies the name as : "Tommy" and date as "06/26/2023"@example2
Scenario Outline: To verify that the user logins successfully [with plugin]
Given User opens the app url: "[ type: token, path: test-config.url ]"
When User enters account details: "" and ""
Then User verifies the name as : "" and date as "[ type: date, format: MM/dd/yyyy, delta: 0 ]"Examples:
| UserName | Password | Name |
| [ type: token, path: account.email ] | [ type: token, path: account.password ] | [ type: token, path: account.name ] |
```## Explanation
`[ type: token, path: account.name ]` => In this template, Jsonpath `account.name` gets
value `Tommy` from the yaml file`[ type: date, format: MM/dd/yyyy, delta: -1 ]` => Yesterday's date in `MM/dd/yyyy` format
`[ type: date, format: dd-MM-yyyy, delta: 1 ]` => Tomorrow's date in `dd-MM-yyyy` format
## To-Do
`[ type: random, format: mobile-number ]` => This template returns randomly generated mobile
number. other formats could be last-name, full-name, mobile-number, address-line-1 etc.## How to help
If you come across an issue while using this plugin, do help to file a bug [here](https://github.com/5v1988/bdd-transform-values/issues)