0
0
Postmantesting~10 mins

Testing pagination in Postman - Interactive Code Practice

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

Complete the code to set the page number in the request URL.

Postman
GET https://api.example.com/items?page=[1]
Drag options to blanks, or click blank then click option'
A1
Bpage
CpageNumber
Dpage_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using the parameter name instead of a number.
Using page size instead of page number.
2fill in blank
medium

Complete the test script to check if the response contains the correct page number.

Postman
pm.test('Page number is correct', () => {
  const jsonData = pm.response.json();
  pm.expect(jsonData.[1]).to.eql(2);
});
Drag options to blanks, or click blank then click option'
Apage
BpageNumber
CcurrentPage
Dpage_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'page_size' instead of the page number field.
Using a field that does not exist in the response.
3fill in blank
hard

Fix the error in the test script to correctly check the number of items returned per page.

Postman
pm.test('Items per page count', () => {
  const jsonData = pm.response.json();
  pm.expect(jsonData.items.length).to.eql([1]);
});
Drag options to blanks, or click blank then click option'
Aitems.length
B10
C'10'
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string '10' instead of number 10.
Using a property name instead of a number.
4fill in blank
hard

Fill both blanks to check if the response has the correct total pages and page size.

Postman
pm.test('Total pages and page size', () => {
  const jsonData = pm.response.json();
  pm.expect(jsonData.[1]).to.eql(5);
  pm.expect(jsonData.[2]).to.eql(10);
});
Drag options to blanks, or click blank then click option'
Atotal_pages
Bpage
Cpage_size
Ditems_count
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'page' with 'total_pages'.
Using 'items_count' instead of 'page_size'.
5fill in blank
hard

Fill all three blanks to verify the current page, total items, and items array length.

Postman
pm.test('Verify pagination details', () => {
  const jsonData = pm.response.json();
  pm.expect(jsonData.[1]).to.eql(3);
  pm.expect(jsonData.[2]).to.eql(50);
  pm.expect(jsonData.[3].length).to.eql(10);
});
Drag options to blanks, or click blank then click option'
Apage
Btotal_items
Citems
Dpage_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'page_size' instead of 'items' for the array.
Confusing 'total_pages' with 'total_items'.