示例#1
0
文件: TestSuite.cs 项目: wangn6/rep2
        public static TestSuite CreateSuite(TestSuite instance)
        {
            try
            {
                TestSuite ts = null;
                using (ES1AutomationEntities context = new Core.Model.ES1AutomationEntities())
                {
                    instance.IsActive = true;
                    ts = context.TestSuites.Add(instance);
                    context.SaveChanges();
                }
                if (ts.Type == (int)SuiteType.Dynamic || ts.Type == (int) SuiteType.NotExisting)//user created test suite
                {
                    TestSuite root = TestSuite.GetRootNodeOfUserCustomizedTestSuites();
                    root.AddSubTestSuite(ts.SuiteId);
                }

                return ts;
            }
            catch (Exception e)
            {
                ATFEnvironment.Log.logger.Error(e);
                return null;
            }
        }
示例#2
0
文件: TestSuite.cs 项目: wangn6/rep2
 public static TestSuite CreateOrUpdateTestSuite(TestSuite testSuite)
 {
     TestSuite suite = TestSuite.GetTestSuiteByProviderIdSourceIdAndType(testSuite.ProviderId.Value, testSuite.SourceId, testSuite.Type);
     if (suite == null)
     {
         return TestSuite.CreateSuite(testSuite);
     }
     else
     {
         testSuite.SuiteId = suite.SuiteId;
         testSuite.Update();
         return testSuite;
     }
 }
示例#3
0
文件: TestSuite.cs 项目: wangn6/rep2
 public static List<TestSuite> GetAllSubSuites(TestSuite suite, bool recursive = false)
 {
     List<TestSuite> subSuites = new List<TestSuite>();
     List<int> subSuiteIds = GetAllSubSuiteIds(suite.SuiteId, recursive, 0);
     foreach (int id in subSuiteIds)
     {
         subSuites.Add(TestSuite.GetTestSuite(id));
     }
     return subSuites.OrderBy(ts=>ts.SourceId).ToList();
 }
示例#4
0
 private void CreateOrUpdateProjectLevelSuite(TestSuite suite)
 {
     IList<RQMProject> projects = RQMServer.GetAllProjects();
     List<TestSuite> suites = TestSuite.GetAllSubSuites(suite);
     RQMProject project = projects.Where(p => p.Alias == this.ProjectAlias).FirstOrDefault();
     if (null != project)
     {
         TestSuite projectSuite = suites.Where(s => s.Name == project.Title).FirstOrDefault();
         if (null == projectSuite)
         {
             TestSuite temp = new TestSuite
             {
                 Name = project.Title,
                 ProviderId = Provider.ProviderId,
                 IsActive = true,
                 Description = string.Format("Title=Project {0} in RQM, Type={1}", project.Title, SuiteType.Static.ToString()),
                 CreateBy = 0,
                 Type = 0,
                 SubSuites = null,
                 TestCases = null,
             };
             projectSuite = TestSuite.CreateSuite(temp);
             suite.AddSubTestSuite(projectSuite.SuiteId);
             CreateOrUpdateModuleLevelSuite(projectSuite, project);
         }
         else
         {
             //we don't remove the project from the hierarchy even it doesn't exist on RQM
             //because not all the project are on RQM and we may have some customized project
             CreateOrUpdateModuleLevelSuite(projectSuite, project);
         }
     }
 }
示例#5
0
文件: TestSuite.cs 项目: wangn6/rep2
        public static bool Delete(TestSuite instance)
        {
            try
            {
                List<TestSuite> parentSuites = null;

                using (ES1AutomationEntities context = new Core.Model.ES1AutomationEntities())
                {
                    if (TestSuite.GetTestSuite(instance.SuiteId) == null)
                        return false;
                    context.TestSuites.Attach(instance);
                    instance.IsActive = false;
                    context.SaveChanges();

                    string sId = instance.SuiteId.ToString();
                    parentSuites = (from ts in context.TestSuites
                                    where ts.SubSuites.Contains(sId)
                                    select ts).ToList();

                }

                foreach (TestSuite ts in parentSuites)
                {
                    ts.DeleteSubTestSuite(instance.SuiteId);
                }
            }

            catch (Exception e)
            {
                ATFEnvironment.Log.logger.Error(e);
                return false;
            }

            return true;
        }
