public static void Run(DataLayer.Test test, IHandlerTarget handlerTarget, string configPath, string binaryPath, UUTTestMode mode) #endif { if (test == null) { throw new ArgumentNullException("test", "A valid test must be provided."); } if ((test.Steps == null) || (test.Steps.Count == 0)) { throw new ArgumentNullException("test.Steps", "A test must contain one or more Steps."); } IEnumerable <Actor> actors = test.Steps.Distinct(new StepComparer()).Select(s => s.Actor); if (actors == null) { throw new InvalidOperationException("Test " + test.Name + " yielded no meaningful actions."); } lock (thisLock) { #if UUT_TEST == false Load(test, actors, handlerTarget, configPath); #else Load(test, actors, handlerTarget, configPath, mode); #endif Bind(test, binaryPath); Substitute(test); Run(test, actors); ThreadPool.RegisterWaitForSingleObject(testComplete, (state, timedOut) => { Unload(test, actors); }, null, -1, true); } }
/// <summary> /// Orchestrates the setup, asynchronous execution and teardown of a Test in the TQF /// </summary> /// <param name="test">Test to run</param> /// <param name="handlerTarget">Target for all ActiveObject events</param> /// <param name="path">path location of custom script binaries</param> #if UUT_TEST == false public static void Run(DataLayer.Test test, IHandlerTarget handlerTarget, string configPath, string binaryPath)
public static void Run(DataLayer.Test test, IHandlerTarget handlerTarget, string configPath, UUTTestMode mode) { Run(test, handlerTarget, configPath, string.Empty, mode); }
/// <summary> /// Orchestrates the setup, asynchronous execution and teardown of a Test in the TQF /// </summary> /// <param name="test">Test to run</param> /// <param name="handlerTarget">Target for all ActiveObject events</param> #if UUT_TEST == false public static void Run(DataLayer.Test test, IHandlerTarget handlerTarget, string configPath) { Run(test, handlerTarget, configPath, string.Empty); }
/// <summary> /// Orchestrates the setup, asynchronous execution and teardown of a Test in the TQF /// </summary> /// <param name="test">Test to run</param> /// <param name="handlerTarget">Target for all ActiveObject events</param> #if UUT_TEST == false public static void Run(DataLayer.Test test, IHandlerTarget handlerTarget) { Run(test, handlerTarget, string.Empty, string.Empty); }
private static void Load(DataLayer.Test test, IEnumerable <Actor> actors, IHandlerTarget handlerTarget, string configPath, UUTTestMode mode) #endif { if (!string.IsNullOrEmpty(configPath)) { ConfigManager.SetLocation(configPath); } foreach (Actor actor in actors) { switch (actor.Type) { case ActorType.Port: QFManager.Port.Create((PortType)Enum.Parse(typeof(PortType), actor.SubType), ConfigManager.ReadStream(actor.Name)); QFManager.Port.Receive(actor.Name, PortDataReceived); QFManager.Port.Error(actor.Name, PortError); QFManager.Port.ReceiveTimeout(actor.Name, PortReceiveTimeoutExpired); if (handlerTarget != null) { QFManager.Port.Receive(actor.Name, handlerTarget.PortReceive); QFManager.Port.ReceiveTimeout(actor.Name, handlerTarget.PortTimeout); QFManager.Port.Error(actor.Name, handlerTarget.PortError); } break; case ActorType.Process: QFManager.Process.Create(ConfigManager.ReadStream(actor.Name)); QFManager.Process.Launched(actor.Name, ProcessLaunched); QFManager.Process.Killed(actor.Name, ProcessKilled); QFManager.Process.Timeout(actor.Name, ProcessTimeout); QFManager.Process.Error(actor.Name, ProcessError); if (handlerTarget != null) { QFManager.Process.Launched(actor.Name, handlerTarget.ProcessLaunched); QFManager.Process.Killed(actor.Name, handlerTarget.ProcessKilled); QFManager.Process.Timeout(actor.Name, handlerTarget.ProcessTimeout); QFManager.Process.Error(actor.Name, handlerTarget.ProcessError); } break; case ActorType.Prompt: QFManager.Prompt.Create(actor.Name); QFManager.Prompt.Showing(actor.Name, PromptShowing); QFManager.Prompt.Closed(actor.Name, PromptClosed); QFManager.Prompt.Error(actor.Name, PromptError); if (handlerTarget != null) { QFManager.Prompt.Showing(actor.Name, handlerTarget.PromptShowing); QFManager.Prompt.Closed(actor.Name, handlerTarget.PromptClosed); QFManager.Prompt.Error(actor.Name, handlerTarget.PromptError); } break; case ActorType.Recorder: QFManager.Recorder.Create(RecorderType.File, actor.Name); QFManager.Recorder.Opening(actor.Name, RecorderOpening); QFManager.Recorder.Opened(actor.Name, RecorderOpened); QFManager.Recorder.Recording(actor.Name, RecorderRecording); QFManager.Recorder.Closed(actor.Name, RecorderClosed); QFManager.Recorder.Error(actor.Name, RecorderError); if (handlerTarget != null) { QFManager.Recorder.Opened(actor.Name, handlerTarget.RecorderOpened); QFManager.Recorder.Recording(actor.Name, handlerTarget.RecorderRecording); QFManager.Recorder.Closed(actor.Name, handlerTarget.RecorderClosed); QFManager.Recorder.Error(actor.Name, handlerTarget.RecorderError); } break; default: throw new NotImplementedException(); } } #if UUT_TEST == false QFManager.Test.Load(test); #else QFManager.Test.Load(test, mode); #endif QFManager.Test.Stepping(test.Name, TestStepping); QFManager.Test.Error(test.Name, TestError); QFManager.Test.Stepped(test.Name, TestStepped); QFManager.Test.Passed(test.Name, TestPassed); QFManager.Test.Failed(test.Name, TestFailed); QFManager.Test.Aborted(test.Name, TestAborted); if (handlerTarget != null) { QFManager.Test.Stepping(test.Name, handlerTarget.TestStepping); QFManager.Test.Error(test.Name, handlerTarget.TestError); QFManager.Test.Stepped(test.Name, handlerTarget.TestStepped); QFManager.Test.Aborted(test.Name, handlerTarget.TestAborted); QFManager.Test.Passed(test.Name, handlerTarget.TestPassed); QFManager.Test.Failed(test.Name, handlerTarget.TestFailed); if (TestUnloaded == null) { TestUnloaded += handlerTarget.TestUnloaded; } } }
private static void Load(DataLayer.Test test, IEnumerable <Actor> actors, IHandlerTarget handlerTarget, string configPath)