I'm following this tutorial http://dextra.com.br/en/blog/automacao-de-api-rest-using-java-andrestassured/ to learn how to test api and when running presented the following error:
java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.callsite.CallSiteArray
I imported all the libraries that seemed necessary for the test, and it still does not work.
package br.com.automation.APIRest;
import static io.restassured.RestAssured.*;
import io.restassured.http.ContentType;
import static org.hamcrest.Matchers.*;
import org.junit.Test;
public class TestAPI {
@Test
public void Teste() {
String uriBase = "https://postman-echo.com/get";
given()
.relaxedHTTPSValidation()
.param("foo1", "bar1")
.param("foo2", "bar2")
.when()
.get(uriBase)
.then()
.statusCode(200) // O status http retornado foi 200
.contentType(ContentType.JSON) // O response foi retornado no formato JSON
.body("headers.host", is("postman-echo.com")) // A chave "host" possui exatamente o valor "postman-echo.com"
.body("args.foo1", containsString("bar")); //A chave "foo1" contém o valor "bar"
}
}
jars

Aucun commentaire:
Enregistrer un commentaire