示例#6
0
        private void CreateOrUpdateFeatureLevelSuite(TestSuite moduleSuite, RQMProject project)
        {
            IList<RQMFeature> modules = RQMServer.GetFeaturesOfProject(project);
            IList<TestSuite> featureSuites = TestSuite.GetAllSubSuites(moduleSuite);
            moduleSuite.DisableSubTestSuites();
            RQMFeature module = modules.Where(m => m.Title == moduleSuite.Name).FirstOrDefault();
            if (null != module)
            {
                IList<RQMFeature> features = module.SubFeatures;
                foreach (RQMFeature feature in features)
                {
                    TestSuite featureSuite = featureSuites.Where(s => s.Name == feature.Title).FirstOrDefault();
                    if (null == featureSuite)
                    {
                        TestSuite temp = new TestSuite
                        {
                            Name = feature.Title,
                            ProviderId = Provider.ProviderId,
                            IsActive = true,
                            TestCases = null,
                            SubSuites = null,
                            Description = string.Format("Title=Feature {0} in RQM, Type={1}", feature.Title, SuiteType.Static.ToString()),
                            CreateBy = 0,
                            ModityBy = 0,
                        };
                        featureSuite = TestSuite.CreateSuite(temp);
                        moduleSuite.AddSubTestSuite(featureSuite.SuiteId);
                    }
                    else
                    {
                        featureSuite.IsActive = true;
                        featureSuite.ProviderId = Provider.ProviderId;
                        featureSuite.Update();
                    }
                }
            }
            else
            {

            }
        }
示例#7
0
 private void CreateOrUpdateModuleLevelSuite(TestSuite projectSuite, RQMProject project)
 {
     IList<RQMModule> modules = RQMServer.GetModulesOfProject(project);
     IList<TestSuite> moduleSuites = TestSuite.GetAllSubSuites(projectSuite);
     //disable all the module level suites firstly
     projectSuite.DisableSubTestSuites();
     //iterate all the modules in RQM server, enable the existing one and add new ones
     foreach (RQMModule m in modules)
     {
         TestSuite moduleSuite = moduleSuites.Where(s => s.Name == m.Title).FirstOrDefault();
         if (null == moduleSuite)
         {
             //add module suite
             TestSuite temp = new TestSuite
             {
                 Name = m.Title,
                 ProviderId = Provider.ProviderId,
                 IsActive = true,
                 Description = string.Format("Title=Module {0} in RQM, Type={1}", m.Title, SuiteType.Static.ToString()),
                 TestCases = null,
                 SubSuites = null,
                 CreateBy = 0,
                 ModityBy = 0,
             };
             moduleSuite = TestSuite.CreateSuite(temp);
             projectSuite.AddSubTestSuite(moduleSuite.SuiteId);
             CreateOrUpdateFeatureLevelSuite(moduleSuite, project);
         }
         else
         {
             moduleSuite.IsActive = true;
             moduleSuite.ProviderId = Provider.ProviderId;
             moduleSuite.Update();
             CreateOrUpdateFeatureLevelSuite(moduleSuite, project);
         }
     }
 }
