Skip to content

Keystore

formatting...

Module contains step implementations for the Keystore task.

Decrement default with step

Decrement the integer value for key (with step 1) using the Keystore task.

If there is no value for key decrementing will start from 0. The new value is saved in variable.

See Keystore task documentation for more information.

Example

Given value for variable "counter" is "none"
Then decrement "counter_key" in keystore and save in variable "counter"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required

Get

Get a value for key using the Keystore task.

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "none"
Then get "foobar_key" from keystore and save in variable "foobar"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required

Get default

Get a value for key using the Keystore task.

If key does not exist in the keystore default_value will be used and will be set in the keystore to next iteration. default_value must be JSON serializable (string values must be single-quoted).

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "none"
Then get "foobar_key" from keystore and save in variable "foobar", with default value "{'hello': 'world'}"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required
default_value str

default value to use if value is missing in keystore

required

Get remove

Get a value for key using the Keystore task, then remove entry.

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "none"
Then get and remove "foobar_key" from keystore and save in variable "foobar"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required

Increment default with step

Increment the integer value for key (with step 1) using the Keystore task.

If there is no value for key incrementing will start from 0. The new value is saved in variable.

See Keystore task documentation for more information.

Example

Given value for variable "counter" is "none"
Then increment "counter_key" in keystore and save in variable "counter"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required

Pop

Pop a value for key using the Keystore task.

This task will block the scenario until there is a value in the keystore for key key, in other words it can be used to share and synchronize different scenarios.

See Keystore task documentation for more information.

Example

Scenario: push
    And value for variable "foobar" is "none"
    Then push "foobar_key" in keystore with value "foobar"

Scenario: pop
    And value for variable "foobar" is "none"
    Then pop "foobar_key" from keystore and save in variable "foobar"

Arguments

Name Type Description Default
key str

name of key

required
variable str

name of initialized variable to save keystore value in

required

Push

Push a value for key using the Keystore task.

value must be JSON serializable.

See Keystore task documentation for more information.

Example

Scenario: push
    And value for variable "foobar" is "none"
    Then push "foobar_key" in keystore with value "foobar"

Scenario: pop
    And value for variable "foobar" is "none"
    Then pop "foobar_key" from keystore and save in variable "foobar"

Arguments

Name Type Description Default
key str

name of key

required
value str

JSON serializable value to push to keystore

required

Push text

Push a value for key using the Keystore task.

value is specified via step text, and must be JSON serializable.

See Keystore task documentation for more information.

Example

Scenario: push
    And value for variable "foobar" is "none"
    Then push "foobar_key" in keystore with value
      """
      {
        "id": 1,
        "name": test
      }
      """

Scenario: pop
    And value for variable "foobar" is "none"
    Then pop "foobar_key" from keystore and save in variable "foobar"

Arguments

Name Type Description Default
key str

name of key

required

Remove

Remove key using the Keystore task.

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "hello"
Then set "foobar_key" in keystore with value "{{ foobar }}"
...
Then remove "foobar_key" from keystore

Arguments

Name Type Description Default
key str

name of key to remove

required

Set

Set a value for key using the Keystore task.

value must be JSON serializable (string values must be single-quoted).

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "{'hello': 'world'}"
Then set "foobar_key" in keystore with value "{{ foobar }} | render=True"

Arguments

Name Type Description Default
key str

name of key

required
value str

JSON serializable value to save in keystore

required

Set text

Set a value for key using the Keystore task.

value is specified via step text, and must be JSON serializable.

See Keystore task documentation for more information.

Example

And value for variable "foobar" is "{'hello': 'world'}"
Then set "foobar_key" in keystore with value
"""
{{ foobar }} | render=True
"""

Arguments

Name Type Description Default
key str

name of key

required