예제 #1
0
 // 20141020 squeezing a task to its proxy
 public virtual bool UpdateTask(ITestTask task)
 // public virtual bool UpdateTask(ITestTaskStatusProxy task)
 {
     // TODO: try several times
     try {
         
         // 20141211
         // TODO: AOP
         Trace.TraceInformation("UpdateTask(ITestTask task).1: task id = {0}, task name = {1}, url = {2}", task.Id, task.Name, UrlList.TestTasks_Root + "/" + task.Id);
         
         // 20141215
         // _restTemplate.Put(UrlList.TestTasks_Root + "/" + task.Id, task);
         var updatingTaskResponse = _restTemplate.Exchange(UrlList.TestTasks_Root + "/" + task.Id, HttpMethod.PUT, new HttpEntity(task));
         
         Trace.TraceInformation("UpdateTask(ITestTask task).2");
         
         if (HttpStatusCode.OK == updatingTaskResponse.StatusCode)
             return true;
         throw new UpdateTaskException("Failed to update task '" + task.Name + "'");
         // 20141215
         // return true;
     }
     catch (Exception eOnUpdatingTask) {
         // TODO: AOP
         Trace.TraceError("UpdateTask(ITestTask task)");
         Trace.TraceError(eOnUpdatingTask.Message);
         throw new UpdateTaskException("Failed to update task '" + task.Name + "'");
     }
 }
예제 #2
0
 public static void CheckTestStatus(this ITestTask task)
 {
     if (task.IsCritical && TestStatuses.Failed == TestData.TestSuites.GetOveralStatus())
     {
         task.TaskStatus = TestTaskStatuses.FailedByTestResults;
     }
 }
예제 #3
0
 private Task <(double, bool, bool)> RunTask(ITestTask task, ITestCase testCase, CancellationToken token)
 {
     return(Task.Run(() =>
     {
         try
         {
             long tries = 0;
             double duration = 0;
             do
             {
                 task.Prepare(testCase);
                 Stopwatch sw = Stopwatch.StartNew();
                 task.Run(token);
                 sw.Stop();
                 duration += sw.Elapsed.TotalSeconds;
                 ++tries;
             } while (duration < 1.0);
             return (duration / tries, false, false);
         }
         catch (OperationCanceledException)
         {
             return (0, true, true);
         }
         catch (Exception)
         {
             return (0, true, false);
         }
     }, token));
 }
예제 #4
0
 public virtual bool Run(ITestTask task)
 {
     // TODO: move to an aspect
     try {
         Trace.TraceInformation("Run(ITestTask task).1");
         
         var runnerSelector = new TaskRunnerSelector();
         
         Trace.TraceInformation("Run(ITestTask task).2");
         
         var runner = runnerSelector.GetRunnableClient(task.TaskRuntimeType);
         
         Trace.TraceInformation("Run(ITestTask task).3");
         
         var result = runner.RunBeforeAction(task.BeforeAction, task.BeforeActionParameters, task.PreviousTaskResult);
         
         Trace.TraceInformation("Run(ITestTask task).4");
         
         if (!result) return result;
         
         Trace.TraceInformation("Run(ITestTask task).5");
         
         result = runner.RunMainAction(task.Action, task.ActionParameters, task.PreviousTaskResult);
         
         Trace.TraceInformation("Run(ITestTask task).6");
         
         return !result ? result : runner.RunAfterAction(task.AfterAction, task.AfterActionParameters, task.PreviousTaskResult);
     }
     catch (Exception eOnRunningTaskCode) {
         // TODO: AOP
         Trace.TraceError("Run(ITestTask task)");
         Trace.TraceError(eOnRunningTaskCode.Message);
         return false;
     }
 }
예제 #5
0
 public JobTaskService(IBuildTask buildTask,
                       IPullTask cloneTask,
                       IDeployTask deployTask,
                       IDeployDbTask deployDbTask,
                       IGenerateTask generateTask,
                       IMergeTask mergeTask,
                       IPublishArtifactTask publishArtifactTask,
                       IPushTask pushTask,
                       ITestTask testTask,
                       IDeleteRepositoryTask deleteRepositoryTask,
                       IDeleteHostingTask deleteHostingTask,
                       ICustomTask customTask)
 {
     BuildTask            = buildTask;
     CloneTask            = cloneTask;
     DeployTask           = deployTask;
     DeployDbTask         = deployDbTask;
     GenerateTask         = generateTask;
     MergeTask            = mergeTask;
     PublishArtifactTask  = publishArtifactTask;
     PushTask             = pushTask;
     TestTask             = testTask;
     DeleteRepositoryTask = deleteRepositoryTask;
     DeleteHostingTask    = deleteHostingTask;
     CustomTask           = customTask;
 }
 public virtual void UpdateTestClientWithActiveTask(ITestClient testClient, ITestTask actualTask)
 {
     testClient.Status    = TestClientStatuses.Running;
     testClient.TaskId    = actualTask.Id;
     testClient.TaskName  = actualTask.Name;
     testClient.TestRunId = actualTask.TestRunId;
 }
예제 #7
0
        public virtual bool SendTaskResult(ITestTask task, Guid clientId)
        {
            try {
                // 20141211
                // TODO: AOP
                Trace.TraceInformation("SendTaskResult(ITestTask task, Guid clientId).1: client id = {0}, task id = {1}, task name = {2}, url = {3}", clientId, task.Id, task.Name, UrlList.CurrentTaskForClientById + "/" + clientId);

                // 20141215
                // _restTemplate.Put(UrlList.CurrentTaskForClientById + "/" + clientId, task);
                var sendingTaskResultResponse = _restTemplate.Exchange(UrlList.CurrentTaskForClientById + "/" + clientId, HttpMethod.PUT, new HttpEntity(task));

                Trace.TraceInformation("SendTaskResult(ITestTask task, Guid clientId).2");

                if (HttpStatusCode.OK == sendingTaskResultResponse.StatusCode)
                {
                    return(true);
                }
                throw new UpdateTaskException("Failed to send results to task");

                // 20141215
                // return true;
            }
            catch (Exception eOnSendingTaskResults) {
                // TODO: AOP
                Trace.TraceError("SendTaskResult(ITestTask task, Guid clientId)");
                Trace.TraceError(eOnSendingTaskResults.Message);
                throw new UpdateTaskException("Failed to send results to task");
            }
        }
