tracetest
tracetest copied to clipboard
Enable selectors to utilize variables
As a user, I may have selector names that include data based on ids or other dynamic data and want to be able to have a selector that incorporates variables, interprets them, and utilizes the final string as the selector.
A good way to see / reproduce this issue is to use the following test in our tracetest-demo org in the pokeshop-demo environment (join here). It takes the pokeshop_id as a parameter. In the selector, I need to be able to use the pokemon_id as a variable and not have it hardcoded (ie this needs to be dynamic based on the pokemon_id: name="del pokemon-9693")
Priority: low to medium - do as we have cycles as this came from an internal use case.
type: Test
spec:
id: delete-pokemon
name: Delete Pokemon
trigger:
type: http
httpRequest:
method: DELETE
url: https://demo-pokeshop.tracetest.io/pokemon/${env:pokemon_id}
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="general" name="Tracetest trigger"]
name: Delete returns a 200 status code
assertions:
- attr:tracetest.response.status = 200
- selector: span[tracetest.span.type="database" name="del pokemon-9693" db.system="redis" db.operation="del" db.redis.database_index="0"]
name: Ensure we are deleting from the redis cache also
assertions:
- attr:tracetest.selected_spans.count = 1