示例#8
0
        /// <summary>
        /// Sync all the test suite, here we only use the test suite to get test cases dependence.
        /// </summary>
        public void SyncAllTestSuite()
        {
            try
            {

                ATFEnvironment.Log.logger.Info("RQM Login");

                RQMServer.UserAuthentication(Username, Password);

                ATFEnvironment.Log.logger.Info("RQM Sync Test Suites Start");

                // disable all test suites of this provider
                //TODO, there's an assumption that only the test suite from RQM with ForAutomation=True can be with SuiteType.Dependence.
                //So here we disable all the dependence suite and will enable them based on whether it exists in RQM any more
                TestSuite.DisableTestSutiesByProviderAndType(this.Provider.ProviderId, SuiteType.Dependence);

                //disable all the test suites from the external provider, typically the normal test suite defined in RQM, ForAutomation=Falses
                TestSuite rootSuiteOfExternalProviders = TestSuite.GetRootNodeOfNormalTestSuitesFromExternalProvider();

                rootSuiteOfExternalProviders.DisableSubTestSuitesOfProvider(Provider.ProviderId);

                Product product = GetProductOfTestCaseProvider();//Product.GetProductByName(RQMProjectProductMapping["SourceOne+%28Quality+Management%29"]);

                if (product != null)
                {

                    foreach (RQMTestSuite rqmTestSuite in RQMServer.GetTestSuitesByProject(ProjectAlias))
                    {
                        bool isForAutomation = false;
                        try
                        {
                            isForAutomation = rqmTestSuite.Categories.ContainsKey("ForAutomation") ? bool.Parse(rqmTestSuite.Categories["ForAutomation"]) : false;
                        }
                        catch (Exception)
                        {

                        }

                        string testCaseIdString = string.Empty;
                        foreach (string webId in rqmTestSuite.SubTestCaseSourceIds)
                        {
                            TestCase testCase = TestCase.GetTestCase(webId, this.Provider.ProviderId);
                            //only sync the automated test cases
                            if (testCase != null && testCase.IsAutomated)
                            {
                                if (testCaseIdString == string.Empty)
                                {
                                    testCaseIdString = (testCase.TestCaseId).ToString();
                                }
                                else
                                {
                                    testCaseIdString = testCaseIdString + "," + (testCase.TestCaseId).ToString();
                                }
                            }
                        }

                        TestSuite newSuite = new TestSuite
                                 {
                                     ProviderId = this.Provider.ProviderId,
                                     SourceId = rqmTestSuite.SourceId,
                                     Name = string.Format(@"[{0,6}]:{1}", rqmTestSuite.SourceId, rqmTestSuite.Title),
                                     Type = (int)SuiteType.Static,
                                     SubSuites = null,
                                     TestCases = testCaseIdString,
                                     IsActive = true,
                                     CreateBy = 0,
                                     ModityBy = 0,
                                 };

                        if (isForAutomation)
                        {
                            newSuite.Type = (int)SuiteType.Dependence;
                            newSuite.Description = string.Format("Title={0}, Weight={1}, SequentialExecution={2}, HaltOnFailure={3}, Type={4}, ForAutomation={5}", rqmTestSuite.Title, rqmTestSuite.Weight, rqmTestSuite.SequentialExecution, rqmTestSuite.HaltOnFailure, SuiteType.Dependence.ToString(), isForAutomation);
                            TestSuite.CreateOrUpdateTestSuite(newSuite);
                        }

                        newSuite.Type = (int)SuiteType.Static;
                        newSuite.Description = string.Format("Title={0}, Weight={1}, SequentialExecution={2}, HaltOnFailure={3}, Type={4}, ForAutomation={5}", rqmTestSuite.Title, rqmTestSuite.Weight, rqmTestSuite.SequentialExecution, rqmTestSuite.HaltOnFailure, SuiteType.Static.ToString(), isForAutomation);
                        TestSuite.CreateOrUpdateTestSuite(newSuite);

                        rootSuiteOfExternalProviders.AddSubTestSuite(newSuite.SuiteId);

                    }
                }

                rootSuiteOfExternalProviders.DeleteInActiveSubTestSuites();

                RQMServer.Logout();

                ATFEnvironment.Log.logger.Info("Logout RQM server");

                ATFEnvironment.Log.logger.Info("RQM Sync Test Suite Finish");
            }
            catch (Exception ex)
            {
                ATFEnvironment.Log.logger.Error("Error met while sync the test suites from RQM.", ex);
            }
        }