예제 #8
0
        public ITestTask UpdateTask(ITestTask loadedTask, int taskId)
        {
            if (null == loadedTask)
                throw new UpdateTaskException("Failed to update task with id = " + taskId);
            var storedTask = TaskPool.TasksForClients.First(task => task.Id == taskId && task.ClientId == loadedTask.ClientId);
            storedTask.TaskStatus = loadedTask.TaskStatus;
            storedTask.TaskResult = loadedTask.TaskResult;
            storedTask.StartTime = loadedTask.StartTime;

            var taskSelector = ServerObjectFactory.Resolve<TaskSelector>();

            if (storedTask.IsFailed())
                taskSelector.CancelFurtherTasksOfTestClient(storedTask.ClientId);
            if (storedTask.IsFinished())
                CleanUpClientDetailedStatus(storedTask.ClientId);

            if (storedTask.IsLastTaskInTestRun())
                CompleteTestRun(storedTask);

            if (storedTask.IsFinished())
                storedTask.SetTimeTaken();

            if (storedTask.IsCompletedSuccessfully())
                UpdateNextTask(storedTask);

            return storedTask;
        }
예제 #9
0
        // 20141020 squeezing a task to its proxy
        public virtual bool UpdateTask(ITestTask task)
        // public virtual bool UpdateTask(ITestTaskStatusProxy task)
        {
            // TODO: try several times
            try {
                // 20141211
                // TODO: AOP
                Trace.TraceInformation("UpdateTask(ITestTask task).1: task id = {0}, task name = {1}, url = {2}", task.Id, task.Name, UrlList.TestTasks_Root + "/" + task.Id);

                // 20141215
                // _restTemplate.Put(UrlList.TestTasks_Root + "/" + task.Id, task);
                var updatingTaskResponse = _restTemplate.Exchange(UrlList.TestTasks_Root + "/" + task.Id, HttpMethod.PUT, new HttpEntity(task));

                Trace.TraceInformation("UpdateTask(ITestTask task).2");

                if (HttpStatusCode.OK == updatingTaskResponse.StatusCode)
                {
                    return(true);
                }
                throw new UpdateTaskException("Failed to update task '" + task.Name + "'");
                // 20141215
                // return true;
            }
            catch (Exception eOnUpdatingTask) {
                // TODO: AOP
                Trace.TraceError("UpdateTask(ITestTask task)");
                Trace.TraceError(eOnUpdatingTask.Message);
                throw new UpdateTaskException("Failed to update task '" + task.Name + "'");
            }
        }
예제 #10
0
        internal async Task <TestProject> CreateCloneAsync(ITestTask test)
        {
            var rv = Clone();
            await rv.CreateCopyAsync(test);

            return(rv);
        }
예제 #11
0
 public virtual void UpdateTestClientWithActiveTask(ITestClient testClient, ITestTask actualTask)
 {
     testClient.Status = TestClientStatuses.Running;
     testClient.TaskId = actualTask.Id;
     testClient.TaskName = actualTask.Name;
     testClient.TestRunId = actualTask.TestRunId;
 }
예제 #12
0
 public virtual bool SendTaskResult(ITestTask task, Guid clientId)
 {
     try {
         
         // 20141211
         // TODO: AOP
         Trace.TraceInformation("SendTaskResult(ITestTask task, Guid clientId).1: client id = {0}, task id = {1}, task name = {2}, url = {3}", clientId, task.Id, task.Name, UrlList.CurrentTaskForClientById + "/" + clientId);
         
         // 20141215
         // _restTemplate.Put(UrlList.CurrentTaskForClientById + "/" + clientId, task);
         var sendingTaskResultResponse = _restTemplate.Exchange(UrlList.CurrentTaskForClientById + "/" + clientId, HttpMethod.PUT, new HttpEntity(task));
         
         Trace.TraceInformation("SendTaskResult(ITestTask task, Guid clientId).2");
         
         if (HttpStatusCode.OK == sendingTaskResultResponse.StatusCode)
             return true;
         throw new UpdateTaskException("Failed to send results to task");
         
         // 20141215
         // return true;
     }
     catch (Exception eOnSendingTaskResults) {
         // TODO: AOP
         Trace.TraceError("SendTaskResult(ITestTask task, Guid clientId)");
         Trace.TraceError(eOnSendingTaskResults.Message);
         throw new UpdateTaskException("Failed to send results to task");
     }
 }
예제 #13
0
 void runTask(ITestTask task)
 {
     var taskRunner = new TaskRunner();
     var runResult = taskRunner.Run(task);
     // 20150112
     // task.TaskFinished = true
     task.TaskStatus = runResult ? TestTaskStatuses.CompletedSuccessfully : TestTaskStatuses.Interrupted;
 }
예제 #14
0
 void UpdateTask(ITestTask task)
 {
     // 20150918
     // var taskUpdater = new TaskUpdater(new RestRequestCreator());
     // var taskUpdater = new TaskUpdater();
     var taskUpdater = ProxyFactory.Get<TaskUpdater>();
     taskUpdater.UpdateTask(task);
 }
예제 #15
0
        Negotiator returnTaskToClient_StatusOk(ITestClient testClient, ITestTask actualTask)
        {
            ServerObjectFactory.Resolve <TestTaskCollectionMethods>().UpdateTestClientWithActiveTask(testClient, actualTask);

            // 20141020 squeezing a task to its proxy
            return(Negotiate.WithModel(actualTask).WithStatusCode(HttpStatusCode.OK));
            // return Negotiate.WithModel(actualTask.SqueezeTaskToTaskResultProxy()).WithStatusCode(HttpStatusCode.OK);
            // return Negotiate.WithModel(actualTask.SqueezeTaskToTaskCodeProxy()).WithStatusCode(HttpStatusCode.OK);
        }
예제 #16
0
 public static ITestTaskStatusProxy SqueezeTaskToTaskStatusProxy(this ITestTask task)
 {
     return(new TestTaskStatusProxy {
         TaskFinished = false,
         Id = task.Id,
         ClientId = task.ClientId,
         TaskStatus = task.TaskStatus
     });
 }
