Getting msg="ReferenceError: tv4 is not defined for k6 implementation in github actions

73 Views Asked by At

I am trying to perform a load test using k6 by converting Postman collection JSON files into k6 script files through GitHub Actions. However, during execution, But on execution I see the error in GitHub actions as

`time="2023-12-21T12:36:12Z" level=error msg="ReferenceError: tv4 is not defined\n\tat file:///github/workspace/k6-script.js:86:21(1)\n\tat test (file:///github/workspace/libs/shim/core.js:504:6(15))\n\tat post (file:///github/workspace/k6-script.js:85:14(61))\n\tat executePostrequest (file:///github/workspace/libs/shim/core.js:1253:11(22))\n\tat executeRequest (file:///github/workspace/libs/shim/core.js:1034:25(108))\n\tat file:///github/workspace/libs/shim/core.js:314:30(27)\n\tat file:///github/workspace/k6-script.js:38:19(39)\n" executor=constant-vus scenario=default source=stacktrace`

for schema validation using tv4 . Example:

pm.test("Schema validation", function(){
    var result = tv4.validateResult(pm.response.json(),schema);
    if(!result.valid){
        console.log(result)
    }
    pm.expect(result.valid).to.be.true;
})

How can i solve this issue?

How can we verify the json schema through tv4 in k6?

0

There are 0 best solutions below