Bird
Raised Fist0
Testing Fundamentalstesting~20 mins

API test tools overview in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
API Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding API Testing Tools

Which of the following best describes the primary purpose of API testing tools?

ATo automate the testing of backend services by sending requests and validating responses
BTo create database schemas and manage data migrations
CTo monitor server hardware performance during peak loads
DTo verify the user interface elements and their responsiveness
Attempts:
2 left
💡 Hint

Think about what APIs do and what testing them involves.

❓ Predict Output
intermediate
2:00remaining
Output of a Postman Test Script

Consider this Postman test script snippet that checks if the response status is 200:

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

What will be the test result if the API response status is 404?

Testing Fundamentals
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
ATest passes because the script only checks for status existence
BTest fails because the response status is not 200
CTest throws a syntax error due to missing semicolon
DTest is skipped because 404 is a valid response
Attempts:
2 left
💡 Hint

Check what the assertion is verifying exactly.

❓ locator
advanced
2:00remaining
Choosing the Best Locator for API Endpoint Testing

When configuring an API test in a tool like SoapUI or Postman, which of the following is the best practice for specifying the API endpoint URL?

AHardcode the full URL including query parameters directly in the test script
BUse relative file paths to locate the API endpoint on the local machine
CUse environment variables or configuration files to store the base URL and append endpoints dynamically
DEmbed the API endpoint inside the request body as a string
Attempts:
2 left
💡 Hint

Think about flexibility and maintainability in tests.

❓ assertion
advanced
2:00remaining
Validating JSON Response Content

Given an API response JSON: {"user":{"id":123,"name":"Alice"}}, which Postman test assertion correctly verifies that the user's name is 'Alice'?

Apm.expect(pm.response.json().user.name).to.eql('Alice');
Bpm.expect(pm.response.json().user['id']).to.eql('Alice');
Cpm.expect(pm.response.text()).to.include('user.name: Alice');
Dpm.expect(pm.response.json().user.name).to.be.undefined;
Attempts:
2 left
💡 Hint

Focus on accessing the correct JSON property and comparing its value.

❓ framework
expert
3:00remaining
Choosing the Right API Testing Framework for Automation

You need to automate API tests for a RESTful service with complex authentication and data-driven scenarios. Which framework choice below best supports this need?

AUse a simple HTTP client library without test assertions or reporting features
BUse manual testing with Postman collections only, without automation
CUse a UI testing framework like Selenium to automate API calls through the browser
DUse a dedicated API testing framework like REST-assured (Java) or pytest with requests (Python) that supports assertions, authentication, and data-driven tests
Attempts:
2 left
💡 Hint

Consider automation, authentication, and data-driven testing support.

Practice

(1/5)
1. Which of the following is a popular tool used for manual API testing with a user-friendly interface?
easy
A. Selenium
B. JUnit
C. Postman
D. JMeter

Solution

  1. Step 1: Identify tools for API testing

    Postman is widely known as a manual API testing tool with a graphical interface.
  2. Step 2: Differentiate from other tools

    JUnit is for unit testing, Selenium for UI testing, and JMeter for performance testing, not primarily manual API testing.
  3. Final Answer:

    Postman -> Option C
  4. Quick Check:

    Manual API testing tool = Postman [OK]
Hint: Postman = manual API testing with GUI [OK]
Common Mistakes:
  • Confusing JUnit as an API testing tool
  • Thinking Selenium is for API testing
  • Assuming JMeter is mainly for API functional testing
2. Which command-line tool is commonly used to send HTTP requests for API testing?
easy
A. docker
B. npm
C. git
D. curl

Solution

  1. Step 1: Identify command-line tools related to HTTP requests

    curl is a command-line tool designed to send HTTP requests and test APIs.
  2. Step 2: Exclude unrelated tools

    npm manages Node.js packages, git manages source code, and docker manages containers, none are for HTTP requests.
  3. Final Answer:

    curl -> Option D
  4. Quick Check:

    Command-line HTTP tool = curl [OK]
Hint: curl sends HTTP requests from terminal [OK]
Common Mistakes:
  • Confusing npm with API testing
  • Thinking git can send HTTP requests
  • Assuming docker is for API calls
3. Consider this REST-assured Java code snippet for API testing:
given().when().get("https://api.example.com/users/1").then().statusCode(200);

What does this test check?
medium
A. The API returns status code 200 for user with ID 1
B. The API returns a list of all users
C. The API creates a new user
D. The API returns status code 404 for user with ID 1

Solution

  1. Step 1: Analyze the HTTP method and URL

    The code uses GET on endpoint /users/1, which typically fetches user with ID 1.
  2. Step 2: Check the assertion on status code

    The test expects the response status code to be 200, meaning success.
  3. Final Answer:

    The API returns status code 200 for user with ID 1 -> Option A
  4. Quick Check:

    GET /users/1 expects 200 = The API returns status code 200 for user with ID 1 [OK]
Hint: GET + statusCode(200) means successful fetch [OK]
Common Mistakes:
  • Thinking it creates a user (POST needed)
  • Assuming it fetches all users (no list endpoint)
  • Confusing 404 with 200 status code
4. You wrote this curl command to test an API:
curl -X GET https://api.example.com/data -d '{"id":5}'

What is wrong with this command?
medium
A. GET requests should not have a request body (-d option)
B. The URL is missing the protocol
C. The HTTP method should be POST, not GET
D. The JSON data is missing a closing brace

Solution

  1. Step 1: Understand HTTP GET request rules

    GET requests usually do not have a body; sending data with -d is ignored or causes errors.
  2. Step 2: Check other parts of the command

    The URL includes protocol https://, JSON is properly closed, and GET is valid method for fetching data.
  3. Final Answer:

    GET requests should not have a request body (-d option) -> Option A
  4. Quick Check:

    GET with body (-d) is invalid [OK]
Hint: GET requests don't send data in body (-d) [OK]
Common Mistakes:
  • Thinking URL lacks protocol
  • Assuming POST is required here
  • Missing JSON brace (actually present)
5. You want to automate API tests that check multiple endpoints with different HTTP methods and validate JSON responses. Which tool is best suited for this task?
hard
A. Postman manual runner
B. REST-assured
C. curl command line only
D. Browser developer tools

Solution

  1. Step 1: Identify automation needs

    Testing multiple endpoints with various HTTP methods and validating JSON requires scripting and assertions.
  2. Step 2: Match tool capabilities

    REST-assured is a Java library designed for automated API testing with rich validation support.
  3. Step 3: Exclude less suitable tools

    Postman manual runner is not fully automated, curl lacks built-in assertions, and browser tools are for debugging, not automation.
  4. Final Answer:

    REST-assured -> Option B
  5. Quick Check:

    Automated API testing with assertions = REST-assured [OK]
Hint: REST-assured = automated API tests with assertions [OK]
Common Mistakes:
  • Choosing Postman manual runner for automation
  • Using curl without assertion support
  • Relying on browser tools for automated tests
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard