Junior — Middle
Milliseid meetodeid või operatsioone kasutate kõige sagedamini oma töös REST Assured'is?
sobes.tech AI
Vastus AI-lt
When working with REST Assured, I most often use the following methods:
given()— to configure the request (headers, parameters, body).when()— to specify the HTTP method and endpoint (e.g., GET, POST).then()— to verify the response (status code, body, headers).
Example of usage:
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
given()
.header("Content-Type", "application/json")
.body("{\"name\": \"John\"}")
.when()
.post("/users")
.then()
.statusCode(201)
.body("name", equalTo("John"));
I also frequently use methods for working with query parameters (queryParam), authentication (auth()), and logging (log().all()).