Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Пишем первый тест на создание Pet #2

Description

@eroshenkoam
        final RequestSpecification spec = new RequestSpecBuilder()
                .setBaseUri("https://petstore.swagger.io/v2")
                .addHeader("Accept", "application/json")
                .addHeader("Content-Type", "application/json")
                .build();

        final Pet pet = new Pet()
                .setName("chappy")
                .setStatus("available");

        // @formatter:off
        final Pet created = given().spec(spec).body(pet)
        .when()
            .post("/pet")
        .then()
            .extract()
            .as(Pet.class);

        given().spec(spec)
        .when()
            .get("/pet/{id}", created.getId())
        .then()
            .statusCode(200)
            .body("name", equalTo(pet.getName()));
        // @formatter:on
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions