Search in sources :

Example 16 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesIT method compareDeleteResponseBadCode201Test.

@Test(groups = { "integration", "services", "httpdelete" }, description = "A negative integration test to verify the response code from a delete call")
public void compareDeleteResponseBadCode201Test() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 1);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 5);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.delete("posts/5", new Request(request)).assertEquals(201);
    // verify one issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 17 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesIT method checkGetParamsResponseContainsMultipleObjectDataTest.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the data from a get call")
public void checkGetParamsResponseContainsMultipleObjectDataTest() {
    Map<String, String> params = new HashMap<>();
    params.put("userId", "6");
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "1");
    responsePairs.put("id", "6");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/6", new Request(params)).assertContains(responsePairs);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) Test(org.testng.annotations.Test)

Example 18 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesIT method comparePatchResponseBadDataTest.

@Test(groups = { "integration", "services", "httppatch" }, description = "A negative integration test to verify the data from a patch call")
public void comparePatchResponseBadDataTest() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 1);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 4);
    JsonObject response = new JsonObject();
    response.addProperty("userId", 1);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.patch("posts/4", new Request(request)).assertEquals(response);
    // verify one issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 19 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesIT method compareGetParamsResponseCode200Test.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the response code from a get call")
public void compareGetParamsResponseCode200Test() {
    Map<String, String> params = new HashMap<>();
    params.put("userId", "6");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/", new Request(params)).assertEquals(200);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) Test(org.testng.annotations.Test)

Example 20 with Request

use of com.coveros.selenified.services.Request in project selenified by Coveros.

the class ServicesIT method comparePostResponseCode201Test.

@Test(groups = { "integration", "services", "httppost" }, description = "An integration test to verify the response code from a post call")
public void comparePostResponseCode201Test() {
    JsonObject request = new JsonObject();
    request.addProperty("title", "foo");
    request.addProperty("body", "bar");
    request.addProperty("userId", 2);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.post("posts/", new Request(request)).assertEquals(201);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Aggregations

Request (com.coveros.selenified.services.Request)198 Test (org.testng.annotations.Test)197 Call (com.coveros.selenified.services.Call)142 JsonObject (com.google.gson.JsonObject)115 HashMap (java.util.HashMap)102 File (java.io.File)32 JsonArray (com.google.gson.JsonArray)30 HTTP (com.coveros.selenified.services.HTTP)5 JsonParser (com.google.gson.JsonParser)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1