Esempio n. 1
0
        private void Run(AsyncResult result, ComponentStepInstance step)
        {
            const string method = "Run";

            try
            {
                // Run the step.

                step.StartTracking();
                step.BeginMethod.Invoke(step.ProfileInstance.TestFixture, null);
                var elapsed = step.StopTracking();

                if (EventSource.IsEnabled(Event.Flow))
                {
                    EventSource.Raise(Event.Flow, method, "Step '" + step.Name + "' in profile '" + step.ProfileInstance.Profile + "' has been run for user " + step.ProfileInstance.User + ".", Event.Arg("Profile", step.ProfileInstance.Profile), Event.Arg("User", step.ProfileInstance.User), Event.Arg("Step", step.Name), Event.Arg("elapsed", elapsed));
                }

                // Mark it as done.

                result.SetComplete(step, null, true);
            }
            catch (Exception ex)
            {
                step.TrackError();
                result.SetComplete(step, new StepFailedException(GetType(), method, step.ProfileInstance.Profile.Name, step.Name, step.ProfileInstance.User, ex), true);
            }
        }
Esempio n. 2
0
        private void RunAsync(StepAsyncResult result, ComponentStepInstance step)
        {
            const string method = "RunAsync";

            try
            {
                // Run the step.

                step.StartTracking();
                ((IAsyncProfileTestFixture)step.ProfileInstance.TestFixture).Begin(result, step.BeginMethod, step.EndMethod);
            }
            catch (Exception ex)
            {
                step.TrackError();
                result.SetComplete(step, new StepFailedException(GetType(), method, step.ProfileInstance.Profile.Name, step.Name, step.ProfileInstance.User, ex), true);
            }
        }