Example #1
0
        public static void AddTestInfo(string url, string requestService, string method, IDictionary <string, string> headers, IDictionary <string, string> cookies, IDictionary <string, string> parameters, string jsonBody, bool httpBasicAuthenticator, bool ntlmAuthenticator, IRestResponse <dynamic> response)
        {
            string allHeaders         = null;
            string allCookies         = null;
            string allParameters      = null;
            string allResponseHeaders = null;

            foreach (var parameter in parameters)
            {
                allParameters = allParameters + "\n" + "<i>" + parameter.Key + "</i>" + " = " + parameter.Value;
            }

            foreach (var header in headers)
            {
                allHeaders = allHeaders + "\n" + "<i>" + header.Key + "</i>" + " = " + header.Value;
            }

            foreach (var cookie in cookies)
            {
                allCookies = allCookies + "\n" + "<i>" + cookie.Key + "</i>" + " = " + cookie.Value;
            }

            foreach (var responseHeader in response.Headers)
            {
                allResponseHeaders = allResponseHeaders + "\n" + responseHeader.ToString();
            }

            TEST.Log(Status.Info, "<pre>" + "<b>URL: </b>" + url + "</pre>");
            TEST.Log(Status.Info, "<pre>" + "<b>REQUEST: </b>" + requestService + "</pre>");
            TEST.Log(Status.Info, "<pre>" + "<b>METHOD: </b>" + method + "</pre>");

            if (allParameters != null)
            {
                TEST.Log(Status.Info, "<pre>" + "<b>PARAMETERS: </b>" + allParameters + "</pre>");
            }

            if (jsonBody != null)
            {
                TEST.Log(Status.Info, "<pre>" + "<b>JSON BODY: </b>" + "\n" + jsonBody + "</pre>");
            }

            if (allHeaders != null)
            {
                TEST.Log(Status.Info, "<pre>" + "<b>HEADERS: </b>" + allHeaders + "</pre>");
            }

            if (allCookies != null)
            {
                TEST.Log(Status.Info, "<pre>" + "<b>COOKIES: </b>" + allCookies + "</pre>");
            }

            if (httpBasicAuthenticator || ntlmAuthenticator)
            {
                TEST.Log(Status.Info, "<pre>" + "<b>AUTHENTICATOR: </b>" + "\n" + "<b>USER: </b>" + JsonBuilder.ReturnParameterAppSettings("AUTHENTICATOR_USER") + "\n" + "<b>PASSWORD: </b>" + JsonBuilder.ReturnParameterAppSettings("AUTHENTICATOR_PASSWORD") + " </pre>");
            }

            HttpStatusCode statusCode        = response.StatusCode;
            int            numericStatusCode = (int)statusCode;

            TEST.Log(Status.Info, "<pre>" + "<b>STATUS CODE: </b>" + numericStatusCode + " - " + response.StatusCode.ToString() + "</pre>");
            TEST.Log(Status.Info, "<pre>" + "<b>RESPONSE HEADERS: </b>" + allResponseHeaders + "</pre>");
            TEST.Log(Status.Info, "<pre>" + "<b>PAYLOAD: </b>" + "\n" + GeneralHelpers.FormatJson(response.Content) + "</pre>");
        }
Example #2
0
 public static void AddTestInfo(int methodLevel, string text)
 {
     TEST.Log(Status.Pass, GeneralHelpers.GetMethodNameByLevel(methodLevel) + " || " + text);
 }