Beispiel #1
0
        public TestResult Run(TestResult result)
        {
            try {
                if (result == null) result = new TestResult();

                if (SetUpClass != null)
                    SetUpClass();

                foreach (TestMethod method in TestMethods) {
                    try {
                        if(SetUp != null)
                            SetUp();
                        method.Invoke();
                        if(TearDown != null)
                            TearDown();
                        if (CleanUp != null)
                            CleanUp();
                        result.AddSuccess(method);
                    }
                    catch (TestFailedException tfe) {
                        result.AddFailure(method, tfe);
                        OnFailed(method);
                    }
                    catch (Exception e) {
                        result.AddError(method, e);
                        OnError(method);
                    }
                }

                if (TearDownClass != null)
                    TearDownClass();
            }
            catch (System.Exception ex) {
                result.AddError(new TestMethod("InitError", null), ex);
            }

            return result;
        }
Beispiel #2
0
 public override void Run(TestCase testCase)
 {
     Result = new TestResult();
     testCase.Run(Result);
     PrintResult();
 }