Esempio n. 1
0
        //Do test, output results to file.
        public static async Task runTest(Test currentTest)
        {
            //Get start time
            int startTime = seconds;

            Console.WriteLine("Test starting");
            //Do tests
            await testType(currentTest);

            Console.WriteLine("Test ending");
            //Get end time
            int endTime   = seconds;
            int timeDelta = endTime - startTime;

            if (results != null)
            {
                //Output results
                //Test
                results.WriteLine("Summary:");
                results.WriteLine("Current test: " + currentTest.ToString() + " " + currentTest.getTestName());
                //clm();

                try
                {
                    results.WriteLine("Input JSON:");
                    results.WriteLine(currentTest.getOperation().getJson().ToString());
                }
                catch (Exception)
                {
                    results.WriteLine("No JSON attached to this operation");
                }

                results.WriteLine("Input URI: " + currentTest.getOperation().getUri());

                //Expected value
                results.WriteLine("Expected result: " + currentTest.getExpectedResult());
                //clm();
                //Actual value
                results.WriteLine("Actual result: " + currentTest.getActualResult());
                //clm();
                //Time elapsed (in seconds)
                results.WriteLine("Time elapsed: " + timeDelta + "s");
                //clm();
                //Pass/Fail
                results.WriteLine("Test result: " + currentTest.result());
                results.WriteLine();
            }
        }
Esempio n. 2
0
        //Do test, output results to file.
        public static async Task runTest(Test currentTest)
        {
            //Get start time
            int startTime = seconds;

            Console.WriteLine("Test starting");
            //Do tests
            await testType(currentTest);

            Console.WriteLine("Test ending");
            //Get end time
            int endTime   = seconds;
            int timeDelta = endTime - startTime;

            if (results != null)
            {
                //Output results
                //Test
                results.Write(currentTest.ToString());
                clm();
                //Expected value
                results.Write(currentTest.getExpectedResult());
                clm();
                //Actual value
                results.Write(currentTest.getActualResult());
                clm();
                //Time elapsed (in seconds)
                results.Write(timeDelta);
                clm();
                //Pass/Fail
                results.Write(currentTest.result());
                //Carriage return (set up next line)
                results.WriteLine();
            }
            else
            {
                //TODOIF: Set this to something that doesn't print out all the goddamn time
                Console.WriteLine("Results file writer not initialized, cancelling output logging...");
            }
        }