예제 #17
0
        void UpdateTask(ITestTask task)
        {
            // 20150918
            // var taskUpdater = new TaskUpdater(new RestRequestCreator());
            // var taskUpdater = new TaskUpdater();
            var taskUpdater = ProxyFactory.Get <TaskUpdater>();

            taskUpdater.UpdateTask(task);
        }
예제 #18
0
 public static ITestTaskResultProxy SqueezeTaskToTaskResultProxy(this ITestTask task)
 {
     return(new TestTaskResultProxy {
         Id = task.Id,
         ClientId = task.ClientId,
         TaskStatus = task.TaskStatus,
         TaskResult = task.TaskResult
     });
 }
예제 #19
0
        internal virtual bool IsItTimeToPublishTask(ITestTask task)
        {
            var numberOfMustDoneBeforeTask = task.AfterTask;

            if (0 == numberOfMustDoneBeforeTask)
            {
                return(true);
            }
            return(TaskPool.TasksForClients.Any(t => t.Id == numberOfMustDoneBeforeTask && t.TestRunId == task.TestRunId) &&
                   !TaskPool.TasksForClients.Any(t => t.Id == numberOfMustDoneBeforeTask && t.TestRunId == task.TestRunId && !t.IsFinished()));
        }
예제 #20
0
        void CompleteTestRun(ITestTask task)
        {
            var currentTestRun = TestRunQueue.TestRuns.First(testRun => testRun.Id == task.TestRunId);
            currentTestRun.Status = TaskPool.TasksForClients.Any(tsk => tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.Interrupted) ? TestRunStatuses.Interrupted : TestRunStatuses.CompletedSuccessfully;
            currentTestRun.SetTimeTaken();

            if (!TestRunQueue.TestRuns.Any(testRun => testRun.TestLabId == currentTestRun.TestLabId && testRun.Id != currentTestRun.Id))
                TestLabCollection.TestLabs.First(testLab => testLab.Id == currentTestRun.TestLabId).Status = TestLabStatuses.Free;

            ActivateNextInRowTestRun();
        }
        public virtual ITestTask UpdateTask(ITestTask loadedTask, int taskId)
        {
            if (null == loadedTask)
            {
                // throw new UpdateTaskException("Failed to update task with id = " + taskId);
                // throw new UpdateTaskException(string.Format("Failed to update task with id = {0}", taskId));
                throw new UpdateTaskException(string.Format(Messages.UpdateTaskException, taskId));
            }
            var storedTask = TaskPool.TasksForClients.First(task => task.Id == taskId && task.ClientId == loadedTask.ClientId);

            storedTask.TaskStatus = loadedTask.TaskStatus;
            storedTask.TaskResult = loadedTask.TaskResult;
            storedTask.StartTime  = loadedTask.StartTime;
            // 20150908
            storedTask.TestStatus = loadedTask.TestStatus;

            var taskSelector = ServerObjectFactory.Resolve <TaskSelector>();

            if (storedTask.IsFailed())
            {
                taskSelector.CancelFurtherTasksOfTestClient(storedTask.ClientId);
            }
            // 20150908
            if (storedTask.IsFailed() && storedTask.IsCritical)
            {
                taskSelector.CancelFurtherTasksOfTestRun(storedTask.TestRunId);
            }

            if (storedTask.IsFinished())
            {
                CleanUpClientDetailedStatus(storedTask.ClientId);
            }

            // 20150908
            if (storedTask.IsLastTaskInTestRun())
            {
                // 20150909
                // comment it back
                // if (storedTask.IsLastTaskInTestRun() && storedTask.TaskStatus != TestTaskStatuses.Running) // ??
                CompleteTestRun(storedTask);
            }

            if (storedTask.IsFinished())
            {
                storedTask.SetFinishTime();
            }

            if (storedTask.IsCompletedSuccessfully())
            {
                UpdateNextTask(storedTask);
            }

            return(storedTask);
        }
        void CompleteTestRun(ITestTask task)
        {
            var currentTestRun = TestRunQueue.TestRuns.First(testRun => testRun.Id == task.TestRunId);
            // 20150907
            // currentTestRun.Status = TaskPool.TasksForClients.Any(tsk => tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.ExecutionFailed) ? TestRunStatuses.InterruptedOnTaskFailure : TestRunStatuses.Finished;
            // currentTestRun.Status = TaskPool.TasksForClients.Any(tsk => tsk.TestRunId == currentTestRun.Id && (tsk.TaskStatus == TestTaskStatuses.ExecutionFailed || tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)) ? TestRunStatuses.InterruptedOnTaskFailure : TestRunStatuses.Finished;
            // 20150908
            //currentTestRun.Status =
            //    TaskPool.TasksForClients.Any(
            //        tsk => tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
            //        ? TestRunStatuses.InterruptedOnTaskFailure
            //        : TaskPool.TasksForClients.Any(
            //            tsk =>
            //                tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
            //            ? TestRunStatuses.InterruptedOnCriticalTask
            //            : TestRunStatuses.Finished;

            var tasksForTestRun        = TaskPool.TasksForClients.Where(tsk => tsk.TestRunId == currentTestRun.Id);
            var tasksForTestRunAsArray = tasksForTestRun as ITestTask[] ?? tasksForTestRun.ToArray();

            //currentTestRun.Status = tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
            //    ? TestRunStatuses.InterruptedOnTaskFailure
            //    : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
            //        ? TestRunStatuses.InterruptedOnCriticalTask
            //        : TestRunStatuses.Finished;
            currentTestRun.Status =
                tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
                    ? TestRunStatuses.InterruptedOnCriticalTask
                    : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
                        ? TestRunStatuses.InterruptedOnTaskFailure
                        : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.InterruptedByUser || tsk.TaskStatus == TestTaskStatuses.Canceled)
                            ? TestRunStatuses.Canceled
                            : TestRunStatuses.Finished;

            // 20150807
            // 20150908
            // if (TestRunStatuses.InterruptedOnTaskFailure == currentTestRun.Status)
            // 20150909

            /*
             * if (TestRunStatuses.InterruptedOnTaskFailure == currentTestRun.Status || TestRunStatuses.InterruptedOnCriticalTask == currentTestRun.Status)
             *  currentTestRun.UnregisterClients();
             */

            currentTestRun.SetTimeTaken();

            if (!TestRunQueue.TestRuns.Any(testRun => testRun.TestLabId == currentTestRun.TestLabId && testRun.Id != currentTestRun.Id))
            {
                TestLabCollection.TestLabs.First(testLab => testLab.Id == currentTestRun.TestLabId).Status = TestLabStatuses.Free;
            }

            ActivateNextInRowTestRun();
        }
