Beispiel #1
0
 /*
  * ----< Function > TestCompleteLogLevelOne
  * ----< Description >
  * Display DLL path, function tested, and if it passed / failed.
  * ----< Description >
  * @Param completedTestFunction complete -- C# object that describes the completed test
  * @Return None
  */
 private void TestCompleteLogLevelOne(completedTestFunction complete)
 {
     AddSeparators();
     loggingDisplay = loggingDisplay + "Completed Test: \n";
     loggingDisplay = loggingDisplay + "Path: " + complete.DllPath + "\n";
     loggingDisplay = loggingDisplay + "Function: " + complete.FuncName + "\n";
     loggingDisplay = loggingDisplay + "Pass: " + complete.Result;
     AddSeparators();
     ReloadSV();
 }
Beispiel #2
0
 /*
  * ----< Function > TestCompleteLogLevelThree
  * ----< Description >
  * Display DLL path, function tested, if it passed/failed, exception, start time and end time of test.
  * ----< Description >
  * @Param completedTestFunction complete -- C# object that describes the completed test
  * @Return None
  */
 private void TestCompleteLogLevelThree(completedTestFunction complete)
 {
     AddSeparators();
     loggingDisplay = loggingDisplay + "Completed Test: \n";
     loggingDisplay = loggingDisplay + "Path: " + complete.DllPath + "\n";
     loggingDisplay = loggingDisplay + "Function: " + complete.FuncName + "\n";
     loggingDisplay = loggingDisplay + "Pass: "******"\n";
     loggingDisplay = loggingDisplay + "Exception: " + complete.Exception + "\n";
     loggingDisplay = loggingDisplay + "Start Time: " + complete.StartTime + "\n";
     loggingDisplay = loggingDisplay + "End Time: " + complete.EndTime;
     AddSeparators();
     ReloadSV();
 }
Beispiel #3
0
        /*
         * ----< Function > GetResultsAsync
         * ----< Description >
         * For all test function ID's that have been sent this function will asynchronously
         * reach out to the endpoint /cse687/results ; sending an ID ; and receiving back a
         * JSON object containing the test results for that function.
         * ----< Description >
         * @Param GuiLogger logger -- Logger to write the data to in the GUI
         * @Return void
         */
        public static async void GetResultsAsync(GuiLogger logger)
        {
            foreach (int ID in functionsIDsSent)
            {
                JObject jsonOfIDs = new JObject
                {
                    { "ID", ID }
                };
                HttpResponseMessage httpResponseMessage = new HttpResponseMessage();
                try
                {
                    while (true)
                    {
                        HttpClient        httpClient = new HttpClient();
                        Uri               uri        = new Uri("http://www.kaminfay.com/cse687/results");
                        HttpStringContent content    = new HttpStringContent(jsonOfIDs.ToString());
                        httpResponseMessage = await httpClient.PostAsync(uri, content);

                        if (httpResponseMessage.IsSuccessStatusCode)
                        {
                            string httpResponseBody = await httpResponseMessage.Content.ReadAsStringAsync();

                            if (httpResponseBody != "nil")
                            {
                                completedTestFunction complete = JSONParser.jsonToCompleted(httpResponseBody);
                                Debug.WriteLine(httpResponseBody);
                                logger.TestCompleteLog(complete);
                                break;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    return;
                }
            }

            functionsIDsSent.Clear();
        }
Beispiel #4
0
        /*
         * ----< Function > TestCompleteLog
         * ----< Description >
         * Switch case for which logging level to use on the current completedTestFunction
         * ----< Description >
         * @Param completedTestFunction complete -- C# object that describes the completed test
         * @Return None
         */
        public void TestCompleteLog(completedTestFunction complete)
        {
            switch (currentLevel)
            {
            case 1:
                TestCompleteLogLevelOne(complete);
                break;

            case 2:
                TestCompleteLogLevelTwo(complete);
                break;

            case 3:
                TestCompleteLogLevelThree(complete);
                break;

            default:
                Debug.WriteLine("Not A valid log Level.");
                break;
            }
        }
Beispiel #5
0
        /*
         * ----< Function > jsonToCompleted
         * ----< Description >
         * Static function that will convert a JSON string to a completedTestFunction object
         * ----< Description >
         * @Param string jsonString -- string containing JSON data.
         * @return completedTestFunction -- C# object containing the data of a completed test.
         */
        public static completedTestFunction jsonToCompleted(string jsonString)
        {
            completedTestFunction completedFunction = JsonConvert.DeserializeObject <completedTestFunction>(jsonString);

            return(completedFunction);
        }