// 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(""); } }
/// <summary> /// Runs the test. /// </summary> public void RunTest() { try { TestAction(); Result = TestResultEnum.Passed; } catch (Exception e) { ExceptionTrace = e; Result = TestResultEnum.Failed; } }
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); }
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); }