Exemple #1
0
        public static ITestRun GetTestRunWithStatus(TestRunStatuses status, params string[] rules)
        {
            var workflow = new TestWorkflow(TestLabCollection.TestLabs.First())
            {
                Name = "workflow 01"
            };

            workflow.SetTestLab(TestLabCollection.TestLabs.First());
            WorkflowCollection.Workflows.Add(workflow);
            var testRun = new TestRun {
                Name = "test run 03", Status = status
            };

            testRun.SetWorkflow(workflow);
            TestRunQueue.TestRuns.Add(testRun);
            var taskId = 0;

            if (null != rules)
            {
                // 20150904
                rules.ToList().ForEach(rule => TaskPool.Tasks.Add(new TestTask {
                    Id = ++taskId, Rule = rule, WorkflowId = workflow.Id, TestRunId = testRun.Id
                }));
            }
            // rules.ToList().ForEach(rule => TaskPool.Tasks.Add(new TestTask (TestTaskRuntimeTypes.Powershell) { Id = ++taskId, Rule = rule, WorkflowId = workflow.Id, TestRunId = testRun.Id }));

            return(testRun);
        }
        void WhenSendingTestRunAsJson(string testWorkflowName, TestRunStatuses status)
        {
            var testRunCommand = new TestRunCommand {
                WorkflowName = testWorkflowName, Status = status
            };

            WhenSendingTestRunAsJson(testWorkflowName, UrlList.TestRunsControlPoint_absPath, testRunCommand);
        }
Exemple #3
0
 public static void GetAnotherTestRunWithStatus(TestRunStatuses status, ITestWorkflow workflow)
 {
     var testRun = new TestRun {
         Name = "test run the second",
         Status = status
     };
     testRun.SetWorkflow(workflow);
     TestRunQueue.TestRuns.Add(testRun);
 }
Exemple #4
0
 public static ITestRun GetTestRunWithStatus(TestRunStatuses status)
 {
     var workflow = new TestWorkflow(TestLabCollection.TestLabs.First()) { Name = "workflow 01" };
     workflow.SetTestLab(TestLabCollection.TestLabs.First());
     WorkflowCollection.Workflows.Add(workflow);
     var testRun = new TestRun { Name = "test run 03", Status = status };
     testRun.SetWorkflow(workflow);
     TestRunQueue.TestRuns.Add(testRun);
     return testRun;
 }
Exemple #5
0
        public static void GetAnotherTestRunWithStatus(TestRunStatuses status, ITestWorkflow workflow)
        {
            var testRun = new TestRun {
                Name   = "test run the second",
                Status = status
            };

            testRun.SetWorkflow(workflow);
            TestRunQueue.TestRuns.Add(testRun);
        }
Exemple #6
0
 public static ITestRun GetTestRunWithStatus(TestRunStatuses status, params string[] rules)
 {
     var workflow = new TestWorkflow(TestLabCollection.TestLabs.First()) { Name = "workflow 01" };
     workflow.SetTestLab(TestLabCollection.TestLabs.First());
     WorkflowCollection.Workflows.Add(workflow);
     var testRun = new TestRun { Name = "test run 03", Status = status };
     testRun.SetWorkflow(workflow);
     TestRunQueue.TestRuns.Add(testRun);
     var taskId = 0;
     if (null != rules)
         // 20150904
         rules.ToList().ForEach(rule => TaskPool.Tasks.Add(new TestTask { Id = ++taskId, Rule = rule, WorkflowId = workflow.Id, TestRunId = testRun.Id }));
         // rules.ToList().ForEach(rule => TaskPool.Tasks.Add(new TestTask (TestTaskRuntimeTypes.Powershell) { Id = ++taskId, Rule = rule, WorkflowId = workflow.Id, TestRunId = testRun.Id }));
     
     return testRun;
 }
 TestRunCommand WhenSendingTestRunAsJson(string testWorkflowName, TestRunStatuses status, string alternativeUrl, ITestRunCommand testRunCommand)
 {
     var testRun = new TestRun();
     (testRun as TestRun).SetWorkflow(WorkflowCollection.Workflows.First(wfl => wfl.Name == testWorkflowName));
     if (null == testRunCommand)
         _response = _browser.Get(alternativeUrl, with => {
             // with.JsonBody(testRunCommand);
             with.Accept("application/json");
         });
     else
         _response = _browser.Get(alternativeUrl, with => {
             with.JsonBody(testRunCommand);
             with.Accept("application/json");
         });
     
     Xunit.Assert.Equal(HttpStatusCode.Created, _response.StatusCode);
     
     return _response.Body.DeserializeJson<TestRunCommand>();
 }
Exemple #8
0
 public bool CreateTestRun(string workflowName, TestRunStatuses status, string name)
 {
     Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).1");
     
     var testRunCommand = new TestRunCommand {
         TestRunName = name,
         Status = status,
         WorkflowName = workflowName
     };
     
     Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).2");
     
     var creatingTestRunResponse = _restTemplate.PostForMessage(UrlList.TestRunsControlPoint_absPath, testRunCommand);
     
     Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).3 creatingTestRunResponse is null? {0}", null == creatingTestRunResponse);
     // 20150316
     if (null == creatingTestRunResponse)
         throw  new Exception("Failed to create a test run.");
     
     return HttpStatusCode.Created == creatingTestRunResponse.StatusCode;
 }
