Service Virtualization

Expand all | Collapse all

How can we run a rest assured test in CA DevTest ?

  • 1.  How can we run a rest assured test in CA DevTest ?

    Posted 07-25-2018 08:36 AM

    I am planning to run a Rest-Assured test (which includes below code) in CA DevTest by using a java step in a application test and want to verify the response using Rest-Assured assertions.


    import org.testng.annotations.Test;
    import io.restassured.RestAssured;
    import io.restassured.http.Method;
    import io.restassured.response.Response;
    import io.restassured.specification.RequestSpecification;
    public class SimpleGetTest {
    public void GetWeatherDetails()
    // Specify the base URL to the RESTful web service
    // Get the Request Specification of the request that you want to sent to the server.
    // The server is specified by the Base URI that we have specified in the above step.
    RequestSpecification httpRequest = RestAssured.given();
    // Make a request to the server by specifying the method Type and the method URL. 
    // This will return the Response from the server. Store the response in a variable.
    Response response = httpRequest.request(Method.GET, "/Hyderabad");
    // Now let us print the body of the message to see what response we have received from the server
    String responseBody = response.getBody().asString();
    System.out.println("Response Body is =>  " + responseBody);


    I am not sure what are all jars files i need for that. Can anyone help. Thanks.



  • 2.  Re: How can we run a rest assured test in CA DevTest ?