public StepReport(ReportNodeType node, IReportNodeOwner owner) : base(node, owner)
        {
            Contexts = new ReportNodeCollection <ContextReport>(this, ReportNodeFactory.Instance);
            SubSteps = new ReportNodeCollection <StepReport>(this, ReportNodeFactory.Instance);

            AllStepsEnumerator = new ReportNodeEnumerator <StepReport>();
        }
Пример #2
0
        T IReportNodeFactory.Create <T>(ReportNodeType node, ReportNodeType parentNode, IReportNodeOwner owner)
        {
            if (node == null)
            {
                return(null);
            }

            string nodeType = node.type.ToLower();

            switch (nodeType)
            {
            case NodeType_TestRun:
                return(null);

            case NodeType_Iteration:
                if (parentNode != null && parentNode.type.ToLower() == NodeType_Action)
                {
                    // create action iteration report
                    return(new ActionIterationReport(node, owner) as T);
                }
                return(new IterationReport(node, owner) as T);

            case NodeType_Action:
                return(new ActionReport(node, owner) as T);

            case NodeType_Context:
                return(new ContextReport(node, owner) as T);

            default:
                return(new StepReport(node, owner) as T);
            }
        }
        public override bool TryParse()
        {
            if (!base.TryParse())
            {
                return(false);
            }

            // try to parse the second level report nodes, the type shall be 'iteration' for GUI test
            Iterations.Clear();
            ReportNodeType[] childNodes = Node.ReportNode;
            if (childNodes != null)
            {
                foreach (ReportNodeType node in childNodes)
                {
                    IterationReport iteration = Iterations.TryParseAndAdd(node, this.Node);
                    if (iteration != null)
                    {
                        AllStepsEnumerator.Merge(iteration.AllStepsEnumerator);
                        continue;
                    }
                }
            }
            if (Iterations.Length == 0)
            {
                // no iteration node is parsed successfully under testrun node,
                // it might because the GUI test is run with one iteration only
                // which omits the iteration node in the report Xml
                // here create a temporary iteration node so that the nodes read from the Xml
                // can be processed properly
                ReportNodeType iterationNode = new ReportNodeType
                {
                    type = "Iteration",
                    Data = new DataType
                    {
                        Name              = "Action0",
                        IndexSpecified    = true,
                        Index             = 1,
                        Result            = "Done",
                        StartTime         = Node.Data.StartTime,
                        DurationSpecified = Node.Data.DurationSpecified,
                        Duration          = Node.Data.Duration
                    },
                    ReportNode = Node.ReportNode
                };
                IterationReport iteration = Iterations.TryParseAndAdd(iterationNode, this.Node);
                if (iteration != null)
                {
                    AllStepsEnumerator.Merge(iteration.AllStepsEnumerator);
                }

                if (Iterations.Length == 0)
                {
                    // failed to parse at least one iteration, not a valid GUI test
                    return(false);
                }
            }

            return(true);
        }
        public BCStepReport(ReportNodeType node, IReportNodeOwner owner) : base(node, owner)
        {
            SubBCSteps = new ReportNodeCollection <BCStepReport>(this, BCStepReportNodeFactory.Instance);

            AllBCStepsEnumerator = new ReportNodeEnumerator <BCStepReport>();

            OwnerBusinessComponent = owner as BusinessComponentReport;
        }
