I am new to REST-Api testing. i am getting started with Rest-Assured for Rest-Api testing. i am having an issue in my first ever testcase.

The code is as follows:

public void testGetSingleUser() {
          "email", equals("test@hascode.com"),
          "firstName", equals("Tim"),
          "lastName", equals("Testerman"),
          "id", equals("1")).

In this code the expect(). command is not working. I need to fix this issue quickly and move on.


Updated Answer

You have to import the RestAssured class incl. method as static.

import static com.jayway.restassured.RestAssured.expect;

Or you call the method on this way:


Useful Links

| improve this answer | |
  • equalsTo() is not working. equals() in working fine. The problem is that my expect() command is not working. I am using eclipse with rest-assured jar included. – Jarree Arham Shahid Oct 9 '14 at 7:20
  • @JarreeArhamShahid Can you put the exception into your question, to be more specific? Thank you. – Twaldigas Oct 9 '14 at 7:21
  • java.lang.Error: Unresolved compilation problem: The method expect() is undefined for the type RestTest – Jarree Arham Shahid Oct 9 '14 at 7:33
  • This is the failure trace. Its not working because the expect() in the code above has an error. Do i need to include any jars to make it work? – Jarree Arham Shahid Oct 9 '14 at 7:34
  • @JarreeArhamShahid Updated the answer. – Twaldigas Oct 9 '14 at 7:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.