示例#9
0
        public void SyncAllTestPlan()
        {
            try
            {
                ATFEnvironment.Log.logger.Info("RQM Login");

                RQMServer.UserAuthentication(Username, Password);

                ATFEnvironment.Log.logger.Info("RQM Sync Test Plans Start");

                //disable all the test suites from the external provider
                TestSuite rootSuiteOfTestPlans = TestSuite.GetRootNodeOfNormalTestPlansFromExternalProvider();

                rootSuiteOfTestPlans.DisableSubTestSuitesOfProvider(Provider.ProviderId);

                Product product = GetProductOfTestCaseProvider();//Product.GetProductByName(RQMProjectProductMapping["SourceOne+%28Quality+Management%29"]);

                if (product != null)
                {
                    IEnumerable<RQMTestSuite> rqmTestPlanSuites = RQMServer.GetTestPlansByProject(ProjectAlias);
                    foreach (RQMTestSuite rqmTestSuite in rqmTestPlanSuites)
                    {
                        //skip the test plan created by Galaxy
                        if (rqmTestSuite.Title.StartsWith(RQMTESTPLANPREFIX))
                        {
                            continue;
                        }

                        string testCaseIdString = string.Empty;
                        foreach (string testCaseWebId in rqmTestSuite.SubTestCaseSourceIds)
                        {
                            TestCase testCase = TestCase.GetTestCase(testCaseWebId, this.Provider.ProviderId);
                            //only sync the automated test cases
                            if (testCase != null && testCase.IsAutomated)
                            {
                                if (testCaseIdString == string.Empty)
                                {
                                    testCaseIdString = (testCase.TestCaseId).ToString();
                                }
                                else
                                {
                                    testCaseIdString = testCaseIdString + "," + (testCase.TestCaseId).ToString();
                                }
                            }
                        }

                        string testSuiteIdString = string.Empty;
                        foreach (string suiteWebId in rqmTestSuite.SubTestSuiteSourceIds)
                        {
                            TestSuite suite = TestSuite.GetTestSuiteByProviderIdSourceIdAndType(this.Provider.ProviderId, suiteWebId, (int)SuiteType.Static);
                            if (suite != null)
                            {
                                if (string.IsNullOrEmpty(testSuiteIdString))
                                {
                                    testSuiteIdString = suite.SuiteId.ToString();
                                }
                                else
                                {
                                    testSuiteIdString = string.Format("{0},{1}", testSuiteIdString, suite.SuiteId);
                                }
                            }
                        }

                        string description = string.Format("Title={0}, Type={1}", rqmTestSuite.Title, SuiteType.TestPlan.ToString());
                        if (rqmTestSuite.Categories != null)
                        {
                            foreach (KeyValuePair<string, string> category in rqmTestSuite.Categories)
                            {
                                description = string.Format("{0}, {1}={2}", description, category.Key, category.Value);
                            }
                        }

                        TestSuite newSuite = new TestSuite
                        {
                            ProviderId = this.Provider.ProviderId,
                            SourceId = rqmTestSuite.SourceId,
                            Name = string.Format(@"[{0,6}]:{1}", rqmTestSuite.SourceId, rqmTestSuite.Title),
                            Type = (int)SuiteType.TestPlan,
                            SubSuites = testSuiteIdString,
                            TestCases = testCaseIdString,
                            IsActive = true,
                            CreateBy = 0,
                            ModityBy = 0,
                            Description = description,
                        };

                        TestSuite testSuite = TestSuite.CreateOrUpdateTestSuite(newSuite);

                        rootSuiteOfTestPlans.AddSubTestSuite(testSuite.SuiteId);
                    }
                }

                rootSuiteOfTestPlans.DeleteInActiveSubTestSuites();

                RQMServer.Logout();

                ATFEnvironment.Log.logger.Info("Logout RQM server");

                ATFEnvironment.Log.logger.Info("RQM Sync Test Plans Finish");
            }
            catch (Exception ex)
            {
                ATFEnvironment.Log.logger.Error("Error happened while sync the test plans from RQM.", ex);
            }
        }
示例#10
0
文件: Core.DTO.cs 项目: wangn6/rep2
        /// <summary>
        /// Invoked when <see cref="ToEntity"/> operation is about to return.
        /// </summary>
        /// <param name="entity"><see cref="TestSuite"/> converted from <see cref="TestSuiteDTO"/>.</param>
partial         static void OnEntity(this TestSuiteDTO dto, TestSuite entity);
示例#11
0
文件: Core.DTO.cs 项目: wangn6/rep2
        /// <summary>
        /// Converts this instance of <see cref="TestSuiteDTO"/> to an instance of <see cref="TestSuite"/>.
        /// </summary>
        /// <param name="dto"><see cref="TestSuiteDTO"/> to convert.</param>
        public static TestSuite ToEntity(this TestSuiteDTO dto)
        {
            if (dto == null) return null;

            var entity = new TestSuite();

            entity.SuiteId = dto.SuiteId;
            entity.Name = dto.Name;
            entity.SubSuites = dto.SubSuites;
            entity.TestCases = dto.TestCases;
            entity.CreateBy = dto.CreateBy;
            entity.CreateTime = dto.CreateTime;
            entity.ModityBy = dto.ModityBy;
            entity.ModifyTime = dto.ModifyTime;
            entity.Description = dto.Description;
            entity.ExecutionCommand = dto.ExecutionCommand;
            entity.Type = dto.Type;

            dto.OnEntity(entity);

            return entity;
        }
