Пример #1
0
        public void getRequest(string url)
        {
            unirest_net.http.HttpResponse <string> jsonResponse = unirest_net.http.Unirest.get(url).asString();
            ExtentReprts extRept = new ExtentReprts();

            extRept.reportSetup("GetTest.html");
            extRept.createTest("Get Test");
            extRept.logReportStatement(AventStack.ExtentReports.Status.Pass, jsonResponse.Body.ToString());
            extRept.flushReport();
        }
Пример #2
0
        public void putRequest(string url, object body)
        {
            ExtentReprts extRept = new ExtentReprts();

            unirest_net.http.HttpResponse <string> response = unirest_net.http.Unirest.put(url).body(body).asString();
            extRept.reportSetup("PutTest.html");
            extRept.createTest("Put Test");
            extRept.logReportStatement(AventStack.ExtentReports.Status.Pass, response.Body.ToString());
            extRept.flushReport();
        }
Пример #3
0
        public void deleteRequest(string url)
        {
            ExtentReprts extRept = new ExtentReprts();

            unirest_net.http.HttpResponse <string> jsonResponse = unirest_net.http.Unirest.delete(url).asString();
            extRept.reportSetup("DeleteTest.html");
            extRept.createTest("Delete Test");
            extRept.logReportStatement(AventStack.ExtentReports.Status.Pass, jsonResponse.Code.ToString());
            extRept.flushReport();
        }
        public void getRequest(string url)
        {
            ExtentReprts  extRept  = new ExtentReprts();
            var           client   = new RestClient(url);
            var           request  = new RestRequest("", Method.GET);
            IRestResponse response = client.Execute(request);

            extRept.reportSetup("GetTest.html");
            extRept.createTest("Get Test");
            extRept.logReportStatement(AventStack.ExtentReports.Status.Pass, response.Content);
            extRept.flushReport();
        }
Пример #5
0
        public void putRequest(string url, object body)
        {
            ExtentReprts extRept = new ExtentReprts();
            var          client  = new RestClient(url);
            var          request = new RestRequest("", Method.PUT);

            request.RequestFormat = DataFormat.Json;
            request.AddJsonBody(body);

            client.Execute(request);
            IRestResponse response = client.Execute(request);

            extRept.reportSetup("PutTest.html");
            extRept.createTest("Put Test");
            extRept.logReportStatement(AventStack.ExtentReports.Status.Pass, response.Content);
            extRept.flushReport();
        }