/// <summary> /// Will execute test steps in a given execution plan. /// </summary> /// <param name="plan">The execution plan.</param> private static void ExecutePlan(ExecutionPlan plan) { DateTime started = DateTime.Now; foreach (Call call in plan.Calls) { if (call.MethodInvoker.HadCriticalFailure) { TestServices.Log( "Step: {0} skipped due to MethodInvoker failure.", plan.TestSteps[call].Name); } else { TestServices.Log( "Step: {0} started.", plan.TestSteps[call].Name); call.DoCall(); } } foreach (Call call in plan.Calls) { call.WaitForCall(); TestServices.Log( call.PostCallSummary()); } TestServices.Log( "Execution Time: {0}ms", (int)(DateTime.Now - started).TotalMilliseconds); }
/// <summary> /// Will write the execution plan to TestServices.Trace /// </summary> /// <param name="plan">The execution plan.</param> private static void LogExecutionPlan(ExecutionPlan plan) { TestServices.Trace("Execution Plan"); foreach (Call c in plan.Calls) { TestServices.Trace(c.PreCallSummary()); } }
//---------------------------------------------------------------------- // Public Methods //---------------------------------------------------------------------- /// <summary> /// Will invoke all public methods in the test that are marked /// with the TestStep attribute using the provided method invoker. /// </summary> /// <param name="invoker">A MethodInvoker</param> /// <param name="test">An object with test steps.</param> public static void Run(MethodInvoker invoker, object test) { RunOnce(); ExecutionPlan plan = BuildDefaultExecutionPlan(invoker, test); LogExecutionPlan(plan); ExecutePlan(plan); }