private void generationWorker_DoWork(object sender, DoWorkEventArgs e) { try { this.Exception = null; isRunning = false; fm = e.Argument as StepFaultModel; ExecutionInstance currentTestProject = fm.ExecutionInstance; string message = null; fm.ExecutionEngine.AcquireProcess(); // Sets up the environment of the execution engine fm.ExecutionInstance = currentTestProject; fm.SetUpEnvironment(); passedDuration = 0.0; estimatedDuration = fm.GetEstimatedDuration("RandomExploration").TotalMilliseconds; aTimer = new System.Timers.Timer(100); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Enabled = true; aTimer.AutoReset = true; isRunning = true; message = (string)fm.Run("RandomExploration"); // Tears down the environment fm.TearDownEnvironment(false); // Relinquishes control of the execution engine fm.ExecutionEngine.RelinquishProcess(); aTimer.Enabled = false; if (message.ToLower().Contains("success")) { e.Result = true; } else { e.Result = false; this.Exception = new FM4CCException(message); } } catch(TargetInvocationException) { e.Result = false; } }