I have just set up rest assured framework and implemented it as a maven project. My pom.xml has the below mentioned dependencies

io.rest-assured rest-assured 3.0.2 test

io.rest-assured json-path 3.0.2

io.rest-assured json-schema-validator 3.0.2

io.rest-assured xml-path 3.0.2

org.testng testng 6.10 test

org.hamcrest java-hamcrest test

And my code looks like

import static io.restassured.RestAssured.*;

import org.testng.annotations.Test;

public class LrnAsServiceApis {

    public void trackvialrnumber() {


But when I run it as TestNg I get errorr like: 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?

  • 1
    Show us how you describe dependency in your pom.xml and how exactly you're trying to run your code. – Alexey R. Jun 5 '18 at 12:15
  • Alexey, I have described the dependencies in the question. I run it as a TestNG Test. – Rohan Kalia Jun 5 '18 at 12:34
  • Try to leave only "io.rest-assured rest-assured 3.0.2 test" and "org.testng testng 6.10 test" – Alexey R. Jun 5 '18 at 13:34
  • Doesn't work! Same errors. – Rohan Kalia Jun 5 '18 at 17:48
  • Is your code under main folder or under test folder? – Alexey R. Jun 5 '18 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.