I have just set up rest assured framework and implemented it as a maven project. My pom.xml has the below mentioned dependencies
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.0.2</version>
<scope>test</scope>
</dependency>
<!-- To parse json Document -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>3.0.2</version>
</dependency>
<!-- To validate that a json response conforms to a json schema -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>3.0.2</version>
</dependency>
<!-- To parse xml document -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>xml-path</artifactId>
<version>3.0.2</version>
</dependency>
<!-- Testing framework -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest Used for Regex -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
And my code looks like
import static io.restassured.RestAssured.*;
import org.testng.annotations.Test;
public class LrnAsServiceApis {
@Test
public void trackvialrnumber() {
given().get("lt-api.delta.com/v1/fulltrack/ABCD").then().log().all();
}
But when I run it as TestNg I get error: java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
And when I try to fix this by adding groovy all dependency I get another error:
java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpRequestBase
And when I add another dependency, I get another error and this becomes never ending and frustrating. Is it that cumbersome? How do I fix once and for all?