예제 #23
0
        void CompleteTestRun(ITestTask task)
        {
            var currentTestRun = TestRunQueue.TestRuns.First(testRun => testRun.Id == task.TestRunId);
            // 20150907
            // currentTestRun.Status = TaskPool.TasksForClients.Any(tsk => tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.ExecutionFailed) ? TestRunStatuses.InterruptedOnTaskFailure : TestRunStatuses.Finished;
            // currentTestRun.Status = TaskPool.TasksForClients.Any(tsk => tsk.TestRunId == currentTestRun.Id && (tsk.TaskStatus == TestTaskStatuses.ExecutionFailed || tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)) ? TestRunStatuses.InterruptedOnTaskFailure : TestRunStatuses.Finished;
            // 20150908
            //currentTestRun.Status =
            //    TaskPool.TasksForClients.Any(
            //        tsk => tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
            //        ? TestRunStatuses.InterruptedOnTaskFailure
            //        : TaskPool.TasksForClients.Any(
            //            tsk =>
            //                tsk.TestRunId == currentTestRun.Id && tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
            //            ? TestRunStatuses.InterruptedOnCriticalTask
            //            : TestRunStatuses.Finished;

            var tasksForTestRun = TaskPool.TasksForClients.Where(tsk => tsk.TestRunId == currentTestRun.Id);
            var tasksForTestRunAsArray = tasksForTestRun as ITestTask[] ?? tasksForTestRun.ToArray();
            //currentTestRun.Status = tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
            //    ? TestRunStatuses.InterruptedOnTaskFailure
            //    : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
            //        ? TestRunStatuses.InterruptedOnCriticalTask
            //        : TestRunStatuses.Finished;
            currentTestRun.Status =
                tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.FailedByTestResults)
                    ? TestRunStatuses.InterruptedOnCriticalTask
                    : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.ExecutionFailed)
                        ? TestRunStatuses.InterruptedOnTaskFailure
                        : tasksForTestRunAsArray.Any(tsk => tsk.TaskStatus == TestTaskStatuses.InterruptedByUser || tsk.TaskStatus == TestTaskStatuses.Canceled)
                            ? TestRunStatuses.Canceled
                            : TestRunStatuses.Finished;

            // 20150807
            // 20150908
            // if (TestRunStatuses.InterruptedOnTaskFailure == currentTestRun.Status)
            // 20150909
            /*
            if (TestRunStatuses.InterruptedOnTaskFailure == currentTestRun.Status || TestRunStatuses.InterruptedOnCriticalTask == currentTestRun.Status)
                currentTestRun.UnregisterClients();
            */

            currentTestRun.SetTimeTaken();
            
            if (!TestRunQueue.TestRuns.Any(testRun => testRun.TestLabId == currentTestRun.TestLabId && testRun.Id != currentTestRun.Id))
                TestLabCollection.TestLabs.First(testLab => testLab.Id == currentTestRun.TestLabId).Status = TestLabStatuses.Free;
            
            ActivateNextInRowTestRun();
        }
예제 #24
0
        // 20141020 squeezing a task to its proxy
        void ThenTestTaskPropertiesEqualTo(ITestTask expectedTask, ITestTask actualTask)
        // void ThenTestTaskPropertiesEqualTo(ITestTask expectedTask, ITestTaskProxy actualTask)
        {
            Assert.Equal(expectedTask.Id, actualTask.Id);
            Assert.Equal(expectedTask.Name, actualTask.Name);
            Assert.Equal(expectedTask.TaskStatus, actualTask.TaskStatus);
            // 20150112
            // Xunit.Assert.Equal(expectedTask.TaskFinished, actualTask.TaskFinished);
            // 20141020 squeezing a task to its proxy
            Assert.Equal(expectedTask.IsActive, actualTask.IsActive);
            // Xunit.Assert.Equal(_startTime, actualTask.StartTime);

            // 20150908
            Assert.Equal(expectedTask.TestStatus, actualTask.TestStatus);
        }
예제 #25
0
        public TestTasksModule() : base(UrlList.TestTasks_Root)
        {
            Get[UrlList.TestTasks_CurrentTaskForClientById_relPath] = parameters => ReturnTaskByClientId(parameters.id);

            Put[UrlList.TestTasks_Task] = parameters => {
                // 20141020 squeezing a task to its proxy
                ITestTask loadedTask = this.Bind <TestTask>();
                // ITestTaskProxy loadedTask = this.Bind<TestTaskProxy>();
                // ITestTaskResultProxy loadedTask = this.Bind<TestTaskResultProxy>();
                return(UpdateTask(loadedTask, parameters.id));
            };

            Delete[UrlList.TestTasks_Task] = parameters => DeleteAllocatedTaskById(parameters.id);

            Delete[UrlList.TestTasks_AllLoaded_relPath + UrlList.TestTasks_Task] = parameters => DeleteLoadedTaskById(parameters).id;
        }
예제 #26
0
 void RunTask(ITestTask task)
 {
     // var taskRunner = new TaskRunner();
     var taskRunner = ProxyFactory.Get<TaskRunner>();
     var runResult = taskRunner.Run(task);
     // 20150112
     // task.TaskFinished = true
     task.TaskStatus = runResult ? TestTaskStatuses.CompletedSuccessfully : TestTaskStatuses.ExecutionFailed;
     //// 20150908
     //if (TestStatuses.Failed == TestData.TestSuites.GetOveralStatus())
     //    task.TaskStatus = TestTaskStatuses.FailedByTestResults;
     // 20150910
     //if (task.IsCritical && TestStatuses.Failed == TestData.TestSuites.GetOveralStatus())
     //    task.TaskStatus = TestTaskStatuses.FailedByTestResults;
     task.CheckTestStatus();
 }
