0
0
Testing Fundamentalstesting~10 mins

API test tools overview in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a GET request using Postman.

Testing Fundamentals
pm.sendRequest({ method: '[1]', url: 'https://api.example.com/data' }, function (err, res) { console.log(res.json()); });
Drag options to blanks, or click blank then click option'
APUT
BPOST
CGET
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of GET for fetching data.
2fill in blank
medium

Complete the code to check the status code in a response using REST-assured (Java).

Testing Fundamentals
given().when().get("/users").then().statusCode([1]);
Drag options to blanks, or click blank then click option'
A200
B404
C500
D302
Attempts:
3 left
💡 Hint
Common Mistakes
Using 404 which means not found.
3fill in blank
hard

Fix the error in the Postman test script to assert the response status is 200.

Testing Fundamentals
pm.test("Status code is 200", function () { pm.response.to.have.status([1]); });
Drag options to blanks, or click blank then click option'
A200
B201
C404
D"OK"
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "OK" instead of number 200.
4fill in blank
hard

Fill both blanks to create a JSON body and send it with a POST request using REST-assured.

Testing Fundamentals
given().contentType("application/json").body([1]).when().post("/create").then().statusCode([2]);
Drag options to blanks, or click blank then click option'
A{"name":"John"}
B201
C200
D{"id":1}
Attempts:
3 left
💡 Hint
Common Mistakes
Using 200 instead of 201 for creation.
5fill in blank
hard

Fill all three blanks to extract a JSON field and assert its value in a Postman test script.

Testing Fundamentals
pm.test("Check user name", function () { let jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.eql([2]); pm.expect(pm.response.code).to.equal([3]); });
Drag options to blanks, or click blank then click option'
Auser.name
B"John"
C200
Dusername
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong JSON path or missing quotes around string.