Hi,
I wrote a function that accepts tag as parameter (variable “tagValue”) and I want to use it as value in check function. But it does not seem to work. After my test finishes, rate of threshold is 0%. But if I change the varible in tag to string (“Content” in my case), then threshold works ok. Am I doing something wrong or k6 does not support this?
export function checkFieldsExistence(res, fieldToCheck, tagValue) {
const checkResult = check(res, {
['Field check: ' + fieldToCheck]: (r) => r.body.includes(fieldToCheck),
}, { myTag: tagValue });
if (!checkResult) {
fail(
`Request did not return expected field: ${fieldToCheck} :: ${res.status} ${res.status_text} :: Body: ${res.body}`
);
}
}
Threshold definition
thresholds: {
'checks{myTag:Content}': ['rate>0.9'],
},
Thanks for any advice.