예제 #27
0
        void RunTask(ITestTask task)
        {
            // var taskRunner = new TaskRunner();
            var taskRunner = ProxyFactory.Get <TaskRunner>();
            var runResult  = taskRunner.Run(task);

            // 20150112
            // task.TaskFinished = true
            task.TaskStatus = runResult ? TestTaskStatuses.CompletedSuccessfully : TestTaskStatuses.ExecutionFailed;
            //// 20150908
            //if (TestStatuses.Failed == TestData.TestSuites.GetOveralStatus())
            //    task.TaskStatus = TestTaskStatuses.FailedByTestResults;
            // 20150910
            //if (task.IsCritical && TestStatuses.Failed == TestData.TestSuites.GetOveralStatus())
            //    task.TaskStatus = TestTaskStatuses.FailedByTestResults;
            task.CheckTestStatus();
        }
예제 #28
0
        // 20141020 squeezing a task to its proxy
        ITestTask AcceptCurrentTask(ITestTask task)
        // ITestTaskProxy acceptCurrentTask(ITestTaskCodeProxy task)
        {
            Trace.TraceInformation("acceptCurrentTask(ITestTask task).1");

            if (null == task)
            {
                throw new AcceptTaskException("Failed to accept task.");
            }

            // 20141211
            // TODO: AOP
            Trace.TraceInformation("acceptCurrentTask(ITestTask task).2: task id = {0}", task.Id);

            task.TaskStatus = TestTaskStatuses.Running;
            task.StartTimer();
            try {
                // 20141211
                // TODO: AOP
                Trace.TraceInformation("acceptCurrentTask(ITestTask task).3: task id = {0}, url = {1}", task.Id, UrlList.TestTasks_Root + "/" + task.Id);

                // 20141215
                // _restTemplate.Put(UrlList.TestTasks_Root + "/" + task.Id, task);
                var acceptingTaskResponse = _restTemplate.Exchange(UrlList.TestTasks_Root + "/" + task.Id, HttpMethod.PUT, new HttpEntity(task));

                Trace.TraceInformation("acceptCurrentTask(ITestTask task).4");

                if (HttpStatusCode.OK == acceptingTaskResponse.StatusCode)
                {
                    return(task);
                }
                throw new AcceptTaskException("Failed to accept task '" + task.Name + "'");
                // 20141215
                // return task;
            }
            catch (RestClientException eAcceptingTask) {
                // TODO: AOP
                Trace.TraceError("acceptCurrentTask(ITestTask task)");
                Trace.TraceError(eAcceptingTask.Message);
                throw new AcceptTaskException("Failed to accept task '" + task.Name + "'. " + eAcceptingTask.Message);
            }
        }
예제 #29
0
 public JobTaskService(IBuildTask buildTask,
                       ICloneTask cloneTask,
                       IDeployTask deployTask,
                       IDeployDbTask deployDbTask,
                       IGenerateTask generateTask,
                       IMergeTask mergeTask,
                       IPublishArtifactTask publishArtifactTask,
                       IPushTask pushTask,
                       ITestTask testTask)
 {
     BuildTask           = buildTask;
     CloneTask           = cloneTask;
     DeployTask          = deployTask;
     DeployDbTask        = deployDbTask;
     GenerateTask        = generateTask;
     MergeTask           = mergeTask;
     PublishArtifactTask = publishArtifactTask;
     PushTask            = pushTask;
     TestTask            = testTask;
 }
예제 #30
0
        public async Task CreateCopyAsync(ITestTask test = null)
        {
            var directory = DirectoryUtilities.CreateTemporaryDirectory(test?.TestName ?? System.IO.Path.GetFileNameWithoutExtension(Path));

            Directory.CreateDirectory(directory);
            var original_path = Path;

            Path = System.IO.Path.Combine(directory, System.IO.Path.GetFileName(Path));

            await Task.Yield();

            XmlDocument doc;

            doc = new XmlDocument();
            doc.LoadWithoutNetworkAccess(original_path);
            var original_name = System.IO.Path.GetFileName(original_path);

            if (original_name.Contains("GuiUnit_NET") || original_name.Contains("GuiUnit_xammac_mobile"))
            {
                // The GuiUnit project files writes stuff outside their project directory using relative paths,
                // but override that so that we don't end up with multiple cloned projects writing stuff to
                // the same location.
                doc.SetOutputPath("bin\\$(Configuration)");
                doc.SetNode("DocumentationFile", "bin\\$(Configuration)\\nunitlite.xml");
            }
            doc.ResolveAllPaths(original_path);

            var projectReferences = new List <TestProject> ();

            foreach (var pr in doc.GetProjectReferences())
            {
                var tp = new TestProject(pr.Replace('\\', '/'));
                await tp.CreateCopyAsync(test);

                doc.SetProjectReferenceInclude(pr, tp.Path.Replace('/', '\\'));
                projectReferences.Add(tp);
            }
            this.ProjectReferences = projectReferences;

            doc.Save(Path);
        }
예제 #31
0
 public static ITestTaskCodeProxy SqueezeTaskToTaskCodeProxy(this ITestTask task)
 {
     return(new TestTaskCodeProxy {
         Action = task.Action,
         ActionParameters = task.ActionParameters,
         AfterAction = task.AfterAction,
         AfterActionParameters = task.AfterActionParameters,
         BeforeAction = task.BeforeAction,
         BeforeActionParameters = task.BeforeActionParameters,
         Id = task.Id,
         ClientId = task.ClientId,
         Name = task.Name,
         PreviousTaskResult = task.PreviousTaskResult,
         TaskBanner = task.TaskBanner,
         TimeLimit = task.TimeLimit,
         StartTime = task.StartTime,
         TaskStatus = task.TaskStatus,
         TaskType = task.TaskType,
         TaskRuntimeType = task.TaskRuntimeType
     });
 }
예제 #32
0
 public bool UpdateNextTask(ITestTask storedTask)
 {
     // ITestTask nextTask = null;
     ITestTask nextTask;
     var taskSorter = ServerObjectFactory.Resolve<TaskSelector>();
     try
     {
         nextTask = taskSorter.GetNextLegitimateTask(storedTask.ClientId, storedTask.Id);
     }
     catch (Exception eFailedToGetNextTask)
     {
         // TODO: AOP
         // Trace.TraceError("updateNextTaskAndReturnOk(TaskSelector taskSorter, ITestTask storedTask)");
         // Trace.TraceError(eFailedToGetNextTask.Message);
         throw new FailedToGetNextTaskException(eFailedToGetNextTask.Message);
     }
     if (null == nextTask)
         return true;
     nextTask.PreviousTaskResult = storedTask.TaskResult;
     nextTask.PreviousTaskId = storedTask.Id;
     return true;
 }