Exemple #9
0
        public virtual bool CreateTestRun(string workflowName, TestRunStatuses status, string name)
        {
            Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).1");

            var testRunCommand = new TestRunCommand {
                TestRunName  = name,
                Status       = status,
                WorkflowName = workflowName
            };

            Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).2");

            var creatingTestRunResponse = _restTemplate.PostForMessage(UrlList.TestRunsControlPoint_absPath, testRunCommand);

            Trace.TraceInformation("CreateTestRun(string workflowName, TestRunStatuses status, string name).3 creatingTestRunResponse is null? {0}", null == creatingTestRunResponse);

            if (null == creatingTestRunResponse)
            {
                throw  new Exception("Failed to create a test run.");
            }

            return(HttpStatusCode.Created == creatingTestRunResponse.StatusCode);
        }
        TestRunCommand WhenSendingTestRunAsJson(string testWorkflowName, TestRunStatuses status, string alternativeUrl, ITestRunCommand testRunCommand)
        {
            var testRun = new TestRun();

            (testRun as TestRun).SetWorkflow(WorkflowCollection.Workflows.First(wfl => wfl.Name == testWorkflowName));
            if (null == testRunCommand)
            {
                _response = _browser.Get(alternativeUrl, with => {
                    // with.JsonBody(testRunCommand);
                    with.Accept("application/json");
                });
            }
            else
            {
                _response = _browser.Get(alternativeUrl, with => {
                    with.JsonBody(testRunCommand);
                    with.Accept("application/json");
                });
            }

            Xunit.Assert.Equal(HttpStatusCode.Created, _response.StatusCode);

            return(_response.Body.DeserializeJson <TestRunCommand>());
        }
Exemple #11
0
 TestRunCommand WHEN_sending_testRun_as_json(string testWorkflowName, TestRunStatuses status, string alternativeUrl, ITestRunCommand testRunCommand)
 {
     var testRun = new TestRun();
     // var testRunCommand = new TestRunCommand { WorkflowName = testWorkflowName, Status = status };
     (testRun as TestRun).SetWorkflow(WorkflowCollection.Workflows.First(wfl => wfl.Name == testWorkflowName));
     if (null == testRunCommand)
         _response = _browser.Post(alternativeUrl, with => {
             // with.JsonBody(testRunCommand);
             with.Accept("application/json");
         });
     else
         _response = _browser.Post(alternativeUrl, with => {
             with.JsonBody(testRunCommand);
             with.Accept("application/json");
         });
     return _response.Body.DeserializeJson<TestRunCommand>();
 }
Exemple #12
0
 void WhenSendingTestRunAsJson(string testWorkflowName, TestRunStatuses status)
 {
     var testRunCommand = new TestRunCommand { WorkflowName = testWorkflowName, Status = status };
     WhenSendingTestRunAsJson(testWorkflowName, UrlList.TestRunsControlPoint_absPath, testRunCommand);
 }
Exemple #13
0
        TestRunCommand WHEN_sending_testRun_as_json(string testWorkflowName, TestRunStatuses status)
        {
//            var testRun = new TestRun();
//            var testRunCommand = new TestRunCommand { WorkflowName = testWorkflowName, Status = status };
//            (testRun as TestRun).SetWorkflow(WorkflowCollection.Workflows.First(wfl => wfl.Name == testWorkflowName));
//            _response = _browser.Post(UrlList.TestRunsControlPoint_absPath, with => {
//                with.JsonBody(testRunCommand);
//                with.Accept("application/json");
//            });
//            return _response.Body.DeserializeJson<TestRunCommand>();
            
            var testRunCommand = new TestRunCommand { WorkflowName = testWorkflowName, Status = status };
            return WHEN_sending_testRun_as_json(testWorkflowName, status, UrlList.TestRunsControlPoint_absPath, testRunCommand);
        }
Exemple #14
0
 public static ITestRun GetTestRunWithStatus(TestRunStatuses status)
 {
     return GetTestRunWithStatus(status, "aaa_01");
 }
Exemple #15
0
 ITestRun getTestRunWithStatus(TestRunStatuses status)
 {
     return getTestRunWithStatus(status, "aaa_01");
 }
Exemple #16
0
 ITestRun getTestRunWithStatus(TestRunStatuses status, params string[] rules)
 {
     return TestFactory.GetTestRunWithStatus(status, rules);
 }
Exemple #17
0
 public static ITestRun GetTestRunWithStatus(TestRunStatuses status)
 {
     return(GetTestRunWithStatus(status, "aaa_01"));
 }
Exemple #18
0
 ITestRun getTestRunWithStatus(TestRunStatuses status)
 {
     return(getTestRunWithStatus(status, "aaa_01"));
 }
Exemple #19
0
 ITestRun getTestRunWithStatus(TestRunStatuses status, params string[] rules)
 {
     return(TestFactory.GetTestRunWithStatus(status, rules));
 }
Exemple #20
0
 ITestRun getTestRunWithStatus(TestRunStatuses status)
 {
     return TestFactory.GetTestRunWithStatus(status);
 }