Gauge Random Data Project
Idea
To have a simple and easy-usable project for creating random data for http://gauge.org based on https://github.com/DiUS/java-faker.
Defining Variables
One can define variables, that can be referenced inside gauge scenarios.
All random data is generated by the java-faker library.
Depending on the gauge project configuration, variables are stored in different scopes.
Based on the gauge_clear_state_level
environment variable in a gauge project, the following scopes can be used
gauge_clear_state_level | scope |
---|---|
suite | getSuiteDataStore |
spec | getSpecDataStore |
scenario | getScenarioDataStore |
Available Steps
- Set a variable to a fixed value
* Set <variable> to <value>
- Create a string of length 8. String contains numbers and characters
* Create a string <variable>
- Create a string of custom length (max 36 characters long). String contains numbers and characters
* Create a string <variable> with length
- Create a string for a certain pattern/foramt
* Create a string as <variable> in format <format>
The format can be any string, for which the following replacements are applied
%s
- will be replaced with a lower case alphabetic character%S
- will be replaced with an upper case alphabetic character%d
- will be replaced with an one digit integer{n}
- is a suffix to any option above, wheren
is replaced with a number and indicates the length of the pattern ahead.
for example:
abc%S%S-%d%d
will result in a string like abcTR-24
or similar
%d{2}%S{2}
will create a string with two digits and two uppercase characters.
- Read in a file and store its content as a string with removed newlines.
Create <variable> from file <file>
Different Locale
As the faker library allows to use different locale, one can define the locale to use in the gauge project via the environment variable gauge.data.locale
. The available values are the locale that are mentioned on the faker homepage.