예제 #33
0
        public virtual ITestTask UpdateTask(ITestTask loadedTask, int taskId)
        {
            if (null == loadedTask)
                // throw new UpdateTaskException("Failed to update task with id = " + taskId);
                // throw new UpdateTaskException(string.Format("Failed to update task with id = {0}", taskId));
                throw new UpdateTaskException(string.Format(Messages.UpdateTaskException, taskId));
            var storedTask = TaskPool.TasksForClients.First(task => task.Id == taskId && task.ClientId == loadedTask.ClientId);
            storedTask.TaskStatus = loadedTask.TaskStatus;
            storedTask.TaskResult = loadedTask.TaskResult;
            storedTask.StartTime = loadedTask.StartTime;
            // 20150908
            storedTask.TestStatus = loadedTask.TestStatus;

            var taskSelector = ServerObjectFactory.Resolve<TaskSelector>();

            if (storedTask.IsFailed())
                taskSelector.CancelFurtherTasksOfTestClient(storedTask.ClientId);
            // 20150908
            if (storedTask.IsFailed() && storedTask.IsCritical)
                taskSelector.CancelFurtherTasksOfTestRun(storedTask.TestRunId);

            if (storedTask.IsFinished())
                CleanUpClientDetailedStatus(storedTask.ClientId);

            // 20150908
            if (storedTask.IsLastTaskInTestRun())
            // 20150909
            // comment it back
            // if (storedTask.IsLastTaskInTestRun() && storedTask.TaskStatus != TestTaskStatuses.Running) // ??
                CompleteTestRun(storedTask);

            if (storedTask.IsFinished())
                storedTask.SetFinishTime();

            if (storedTask.IsCompletedSuccessfully())
                UpdateNextTask(storedTask);

            return storedTask;
        }
예제 #34
0
 public static ITestTask CloneTaskForNewTestClient(this ITestTask task)
 {
     // 20150904
     return(new TestTask {
         // return new TestTask(task.TaskRuntimeType) {
         Action = task.Action,
         ActionParameters = task.ActionParameters,
         AfterAction = task.AfterAction,
         AfterActionParameters = task.AfterActionParameters,
         BeforeAction = task.BeforeAction,
         BeforeActionParameters = task.BeforeActionParameters,
         // ClientId = 0,
         TaskFinished = false,
         ExpectedResult = task.ExpectedResult,
         Id = task.Id,
         AfterTask = task.AfterTask,
         IsActive = task.IsActive,
         IsCritical = task.IsCritical,
         IsCancel = task.IsCancel,
         Name = task.Name,
         PreviousTaskId = task.PreviousTaskId,         // ??
         PreviousTaskResult = task.PreviousTaskResult, // ??
         TaskBanner = task.TaskBanner,
         RetryCount = task.RetryCount,
         Rule = task.Rule,
         TaskStatus = task.TaskStatus,
         StoryId = task.StoryId,
         TaskResult = task.TaskResult, // ??
         TimeLimit = task.TimeLimit,
         WorkflowId = task.WorkflowId,
         TestRunId = task.TestRunId,
         TaskType = task.TaskType,
         TaskRuntimeType = task.TaskRuntimeType,
         StartTime = task.StartTime
                     // 20150908
         ,
         TestStatus = task.TestStatus
     });
 }
예제 #35
0
        public virtual bool Run(ITestTask task)
        {
            // TODO: move to an aspect
            try {
                Trace.TraceInformation("Run(ITestTask task).1");

                var runnerSelector = new TaskRunnerSelector();

                Trace.TraceInformation("Run(ITestTask task).2");

                var runner = runnerSelector.GetRunnableClient(task.TaskRuntimeType);

                Trace.TraceInformation("Run(ITestTask task).3");

                var result = runner.RunBeforeAction(task.BeforeAction, task.BeforeActionParameters, task.PreviousTaskResult);

                Trace.TraceInformation("Run(ITestTask task).4");

                if (!result)
                {
                    return(result);
                }

                Trace.TraceInformation("Run(ITestTask task).5");

                result = runner.RunMainAction(task.Action, task.ActionParameters, task.PreviousTaskResult);

                Trace.TraceInformation("Run(ITestTask task).6");

                return(!result ? result : runner.RunAfterAction(task.AfterAction, task.AfterActionParameters, task.PreviousTaskResult));
            }
            catch (Exception eOnRunningTaskCode) {
                // TODO: AOP
                Trace.TraceError("Run(ITestTask task)");
                Trace.TraceError(eOnRunningTaskCode.Message);
                return(false);
            }
        }
        public virtual bool UpdateNextTask(ITestTask storedTask)
        {
            ITestTask nextTask;
            var       taskSorter = ServerObjectFactory.Resolve <TaskSelector>();

            try
            {
                nextTask = taskSorter.GetNextLegitimateTask(storedTask.ClientId, storedTask.Id);
            }
            catch (Exception eFailedToGetNextTask)
            {
                // TODO: AOP
                // Trace.TraceError("updateNextTaskAndReturnOk(TaskSelector taskSorter, ITestTask storedTask)");
                // Trace.TraceError(eFailedToGetNextTask.Message);
                throw new FailedToGetNextTaskException(eFailedToGetNextTask.Message);
            }
            if (null == nextTask)
            {
                return(true);
            }
            nextTask.PreviousTaskResult = storedTask.TaskResult;
            nextTask.PreviousTaskId     = storedTask.Id;
            return(true);
        }
예제 #37
0
 void updateTask(ITestTask task)
 {
     var taskUpdater = new TaskUpdater(new RestRequestCreator());
     taskUpdater.UpdateTask(task);
 }