Пример #5
0
        T IReportNodeFactory.Create <T>(ReportNodeType node, ReportNodeType parentNode, IReportNodeOwner owner)
        {
            if (node == null || typeof(T) != typeof(BCStepReport))
            {
                return(null);
            }

            return(new BCStepReport(node, owner) as T);
        }
        public IterationReport(ReportNodeType node, IReportNodeOwner owner) : base(node, owner)
        {
            Groups             = new ReportNodeCollection <GroupReport>(this, ReportNodeFactory.Instance);
            Flows              = new ReportNodeCollection <FlowReport>(this, ReportNodeFactory.Instance);
            Branches           = new ReportNodeCollection <BranchReport>(this, ReportNodeFactory.Instance);
            BusinessComponents = new ReportNodeCollection <BusinessComponentReport>(this, ReportNodeFactory.Instance);
            RecoverySteps      = new ReportNodeCollection <RecoveryStepReport>(this, ReportNodeFactory.Instance);
            GeneralSteps       = new ReportNodeCollection <GeneralStepReport>(this, ReportNodeFactory.Instance);

            AllBCsEnumerator = new ReportNodeEnumerator <BusinessComponentReport>();
        }
        protected override ReportNodeType ParseTestReportNode()
        {
            ReportNodeType firstReportNode = Root.ReportNode;

            if (firstReportNode.type.ToLower() != NodeType_TestRun)
            {
                return(null);
            }

            return(firstReportNode);
        }
        public ActionReport(ReportNodeType node, IReportNodeOwner owner) : base(node, owner)
        {
            ActionIterations = new ReportNodeCollection <ActionIterationReport>(this, ReportNodeFactory.Instance);
            Contexts         = new ReportNodeCollection <ContextReport>(this, ReportNodeFactory.Instance);
            Steps            = new ReportNodeCollection <StepReport>(this, ReportNodeFactory.Instance);
            SubActions       = new ReportNodeCollection <ActionReport>(this, ReportNodeFactory.Instance);

            AllStepsEnumerator = new ReportNodeEnumerator <StepReport>();

            OwnerIteration = Owner as IterationReport;
        }
        T IReportNodeFactory.Create <T>(ReportNodeType node, ReportNodeType parentNode, IReportNodeOwner owner)
        {
            if (node == null)
            {
                return(null);
            }

            string nodeType = node.type.ToLower();

            switch (nodeType)
            {
            case NodeType_BPTestRun:
                return(null);

            case NodeType_Iteration:
                return(new IterationReport(node, owner) as T);

            case NodeType_Group:
                return(new GroupReport(node, owner) as T);

            case NodeType_Flow:
                return(new FlowReport(node, owner) as T);

            case NodeType_BranchCase:
                return(new BranchReport(node, owner) as T);

            case NodeType_BC:
                return(new BusinessComponentReport(node, owner) as T);

            case NodeType_Step:
                if (node.Data.Extension.NodeType != null && node.Data.Extension.NodeType.Trim().ToLower() == NodeType_Recovery)
                {
                    return(new RecoveryStepReport(node, owner) as T);
                }
                else
                {
                    return(new GeneralStepReport(node, owner) as T);
                }

            default:
                return(null);
            }
        }
        T IReportNodeFactory.Create <T>(ReportNodeType node, ReportNodeType parentNode, IReportNodeOwner owner)
        {
            if (node == null)
            {
                return(null);
            }

            string nodeType = node.type.ToLower();

            switch (nodeType)
            {
            case NodeType_TestRun:
                return(null);

            case NodeType_Iteration:
                return(new IterationReport(node, owner) as T);

            default:
                return(new ActivityReport(node, owner) as T);
            }
        }
        public IterationReport(ReportNodeType node, IReportNodeOwner owner) : base(node, owner)
        {
            Activities = new ReportNodeCollection <ActivityReport>(this, ReportNodeFactory.Instance);

            AllActivitiesEnumerator = new ReportNodeEnumerator <ActivityReport>();
        }
Пример #12
0
        public override bool TryParse()
        {
            if (!base.TryParse())
            {
                return(false);
            }

            // for the branch (case) report node, the next level node is "Step" type
            // case name and description is retrieved from the "Step" type node
            ReportNodeType[] childNodes = Node.ReportNode;
            if (childNodes == null || childNodes.Length == 0)
            {
                return(false);
            }
            ReportNodeType caseStepNode = childNodes[0];

            if (caseStepNode.type.ToLower() != NodeType_Step)
            {
                return(false);
            }
            CaseName        = caseStepNode.Data.Name;
            CaseDescription = caseStepNode.Data.Description;

            // groups, flows, branches, bcs
            Groups.Clear();
            Flows.Clear();
            Branches.Clear();
            BusinessComponents.Clear();
            RecoverySteps.Clear();
            GeneralSteps.Clear();

            childNodes = caseStepNode.ReportNode;
            if (childNodes != null)
            {
                foreach (ReportNodeType node in childNodes)
                {
                    // business component
                    BusinessComponentReport bc = BusinessComponents.TryParseAndAdd(node, this.Node);
                    if (bc != null)
                    {
                        AllBCsEnumerator.Add(bc);
                        continue;
                    }

                    // group
                    GroupReport group = Groups.TryParseAndAdd(node, this.Node);
                    if (group != null)
                    {
                        AllBCsEnumerator.Merge(group.AllBCsEnumerator);
                        continue;
                    }

                    // flow
                    FlowReport flow = Flows.TryParseAndAdd(node, this.Node);
                    if (flow != null)
                    {
                        AllBCsEnumerator.Merge(flow.AllBCsEnumerator);
                        continue;
                    }

                    // branch
                    BranchReport branch = Branches.TryParseAndAdd(node, this.Node);
                    if (branch != null)
                    {
                        AllBCsEnumerator.Merge(branch.AllBCsEnumerator);
                        continue;
                    }

                    // recovery step
                    RecoveryStepReport recovery = RecoverySteps.TryParseAndAdd(node, this.Node);
                    if (recovery != null)
                    {
                        AllBCsEnumerator.Merge(recovery.AllBCsEnumerator);
                        continue;
                    }

                    // general step
                    GeneralStepReport generalStep = GeneralSteps.TryParseAndAdd(node, this.Node);
                    if (generalStep != null)
                    {
                        AllBCsEnumerator.Merge(generalStep.AllBCsEnumerator);
                        continue;
                    }
                }
            }

            return(true);
        }