Skip to content

Integer Incrementer

This variable provides an unique integer each time it is accessed.

Useful to generate unique ID for each request.

Format

The first value of an integer that is going to be used.

Arguments

  • step int, (optional) - how much the value should increment each time (default 1)

  • persist bool, (optional) - if the initial value should be persist and loaded from file (default False)

Example

example.feature
And value for variable "AtomicIntegerIncrementer.unique_id" is "100 | step=10"
And value for variable "AtomicIntegerIncrementer.persistent" is "10 | step=5, persist=True"

This can then be used in a template:

{
    "id": {{ AtomicIntegerIncrementer.unique_id }}
}

Values of AtomicIntegerIncrementer.unique_id, per run and iteration:

  1. Run

  2. 100

  3. 110

  4. 120

  5. ...

  6. Run

  7. 100

  8. 110

  9. 120

  10. ...

Values of AtomicIntegerIncrementer.persistent, per run and iteration:

  1. Run (features/persistent/example.json missing)

  2. 5

  3. 15

  4. 20

  5. ...

  6. Run (features/persistent/example.json created by Run 1, due to persistent=True), initial value 35 | step=5, persist=True will be read from the file and override what is written in example.feature

  7. 25

  8. 30

  9. 35

  10. ...

atomicintegerincrementer__base_type__

def atomicintegerincrementer__base_type__(value: Union[str, int]) -> str

[view_source]

Validate values that AtomicRandomInteger can be initialized with.