예제 #38
0
 // 20141020 squeezing a task to its proxy
 HttpStatusCode UpdateTask(ITestTask loadedTask, int taskId)
 // HttpStatusCode updateTask(ITestTaskResultProxy loadedTask, int taskId)
 {
     ServerObjectFactory.Resolve <TestTaskCollectionMethods>().UpdateTask(loadedTask, taskId);
     return(HttpStatusCode.OK);
 }
예제 #39
0
 public static string GetTestColor(this ITestTask test)
 {
     if (test.NotStarted)
     {
         return("black");
     }
     else if (test.InProgress)
     {
         if (test.Building)
         {
             return("darkblue");
         }
         else if (test.Running)
         {
             return("lightblue");
         }
         else
         {
             return("blue");
         }
     }
     else
     {
         if (test.Crashed)
         {
             return("maroon");
         }
         else if (test.HarnessException)
         {
             return("orange");
         }
         else if (test.TimedOut)
         {
             return("purple");
         }
         else if (test.BuildFailure)
         {
             return("darkred");
         }
         else if (test.Failed)
         {
             return("red");
         }
         else if (test.BuildSucceeded)
         {
             return("lightgreen");
         }
         else if (test.Succeeded)
         {
             return("green");
         }
         else if (test.Ignored)
         {
             return("gray");
         }
         else if (test.Waiting)
         {
             return("darkgray");
         }
         else if (test.DeviceNotFound)
         {
             return("orangered");
         }
         else
         {
             return("pink");
         }
     }
 }
예제 #40
0
        Negotiator returnTaskToClient_StatusOk(ITestClient testClient, ITestTask actualTask)
        {
            ServerObjectFactory.Resolve<TestTaskCollectionMethods>().UpdateTestClientWithActiveTask(testClient, actualTask);

            // 20141020 squeezing a task to its proxy
            return Negotiate.WithModel(actualTask).WithStatusCode(HttpStatusCode.OK);
            // return Negotiate.WithModel(actualTask.SqueezeTaskToTaskResultProxy()).WithStatusCode(HttpStatusCode.OK);
            // return Negotiate.WithModel(actualTask.SqueezeTaskToTaskCodeProxy()).WithStatusCode(HttpStatusCode.OK);
        }
예제 #41
0
 // 20141020 squeezing a task to its proxy
 HttpStatusCode UpdateTask(ITestTask loadedTask, int taskId)
 // HttpStatusCode updateTask(ITestTaskResultProxy loadedTask, int taskId)
 {
     ServerObjectFactory.Resolve<TestTaskCollectionMethods>().UpdateTask(loadedTask, taskId);
     return HttpStatusCode.OK;
 }
예제 #42
0
 internal virtual bool IsItTimeToPublishTask(ITestTask task)
 {
     var numberOfMustDoneBeforeTask = task.AfterTask;
     if (0 == numberOfMustDoneBeforeTask) return true;
     return TaskPool.TasksForClients.Any(t => t.Id == numberOfMustDoneBeforeTask) && !TaskPool.TasksForClients.Any(t => t.Id == numberOfMustDoneBeforeTask && !t.IsFinished());
 }
예제 #43
0
 // 20141020 squeezing a task to its proxy
 void ThenTestTaskIsNull(ITestTask task)
 // void ThenTestTaskIsNull(ITestTaskProxy task)
 {
     Assert.Equal(null, task);
 }
예제 #44
0
 // 20141020 squeezing a task to its proxy
 void ThenTestTaskPropertiesEqualTo(ITestTask expectedTask, ITestTask actualTask, TestTaskStatuses status)
 // void ThenTestTaskPropertiesEqualTo(ITestTask expectedTask, ITestTaskProxy actualTask, TestTaskStatuses status)
 {
     expectedTask.TaskStatus = status;
     ThenTestTaskPropertiesEqualTo(expectedTask, actualTask);
 }
예제 #45
0
 // 20141020 squeezing a task to its proxy
 ITestTask AcceptCurrentTask(ITestTask task)
 // ITestTaskProxy acceptCurrentTask(ITestTaskCodeProxy task)
 {
     Trace.TraceInformation("acceptCurrentTask(ITestTask task).1");
     
     if (null == task)
         throw new AcceptTaskException("Failed to accept task.");
     
     // 20141211
     // TODO: AOP
     Trace.TraceInformation("acceptCurrentTask(ITestTask task).2: task id = {0}", task.Id);
     
     task.TaskStatus = TestTaskStatuses.Running;
     task.StartTimer();
     try {
         
         // 20141211
         // TODO: AOP
         Trace.TraceInformation("acceptCurrentTask(ITestTask task).3: task id = {0}, url = {1}", task.Id, UrlList.TestTasks_Root + "/" + task.Id);
         
         // 20141215
         // _restTemplate.Put(UrlList.TestTasks_Root + "/" + task.Id, task);
         var acceptingTaskResponse = _restTemplate.Exchange(UrlList.TestTasks_Root + "/" + task.Id, HttpMethod.PUT, new HttpEntity(task));
         
         Trace.TraceInformation("acceptCurrentTask(ITestTask task).4");
         
         if (HttpStatusCode.OK == acceptingTaskResponse.StatusCode)
             return task;
         throw new AcceptTaskException("Failed to accept task '" + task.Name + "'");
         // 20141215
         // return task;
     }
     catch (RestClientException eAcceptingTask) {
         // TODO: AOP
         Trace.TraceError("acceptCurrentTask(ITestTask task)");
         Trace.TraceError(eAcceptingTask.Message);
         throw new AcceptTaskException("Failed to accept task '" + task.Name + "'. " + eAcceptingTask.Message);
     }
 }
예제 #46
0
 void ThenTestTaskStatusIs(ITestTask testTask, TestTaskStatuses status)
 {
     Assert.Equal(status, testTask.TaskStatus);
 }
