Complete the code to set a variable in the Pre-request Script.
pm.variables.set('[1]', '123');
The pm.variables.set function sets a variable by name. Here, the variable name should be a string like 'myVar'.
Complete the code to check the response status in the Tests script.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
The status code should be a number 200, not a string or other value.
Fix the error in the Pre-request Script to log the variable value.
console.log(pm.variables.[1]('myVar'));
The correct method to retrieve a variable value is get.
Fill both blanks to create a test that checks if response time is less than 500ms.
pm.test('Response time is fast', function () { pm.expect(pm.response.[1]).to.be.[2](500); });
Use pm.response.responseTime to get response time, and below to check it is less than 500.
Fill all three blanks to create a test that checks if JSON response has a key 'success' with value true.
pm.test('Response has success true', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).[2].[3](true); });
Access the key 'success' in JSON, then use to.equal(true) to check its value.