Esempio n. 1
0
        public static CriterionResult Run(this Criterion criterion, IXmlRpcClient proxy)
        {
            var criterionResult = new CriterionResult();

            criterionResult.Criterion = criterion;

            criterionResult.StepResults.AddRange(RunCriterion(criterion, -1, proxy).StepResults);

            criterionResult.SetResult();

            return criterionResult;
        }
Esempio n. 2
0
        public static StoryResult Run(this Story story, IRestClient client)
        {
            var storyResult = Behavior.Kernel.Get<StoryResult>();

            storyResult.Story = story;
            storyResult.StartTime = DateTime.Now;

            if (story.Criteria.Count.Equals(0))
            {
                storyResult.EndTime = DateTime.Now;
                storyResult.Result = Result.CreateFail("No criteria defined.");
                return storyResult;
            }

            var fixtureUrl = "http://" + Behavior.Config.Host + "/" + Behavior.Config.FixtureContext;

            var httpResult = Result.CreatePass();

            if (!Behavior.Config.IsLocal)
                httpResult = client.RequestFixtureLaunch(fixtureUrl);

            if (httpResult.status.ToLower().Equals("pass"))
            {
                IXmlRpcClient proxy = CreateProxy(httpResult.retrn.ToString());

                storyResult = RunCriteria(story, storyResult, proxy);

                if(!Behavior.Config.IsLocal)
                    client.DeleteRequest(fixtureUrl);

                storyResult.EndTime = DateTime.Now;
                storyResult.SetResult();

                return storyResult;
            }
            else
            {
                var criterionResult = new CriterionResult();

                criterionResult.StepResults.Add(new StepResult(httpResult));

                criterionResult.SetResult();

                storyResult.CriterionResults.Add(criterionResult);

                storyResult.EndTime = DateTime.Now;
                storyResult.SetResult();

                return storyResult;
            }
        }
Esempio n. 3
0
        public static CriterionResult RunCriterion(Criterion criterion, int dataRow, IXmlRpcClient proxy)
        {
            var criterionResult = new CriterionResult() { Criterion = criterion };

            foreach (CriterionStep s in criterion.Steps)
            {
                if(criterion.Table != null && criterion.Table.DataRows.Count > 0)
                    s.SetTestData(criterion.Table, dataRow);

                if (s.Table != null && s.Table.DataRows.Count > 0)
                    s.SetTestData(s.Table);

                criterionResult.StepResults.Add(s.Run(proxy));

                criterionResult.SetResult();

                if (criterionResult.Result.status.Equals("FAIL"))
                    break;
            }

            return criterionResult;
        }