Skip to content

REST Assured Basics - Lab 4

1. Deleting a simulation

Steps

  1. In the SimulationsTest class, create a test method named shouldDeleteExistingSimulation()
  2. Add a precondition (given()) and set the CPF to delete using the pathParam() method
  3. Add the action using the delete() method to /simulations/{cpf}
  4. Add the assertion (then()) in the statusCode as 204 no content
  5. Run the test

Expected results

  • Green test execution where the following verifications will be performed successfully
    • status code

Solution

Click to see...
@Test
void shouldDeleteExistingSimulation() {
    given()
        .pathParam("cpf", "66414919004")
    .when()
        .delete("/simulations/{cpf}")
    .then()
        .statusCode(HttpStatus.SC_NO_CONTENT);
}