示例#12
0
        /// <summary>
        /// Monitor scheduled tasks
        /// </summary>
        public static void MonitorScheduledTasks()
        {
            string message = string.Empty;
            ATFEnvironment.Log.logger.Debug("Monitor scheduled tasks");
            List<AutomationTask> tasksScheduled = AutomationTask.GetActiveAutomationTask((int)TaskStatus.Scheduled);
            if (tasksScheduled == null)
            {
                ATFEnvironment.Log.logger.Debug("Scheduled tasks count: 0");
                return;
            }
            ATFEnvironment.Log.logger.Debug("Scheduled tasks count:" + tasksScheduled.Count().ToString());
            foreach (AutomationTask task in tasksScheduled)
            {
                if (task.RecurrencePattern == (int)RecurrencePattern.AtOnce)
                {
                    // Check for Build
                    message = "Checking specific build for Task: " + task.Name.ToString();
                    ATFEnvironment.Log.logger.Info(message);
                    task.AddProgressInformation(message);
                    if (!GetBuildAndCheckStatusOfItForTask(task))
                    {
                        continue;
                    }

                    // Check for Enviroment
                    ATFEnvironment.Log.logger.Info("Checking specific Enviromnet for Task: " + task.Name.ToString());
                    if (!GetSupporttedEnvironmentAndCheckStatusOfItForTask(task))
                    {
                        continue;
                    }

                    // Get all the test cases for this task, update the test suite(id=task.TestContent) to contains only test cases
                    // The test suite's content may be updated in future, so here we convert the sub test suites into test cases
                    // This is to handle the scenario that after the task is finished, when user look the historical test result, the test case of the task should not be modified.
                    TestSuite testSuite = TestSuite.GetTestSuite(int.Parse(task.TestContent));
                    // Only run the active case
                    List<int> allCasesForTask = null;
                    while (true)
                    {
                        if (!ATFConfiguration.IsTestCasesSuitesSyncing())
                        {
                            List<TestCase> testCases = TestSuite.GetAllCases(testSuite.SuiteId, true);
                            allCasesForTask = testCases.Select(tc => tc.TestCaseId).ToList();
                            break;
                        }
                        else
                        {
                            System.Threading.Thread.Sleep(30 * 1000);
                            task.AddProgressInformation(string.Format("Test cases or suites are being syncing now. Wait 30 seconds."));
                        }
                    }

                    if (allCasesForTask == null || allCasesForTask.Count() <= 0 && testSuite.Type != (int)SuiteType.NotExisting)
                    {
                        ATFEnvironment.Log.logger.Error("No cases to run in Task [" + task.Name + @"], suiteId= " + task.TestContent.ToString());
                        task.AddProgressInformation("No cases to run.");
                        task.SetTaskStatus(TaskStatus.Complete);
                        continue;
                    }
                    else if (testSuite.Type == (int)SuiteType.NotExisting)
                    {
                        try                         // create one job
                        {
                            AutomationJob job = new AutomationJob()
                            {
                                Name = "JobForTask " + task.TaskId.ToString(),
                                Status = (int)JobStatus.Assigned,
                                Type = (int)JobType.Sequence,
                                Priority = task.Priority,
                                RetryTimes = 1,
                                Timeout = ATFConfiguration.GetIntValue("DefaultAutomationJobTimeout"),//1 hours
                                CreateDate = System.DateTime.UtcNow,
                                ModifyDate = System.DateTime.UtcNow,
                                CreateBy = 0,
                                ModifyBy = 0,
                            };
                            AutomationJob bCreateJob = AutomationJob.CreateJob(job);

                            message = string.Format("Job [{0}:{1}] is created.", bCreateJob.JobId, bCreateJob.Name);
                            task.AddProgressInformation(message);
                            ATFEnvironment.Log.logger.Info(message);

                            TaskJobMap map = new TaskJobMap()
                            {
                                TaskId = task.TaskId,
                                JobId = job.JobId,
                            };
                            TaskJobMap.CreateMap(map);

                            task.SetTaskStatus(TaskStatus.Dispatched);
                            message = string.Format("Change Task [{0}] status Scheduled to Dispatched", task.Name);
                            ATFEnvironment.Log.logger.Info(message);
                            task.AddProgressInformation(message);
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("Failed to dispatch task [{0}] to jobs.", task.Name);
                            ATFEnvironment.Log.logger.Error(message, ex);
                            task.AddProgressInformation(message);
                            foreach (AutomationJob job in task.GetJobs())
                            {
                                job.SetJobsStatus(JobStatus.Cancelled);
                            }
                            task.SetTaskStatus(TaskStatus.Failed);
                        }
                    }
                    else
                    {
                        message = string.Format("Totally {0} cases selected.", allCasesForTask.Count);
                        task.AddProgressInformation(message);
                        ATFEnvironment.Log.logger.Info(message);
                        allCasesForTask = allCasesForTask.Distinct().ToList();
                        message = string.Format("Totally {0} distinct cases selected after dedupe.", allCasesForTask.Count);
                        task.AddProgressInformation(message);
                        ATFEnvironment.Log.logger.Info(message);
                        //take the snapshot of the test cases and save it to the task
                        string testCaseIdList = string.Empty;
                        foreach (int caseId in allCasesForTask)
                        {
                            if (string.IsNullOrEmpty(testCaseIdList))
                            {
                                testCaseIdList = caseId.ToString();
                            }
                            else
                            {
                                testCaseIdList = string.Format("{0},{1}", testCaseIdList, caseId);
                            }
                        }

                        // For temporary suite, we'll modify the suite in place, else we'll create another temporary suite to contain the cases at present in the suite.
                        if (testSuite.Type == (int)SuiteType.Temporary)
                        {
                            testSuite.SubSuites = "";
                            testSuite.TestCases = testCaseIdList;
                            testSuite.Update();
                        }
                        else
                        {
                            TestSuite tempSuite = new TestSuite
                            {
                                ProviderId = testSuite.ProviderId,
                                SourceId = testSuite.SourceId,
                                Name = testSuite.Name,
                                Type = (int)SuiteType.Temporary,
                                SubSuites = "",
                                TestCases = testCaseIdList,
                                IsActive = true,
                                CreateBy = 0,
                                ModityBy = 0,
                                Description = testSuite.Description,
                                CreateTime = System.DateTime.UtcNow,
                                ModifyTime = System.DateTime.UtcNow,
                            };
                            TestSuite newSuite = TestSuite.CreateSuite(tempSuite);
                            task.SetTestContent(newSuite.SuiteId.ToString());
                        }

                        // Remove the test case which is not suitable for the support environment
                        allCasesForTask = allCasesForTask.FindAll(delegate(int caseId)
                        {
                            if (CouldThisTestCaseRunOnSupporttedEnvironment(caseId, task.EnvironmentId))
                            {
                                return true;
                            }
                            else
                            {
                                TestCase testCase = TestCase.GetTestCase(caseId);
                                SupportedEnvironment testEnvironment = SupportedEnvironment.GetSupportedEnvironmentById(task.EnvironmentId);
                                message = string.Format(@"Test case [{0}](Platform={1}) could not run on the environment [{2}](Platform={3})", testCase.Name, testCase.GetPlatform().ToString(), testEnvironment.Name, testEnvironment.GetPlatformOfEnvironment().ToString());
                                ATFEnvironment.Log.logger.Warn(message);
                                task.AddProgressInformation(message);
                                return false;
                            }
                        });

                        // Dispatch to JOBs
                        message = string.Format("Dispatching to Jobs for Task [{0}]", task.Name);
                        ATFEnvironment.Log.logger.Info(message);
                        task.AddProgressInformation(message);

                        try
                        {
                            DispatchTaskToJobs(task, allCasesForTask);
                            task.SetTaskStatus(TaskStatus.Dispatched);
                            message = string.Format("Change Task [{0}] status Scheduled to Dispatched", task.Name);
                            ATFEnvironment.Log.logger.Info(message);
                            task.AddProgressInformation(message);
                        }
                        catch (Exception ex)
                        {
                            message = string.Format("Failed to dispatch task [{0}] to jobs.", task.Name);
                            ATFEnvironment.Log.logger.Error(message, ex);
                            task.AddProgressInformation(message);
                            foreach (AutomationJob job in task.GetJobs())
                            {
                                job.SetJobsStatus(JobStatus.Cancelled);
                            }
                            task.SetTaskStatus(TaskStatus.Failed);
                        }
                    }

                }
                else if (task.RecurrencePattern == (int)RecurrencePattern.OneTime)
                {
                    CreateOneTimeWindowsScheduledTask(task);
                    ATFEnvironment.Log.logger.Info("Change Task [" + task.Name.ToString() + "] status Scheduled to Scheduling");
                    task.AddProgressInformation("Change status Scheduled to Scheduling");
                    task.SetTaskStatus(TaskStatus.Scheduling);

                }
                else if (task.RecurrencePattern == (int)RecurrencePattern.Weekly)
                {
                    CreateWeeklyWindowsScheduledTask(task);
                    ATFEnvironment.Log.logger.Info("Change Task [" + task.Name.ToString() + "] status Scheduled to Scheduling");
                    task.AddProgressInformation("Change status Scheduled to Completed");
                    task.SetTaskStatus(TaskStatus.Scheduling);
                }
            }
        }