Write Tests


Write Tests

Objectives

  1. Learn how to write more tests
  2. Learn response.body JSON (value check). Example: pm.expect(JSON).to.eql(“Some value”);

Instruction:

  1. Using jsonplaceholder, create a new post with title “Hello” and body “World”. User id is 1
  2. Before sending the POST request, make sure you create the test for this request.
    1. Assert that the returned response has title = “Hello”, body = “World” and userId = 1. So three results in total.
    2. Make sure that you see a fail test first to avoid false positives
  3. Make a PUT request to update a post. Same with instruction #2, create the necessary tests for this request.

For more information about the jsonplaceholder, read the api documentation: https://jsonplaceholder.typicode.com/guide/