Search in sources :

Example 6 with Request

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

the class ServicesIT method comparePutResponseCode200Test.

@Test(groups = { "integration", "services", "httpput" }, description = "An integration test to verify the response code from a put call")
public void comparePutResponseCode200Test() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 1);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 3);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.put("posts/3", new Request(request)).assertEquals(200);
    // 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)

Example 7 with Request

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

the class ServicesIT method checkPutResponseContainsSingleDataTest.

@Test(groups = { "integration", "services", "httpput" }, description = "An integration test to verify the data from a put call")
public void checkPutResponseContainsSingleDataTest() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 3);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 3);
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "3");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.put("posts/3", new Request(request)).assertContains(responsePairs);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 8 with Request

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

the class ServicesIT method compareDeleteResponseCode200Test.

@Test(groups = { "integration", "services", "httpdelete" }, description = "An integration test to verify the response code from a delete call")
public void compareDeleteResponseCode200Test() {
    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(200);
    // 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)

Example 9 with Request

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

the class ServicesIT method compareDeleteResponseDataTest.

@Test(groups = { "integration", "services", "delete" }, description = "An integration test to verify the data from a delete call")
public void compareDeleteResponseDataTest() {
    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(new JsonObject());
    // 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)

Example 10 with Request

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

the class ServicesIT method checkPatchResponseContainsSingleDataTest.

@Test(groups = { "integration", "services", "httppatch" }, description = "An integration test to verify the data from a patch call")
public void checkPatchResponseContainsSingleDataTest() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 4);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 4);
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "4");
    // 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)).assertContains(responsePairs);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) 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