Student Expert - Skills Check

Hello,

I am sending the following request for the Skills Check:

var jsonData = JSON.parse(responseBody);

pm.test(‘Skills Check’, function () {

pm.environment.set(‘responseData’, jsonData.rand);

console.log(jsonData.rand)

})

I have also set the following Pre-Req script:
if(!pm.collectionVariables.get(“ResponseBody”)) pm.collectionVariables.set(“responseData”);

image

The test is passing but I am getting 400 error code.

Please could somebody point me in the right direction on how to resolve this? Any help with this will be very much appreciated.

Thanks,
Dan

1 Like

Hi @danpaul! At a glance your test script looks like it should work, I’m not sure what the purpose of your pre-request script is but I would remove that in case it’s resetting the value between runs because the request needs to send twice in a row to reference the value correctly after setting it.

Hello @suesmith, thanks for your help with this. I am now getting 200 response back.

Thanks,
Dan

1 Like