コード例 #1
0
 public virtual TestVerdict ItemComposeVerdict(TestVerdict exp_verdict,
                                               TestVerdict verdict)
 {
     try
     {
         TestVerdict realVerdict = this.TestComposeVerdict(exp_verdict, verdict
                                                           );
         this.WriteLine("EXP ITEM RESULT\t: " + TestVerdictString.GetValue(exp_verdict));
         this.WriteLine("ITEM RESULT\t: " + TestVerdictString.GetValue(verdict));
         this.WriteLine("ITEM VERDICT\t: " + TestVerdictString.GetValue(realVerdict));
         return(realVerdict);
     }
     catch (System.IO.IOException)
     {
         return(TestVerdict.Untested);
     }
 }
コード例 #2
0
 public virtual TestVerdict TestResult(string exp_result, string result,
                                       TestVerdict exp_verdict, TestVerdict verdict)
 {
     try
     {
         TestVerdict realVerdict = this.TestComposeVerdict(exp_verdict, verdict
                                                           );
         this.WriteLine("EXPECTED RESULT\t: " + exp_result);
         this.WriteLine("RESULT\t\t: " + result);
         this.WriteLine("EXPECTED VERDICT: " + TestVerdictString.GetValue(exp_verdict));
         this.WriteLine("TEST VERDICT\t: " + TestVerdictString.GetValue(verdict));
         this.WriteLine("VERDICT\t\t: " + TestVerdictString.GetValue(realVerdict));
         return(realVerdict);
     }
     catch (System.IO.IOException)
     {
         return(TestVerdict.Untested);
     }
 }
コード例 #3
0
        public virtual TestVerdict[] RunTests()
        {
            if (testCases.Count > 0)
            {
                TestVerdict[] results = new TestVerdict[testCases.Count];
                TestCase      tc;
                object        obj;
                startTime = DateTime.Now;
                for (int i = 0; i < testCases.Count; i++)
                {
                    obj = testCases[i];
                    if (obj is TestCase)
                    {
                        tc = (TestCase)testCases[i];
                        DateTime start = DateTime.Now;
                        results[i] = this.RunTest(tc);
                        DateTime stop         = DateTime.Now;
                        int      milliseconds = (int)Math.Round((stop - start).TotalMilliseconds);
                        testWriter.Write(GetDateString(start) + "\t| " +
                                         GetDateString(stop) + "\t| " + milliseconds);

                        if (milliseconds > 100000)
                        {
                            testWriter.Write("\t| ");
                        }
                        else
                        {
                            testWriter.Write("\t\t| ");
                        }
                        string result = TestVerdictString.GetValue(results[i]);
                        if (result.Length > 5)
                        {
                            testWriter.Write(result + "\t| ");
                        }
                        else
                        {
                            testWriter.Write(result + "\t\t| ");
                        }
                        testWriter.WriteLine(tc.TestcaseId);
                    }
                    else
                    {
                        if (obj is TestSuite.MileStone)
                        {
                            TestSuite.MileStone tp = (TestSuite.MileStone)obj;
                            tp.SetTime();
                        }
                    }
                }
                try
                {
                    string result = this.GetReport();
                    if (result != null)
                    {
                        DateTime     cal      = DateTime.Now;
                        StreamWriter writer   = new StreamWriter("performance.log", true);
                        string       userName = Environment.UserName;
                        string       osName   = Environment.OSVersion.Platform.ToString();
                        string       osArch   = "Running On Other";
                        Type         t        = Type.GetType("Mono.Runtime");
                        if (t != null)
                        {
                            osArch = "Running On Mono";
                        }
                        string osVersion = Environment.OSVersion.VersionString;
                        writer.WriteLine(starLine);
                        writer.WriteLine("TEST TIME: " + GetDateString(startTime) + " - " + GetDateString(cal));
                        writer.WriteLine("USER     : "******"PLATFORM : " + osName + " " + osVersion + " " + osArch);
                        writer.WriteLine(result);
                        writer.Flush();
                        writer.Close();
                    }
                }
                catch (System.IO.IOException)
                {
                }
                return(results);
            }
            return(null);
        }