Skip to content

Serenity BDD using Maven Ecllipse Execution #2636

Answered by wakaleo
Swati-123276 asked this question in Q&A
Discussion options

You must be logged in to vote
    @Test
    public void shouldReadCountryDataFromAnExistingCountry() {
        Response response = SerenityRest.get("https://restcountries.com/v3.1/name/india");
        System.out.println(response.prettyPrint());
        assertThat(response.jsonPath().getString("name.official[0]")).isEqualTo("Republic of India");
    }

    @Test
    public void shouldReturn404IfNoMatchingCountryIsFound() {
        Response response = SerenityRest.get("https://restcountries.com/v3.1/name/xyx");
        System.out.println(response.prettyPrint());
        assertThat(response.statusCode()).isEqualTo(404);
        assertThat(response.jsonPath().getString("message")).isEqualTo("Not Found");
    }

But print…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Swati-123276
Comment options

Comment options

You must be logged in to vote
2 replies
@Swati-123276
Comment options

@Swati-123276
Comment options

Answer selected by wakaleo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants