internal void RunTest(UiaDistributedTestcaseHost host, AutomationElement automationElement, string uiElementName)
        {
            if (stepInfos.Count == 0)
            {
                throw new InvalidOperationException("You must first add one or more steps run this testcase");
            }

            //Because we the Testcase object has a MarshalByRef shared state, we
            //need to ensure that we have a server channel in this AppDomain.
            //


            //attach the testcase to the host
            host.AttachTestcase(this, uiElementName);

            //run all the steps
            int nextStep = 0;

            try
            {
                for (int i = 0; i < stepInfos.Count; i++)
                {
                    nextStep = i + 1;
                    UiaDistributedStepInfo stepInfo = stepInfos[i];

                    //Invoke with the automation element, otherwise have the host invoke it with the UIElement
                    if (stepInfo.Target == UiaDistributedStepTarget.AutomationElement)
                    {
                        PerformStep(i, automationElement);
                    }
                    else //UiElement
                    {
                        host.PerformStep(i);
                    }
                }
            }
            finally
            {
                //run any remaining steps marked "alwaysRun"
                for (int i = nextStep; i < stepInfos.Count; i++)
                {
                    UiaDistributedStepInfo stepInfo = stepInfos[i];
                    if (!stepInfo.AlwaysRun)
                    {
                        continue;
                    }

                    try
                    {
                        //Invoke with the automation element, otherwise have the host invoke it with the UIElement
                        if (stepInfo.Target == UiaDistributedStepTarget.AutomationElement)
                        {
                            PerformStep(i, automationElement);
                        }
                        else //UiElement
                        {
                            host.PerformStep(i);
                        }
                    }
                    catch (Exception e)
                    {
                        //Because these are clean up steps we ---- exceptions thrown by them
                        GlobalLog.LogDebug("AlwaysRun Step Failed with the following exception: " + e.ToString());
                    }
                }
            }
        }
        //used by the host to invoke the step
        internal void PerformStep(int stepIndex, object target)
        {
            UiaDistributedStepInfo stepInfo = stepInfos[stepIndex];

            stepInfo.Step(target);
        }