예제 #47
0
        internal override void Execute()
        {
            var cmdlet         = (ReceiveTmxTestTaskCommand)Cmdlet;
            var clientSettings = ClientSettings.Instance;

            clientSettings.StopImmediately = false;

            // 20150918
            // var taskLoader = new TaskLoader(new RestRequestCreator());
            // var taskLoader = new TaskLoader();
            var taskLoader = ProxyFactory.Get <TaskLoader>();
            // 20141020 squeezing a task to its proxy
            ITestTask task = null;
            // ITestTaskProxy task = null;
            // ITestTaskCodeProxy task = null;

            // temporarily
            // TODO: to a template method
            var startTime = DateTime.Now;

            while (!clientSettings.StopImmediately)
            {
                // TODO: move to aspect
                try {
                    task = taskLoader.GetCurrentTask();
                }
                catch (ClientNotRegisteredException) {
                    if (Guid.Empty != ClientSettings.Instance.ClientId && string.Empty != ClientSettings.Instance.ServerUrl)
                    {
                        // 20150918
                        // var registration = new Registration(new RestRequestCreator());
                        // var registration = new Registration();
                        var registration = ProxyFactory.Get <Registration>();
                        ClientSettings.Instance.ClientId = registration.SendRegistrationInfoAndGetClientId(ClientSettings.Instance.CurrentClient.CustomString);
                    }

                    // TODO: AOP
                    Trace.TraceWarning("ReceiveTestTaskCommand.1");
                    // temporary
                    Trace.TraceWarning("ClientNotRegisteredException");

                    throw;
                }
                catch (Exception e) {
                    // NullreferenceException

                    // TODO: AOP
                    Trace.TraceWarning("ReceiveTestTaskCommand.2");
                    // temporary
                    Trace.TraceWarning(e.Message);
                }

                if (null != task)
                {
                    break;
                }

                if (!cmdlet.Continuous)
                {
                    if ((DateTime.Now - startTime).TotalSeconds >= cmdlet.Seconds)
                    {
                        throw new Exception("Failed to receive a task in " + cmdlet.Seconds + " seconds");
                    }
                }

                System.Threading.Thread.Sleep(Preferences.ReceivingTaskSleepIntervalMilliseconds);
            }

            clientSettings.StopImmediately = false;
            clientSettings.CurrentTask     = task;

            cmdlet.WriteObject(task);
        }
예제 #48
0
        public async Task CreateCopyAsync(ILog log, IProcessManager processManager, ITestTask test)
        {
            var directory = DirectoryUtilities.CreateTemporaryDirectory(test?.TestName ?? System.IO.Path.GetFileNameWithoutExtension(Path));

            Directory.CreateDirectory(directory);
            var original_path = Path;

            Path = System.IO.Path.Combine(directory, System.IO.Path.GetFileName(Path));

            await Task.Yield();

            XmlDocument doc;

            doc = new XmlDocument();
            doc.LoadWithoutNetworkAccess(original_path);
            var original_name = System.IO.Path.GetFileName(original_path);

            if (original_name.Contains("GuiUnit_NET") || original_name.Contains("GuiUnit_xammac_mobile"))
            {
                // The GuiUnit project files writes stuff outside their project directory using relative paths,
                // but override that so that we don't end up with multiple cloned projects writing stuff to
                // the same location.
                doc.SetOutputPath("bin\\$(Configuration)");
                doc.SetNode("DocumentationFile", "bin\\$(Configuration)\\nunitlite.xml");
            }
            doc.ResolveAllPaths(original_path);

            if (doc.IsDotNetProject())
            {
                // Many types of files below the csproj directory are included by default,
                // which means that we have to include them manually in the cloned csproj,
                // because the cloned project is stored in a very different directory.
                var test_dir = System.IO.Path.GetDirectoryName(original_path);

                // Get all the files in the project directory from git
                using var process                  = new Process();
                process.StartInfo.FileName         = "git";
                process.StartInfo.Arguments        = "ls-files";
                process.StartInfo.WorkingDirectory = test_dir;
                var stdout = new MemoryLog()
                {
                    Timestamp = false
                };
                var result = await processManager.RunAsync(process, log, stdout, stdout, timeout : TimeSpan.FromSeconds(15));

                if (!result.Succeeded)
                {
                    throw new Exception($"Failed to list the files in the directory {test_dir} (TimedOut: {result.TimedOut} ExitCode: {result.ExitCode}):\n{stdout}");
                }

                var files = stdout.ToString().Split('\n');
                foreach (var file in files)
                {
                    var ext          = System.IO.Path.GetExtension(file);
                    var full_path    = System.IO.Path.Combine(test_dir, file);
                    var windows_file = full_path.Replace('/', '\\');

                    if (file.Contains(".xcasset"))
                    {
                        doc.AddInclude("ImageAsset", file, windows_file, true);
                        continue;
                    }

                    switch (ext.ToLowerInvariant())
                    {
                    case ".cs":
                        doc.AddInclude("Compile", file, windows_file, true);
                        break;

                    case ".plist":
                        doc.AddInclude("None", file, windows_file, true);
                        break;

                    case ".storyboard":
                        doc.AddInclude("InterfaceDefinition", file, windows_file, true);
                        break;

                    case ".gitignore":
                    case ".csproj":
                    case ".props":               // Directory.Build.props
                    case "":                     // Makefile
                        break;                   // ignore these files

                    default:
                        Console.WriteLine($"Unknown file: {file} (extension: {ext}). There might be a default inclusion behavior for this file.");
                        break;
                    }
                }

                // The global.json and NuGet.config files make sure we use the locally built packages.
                var dotnet_test_dir  = System.IO.Path.Combine(test.RootDirectory, "dotnet");
                var global_json      = System.IO.Path.Combine(dotnet_test_dir, "global.json");
                var nuget_config     = System.IO.Path.Combine(dotnet_test_dir, "NuGet.config");
                var target_directory = directory;
                File.Copy(global_json, System.IO.Path.Combine(target_directory, System.IO.Path.GetFileName(global_json)), true);
                log.WriteLine($"Copied {global_json} to {target_directory}");
                File.Copy(nuget_config, System.IO.Path.Combine(target_directory, System.IO.Path.GetFileName(nuget_config)), true);
                log.WriteLine($"Copied {nuget_config} to {target_directory}");
            }

            var projectReferences = new List <TestProject> ();

            foreach (var pr in doc.GetProjectReferences())
            {
                var tp = new TestProject(pr.Replace('\\', '/'));
                await tp.CreateCopyAsync(log, processManager, test);

                doc.SetProjectReferenceInclude(pr, tp.Path.Replace('/', '\\'));
                projectReferences.Add(tp);
            }
            this.ProjectReferences = projectReferences;

            doc.Save(Path);
        }