Exemplo n.º 1
0
        public override bool Execute(RunInput input)
        {
            BatchRunRequest batchRunRequest = null;

            try
            {
                batchRunRequest = input.GetBatchRunRequest();

                if (!batchRunRequest.Specifications.Any())
                {
                    ConsoleWriter.Write(ConsoleColor.Yellow, "Warning: No specs found!");
                }
            }
            catch (SuiteNotFoundException ex)
            {
                ConsoleWriter.Write(ConsoleColor.Red, ex.Message);
                return(false);
            }

            var controller = input.BuildEngine();
            var task       = controller.Start().ContinueWith(t =>
            {
                var systemRecycled = t.Result;
                return(executeAgainstTheSystem(input, systemRecycled, controller));
            });

            task.Wait();
            controller.SafeDispose();

            return(task.Result);
        }
Exemplo n.º 2
0
 public BatchRunRequest GetBatchRunRequest()
 {
     return(_batchRunRequest ?? (_batchRunRequest = new BatchRunRequest
     {
         Lifecycle = LifecycleFlag,
         Suite = WorkspaceFlag
     }));
 }
Exemplo n.º 3
0
        public BatchRunRequest GetBatchRunRequest()
        {
            var tags = ExcludeTagsFlag ?? "";

            return(_batchRunRequest ?? (_batchRunRequest = new BatchRunRequest
            {
                Lifecycle = LifecycleFlag,
                Suite = WorkspaceFlag,
                Tags = tags.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray()
            }));
        }
Exemplo n.º 4
0
        public void write_initial_model()
        {
            // You need to compile everything before trying to use this
            var input = new ProjectInput
            {
                Path =
                    AppDomain.CurrentDomain.BaseDirectory.ParentDirectory()
                    .ParentDirectory()
                    .ParentDirectory()
                    .AppendPath("Storyteller.Samples"),

                ProfileFlag = "Safari"
            };

            using (var controller = input.BuildRemoteController())
            {
                controller.Start(EngineMode.Batch).Wait(30.Seconds());

                var hierarchy = HierarchyLoader.ReadHierarchy(input.Path.AppendPath("Specs"));
                var request   = new BatchRunRequest
                {
                    SpecPath = input.SpecPath
                };

                var response = controller.Send(request).AndWaitFor <BatchRunResponse>();


                var cache = new ResultsCache();
                response.Result.records.Each(
                    x =>
                {
                    var completed = new SpecExecutionCompleted(x.specification.id, x.results, x.specification);
                    cache.Store(completed);
                });

                response.Result.fixtures = controller.LatestSystemRecycled.fixtures;


                var hierarchyLoaded = new HierarchyLoaded(hierarchy, cache);

                var initialization = new InitialModel(controller.LatestSystemRecycled, hierarchyLoaded)
                {
                    wsAddress = "ws://localhost:" + 8200
                };

                writeResponse(response.Result);
                //writeInitialization(initialization);
            }
        }
Exemplo n.º 5
0
        public BatchRunRequestTester()
        {
            childSuite1 = new Suite
            {
                name           = "Child Suite 1",
                suites         = new Suite[0],
                Specifications = new[]
                {
                    new Specification {
                        name = "Spec 1a", Lifecycle = Lifecycle.Acceptance, Tags = { "tag1", "tag2" }
                    },
                    new Specification {
                        name = "Spec 1b", Lifecycle = Lifecycle.Regression, Tags = { "tag2" }
                    }
                }
            };

            childSuite2 = new Suite
            {
                name           = "Child Suite 2",
                suites         = new Suite[0],
                Specifications = new[]
                {
                    new Specification
                    {
                        name      = "Spec 2a",
                        Lifecycle = Lifecycle.Acceptance,
                        Tags      = { "tag1", "tag2", "tag3" }
                    },
                    new Specification {
                        name = "Spec 2b", Lifecycle = Lifecycle.Regression, Tags = { "tag4" }
                    }
                }
            };

            theTopSuite = new Suite
            {
                Specifications = new Specification[0],
                suites         = new[]
                {
                    childSuite1, childSuite2
                }
            };

            theRequest = new BatchRunRequest {
                Lifecycle = Lifecycle.Any
            };
        }
        //[Fact]
        public void write_initial_model()
        {
            // You need to compile everything before trying to use this
            var input = new ProjectInput(EngineMode.Batch)
            {
                Path =
                    samplesFolder,
                ProfileFlag = "Safari"
            };

            using (var controller = input.BuildEngine())
            {
                controller.Start().Wait(30.Seconds());

                var hierarchy = HierarchyLoader.ReadHierarchy(input.Path.AppendPath("Specs"));
                var request   = new BatchRunRequest
                {
                    SpecPath = input.SpecPath
                };

                var response = controller.Send(request).AndWaitFor <BatchRunResponse>();


                var cache = new ResultsCache();
                response.Result.records.Each(
                    x =>
                {
                    var completed = new SpecExecutionCompleted(x.specification.id, x.results, x.specification);
                    cache.Store(completed);
                });

                response.Result.fixtures = controller.LatestSystemRecycled.fixtures;


                var hierarchyLoaded = new HierarchyLoaded(hierarchy, cache);

                writeResponse(response.Result);
                //writeInitialization(initialization);
            }
        }