예제 #1
0
        // Function to run the test suite
        public static void RunTestCases()
        {
            Console.WriteLine("Running testcases:");

            foreach (KeyValuePair <string, TestCaseBase> tc in testInit)
            {
                Console.WriteLine("**********************************************************************");
                // Getting each test cases values
                TestCaseBase values = testInit[tc.Key];
                string       ID     = values.getId();
                string       tcName = values.getName();
                string       tcDesc = values.getDesc();
                Console.WriteLine("Running {0} : {1}, {2}", ID, tcName, tcDesc);
                // Run the test case
                TestResultEnum retEnum = values.precheck();
                if (retEnum == 0)
                {
                    retEnum = values.run();
                    if (retEnum == 0)
                    {
                        retEnum = values.postcheck();
                    }
                }
                //Changing the returned int value to enum values
                //put the result for each test case in the dictionary
                testRes.Add(tc.Key, new TestReport(ID, tcName, tcDesc, retEnum.ToString()));
                Console.WriteLine("***********************************************************************");
                Console.WriteLine("");
            }
        }
예제 #2
0
 /// <summary>
 /// Runs the test.
 /// </summary>
 public void RunTest()
 {
     try {
         TestAction();
         Result = TestResultEnum.Passed;
     }
     catch (Exception e) {
         ExceptionTrace = e;
         Result         = TestResultEnum.Failed;
     }
 }
예제 #3
0
        public TestResultEnum GetTotalResult()
        {
            TestResultEnum _Result = TestResultEnum.Pass;

            foreach (TestStepBase Test in m_Results.Values)
            {
                if ((Test.GetResult() == TestResultEnum.Pass ||
                     Test.GetResult() == TestResultEnum.Ignored))
                {
                }
                else
                {
                    _Result = TestResultEnum.Fail;
                }
            }
            return(_Result);
        }
예제 #4
0
        public TestResultEnum SetResultValue(string Name, bool Value)
        {
            TestResultEnum _Result = TestResultEnum.NotTested;

            if (!m_Results.Contains(Name))
            {
                throw new ArgumentOutOfRangeException(Name, "undefined");
                // return _Result;
            }
            if (!m_Results[Name].GetType().Equals(typeof(TestStepBool)))
            {
                throw new ArgumentException(Name + " is not defined as TestStepBool");
                // return _Result;
            }

            _Result = ((TestStepBool)m_Results[Name]).SetResultValue(Value,
                                                                     (LimitDefBool)m_Limits[m_Results[Name].GetLimitName()]);
            return(_Result);
        }