public void CreateTeamTest()
        {
            EntityListResult <WorkspaceUser> wsUsers = WorkspaceUserTests.GetAllWorkspaceUsers();

            var team = new Team
            {
                Name = "Team_" + Guid.NewGuid(),
                EstimatedVelocity = 50,
                Releases          = EntityList <Release> .Create(ReleaseTests.CreateRelease()),
                TeamLead          = wsUsers.data[0]
            };

            string[] fields      = new string[] { Team.NUMBER_OF_MEMBERS_FIELD, Team.ESTIMATED_VELOCITY_FIELD, Team.TEAM_LEAD_FIELD, Team.TEAM_MEMBERS_FIELD, Team.NAME_FIELD, Team.RELEASES_FIELD };
            var      createdTeam = entityService.Create(workspaceContext, team, fields);

            var r  = createdTeam.Releases;
            var r2 = createdTeam.Releases;

            Assert.AreEqual(team.Name, createdTeam.Name);
            Assert.AreEqual(team.EstimatedVelocity, createdTeam.EstimatedVelocity);
            Assert.AreEqual(1, createdTeam.NumberOfMembers);
            Assert.AreEqual(team.Releases.data[0].Id, createdTeam.Releases.data[0].Id);
        }
Пример #2
0
        public static RunManual CreateManualRun(TestManual parent, string customName = null)
        {
            var name = customName ?? "ManualRun_" + Guid.NewGuid();

            var status = new BaseEntity();

            status.SetValue("id", "list_node.run_native_status.not_completed");
            status.SetValue("type", "list_node");

            var manualRun = new RunManual
            {
                Name         = name,
                Release      = ReleaseTests.CreateRelease(),
                Parent       = parent,
                NativeStatus = status
            };

            var createdManualRun = entityService.Create(workspaceContext, manualRun, new[] { "name", "subtype" });

            Assert.AreEqual(name, createdManualRun.Name, "Mismatched name for newly created manual run");
            Assert.IsTrue(!string.IsNullOrEmpty(createdManualRun.Id), "Manual run id shouldn't be null or empty");
            return(createdManualRun);
        }
        public static RunSuite CreateSuiteRun(string customName = null)
        {
            var name = customName ?? "SuiteRun_" + Guid.NewGuid();

            var status = new BaseEntity();

            status.SetValue("id", "list_node.run_native_status.not_completed");
            status.SetValue("type", "list_node");

            var suiteRun = new RunSuite
            {
                Name         = name,
                Release      = ReleaseTests.CreateRelease(),
                Parent       = CreateTestSuite(),
                NativeStatus = status
            };

            var createdSuiteRun = entityService.Create(workspaceContext, suiteRun, TestHelper.NameSubtypeFields);

            Assert.AreEqual(name, createdSuiteRun.Name, "Mismatched name for newly created test suite run");
            Assert.IsTrue(!string.IsNullOrEmpty(createdSuiteRun.Id), "Test suite run id shouldn't be null or empty");
            return(createdSuiteRun);
        }
Пример #4
0
        public void GetNotDoneDefectsAssinedToReleaseTest()
        {
            Phase PHASE_CLOSED = TestHelper.GetPhaseForEntityByLogicalName(entityService, workspaceContext, WorkItem.SUBTYPE_DEFECT, "phase.defect.closed");

            Defect  defect1 = CreateDefect();
            Defect  defect2 = CreateDefect(PHASE_CLOSED);
            Defect  defect3 = CreateDefect();
            Defect  defect4 = CreateDefect();
            Release release = ReleaseTests.CreateRelease();

            //assign defect to release
            Defect defectForUpdate1 = new Defect(defect1.Id);

            defectForUpdate1.Release = release;
            Defect defectForUpdate2 = new Defect(defect2.Id);

            defectForUpdate2.Release = release;
            Defect defectForUpdate3 = new Defect(defect3.Id);

            defectForUpdate3.Release  = release;
            defectForUpdate3.Severity = getSeverityCritical();

            Defect defectForUpdate4 = new Defect(defect4.Id);

            defectForUpdate4.Release = release;


            EntityList <Defect> listForUpdate = new EntityList <Defect>();

            listForUpdate.data.AddRange(new Defect[] { defectForUpdate1, defectForUpdate2, defectForUpdate3, defectForUpdate4 });

            EntityListResult <Defect> updated = entityService.UpdateEntities <Defect>(workspaceContext, listForUpdate);

            Assert.AreEqual <int?>(4, updated.total_count);

            //Fetch all defects that assigned to release and still not done
            //Fetch defects as work-items
            List <QueryPhrase> queries      = new List <QueryPhrase>();
            LogicalQueryPhrase subtypeQuery = new LogicalQueryPhrase(WorkItem.SUBTYPE_FIELD, WorkItem.SUBTYPE_DEFECT);

            queries.Add(subtypeQuery);

            //condition of release
            QueryPhrase releaseIdPhrase = new LogicalQueryPhrase(WorkItem.ID_FIELD, release.Id);
            QueryPhrase byReleasePhrase = new CrossQueryPhrase(WorkItem.RELEASE_FIELD, releaseIdPhrase);

            queries.Add(byReleasePhrase);

            //There are several phased in "Done" metaphase - there are we are doing condition on metaphase and not on phase
            //condition by metaphase (parent of phase)
            LogicalQueryPhrase  donePhaseNamePhrase = new LogicalQueryPhrase(Metaphase.LOGICAL_NAME_FIELD, "metaphase.work_item.done");
            NegativeQueryPhrase notDonePhrase       = new NegativeQueryPhrase(donePhaseNamePhrase);
            CrossQueryPhrase    phaseIdPhrase       = new CrossQueryPhrase("metaphase", notDonePhrase);
            CrossQueryPhrase    byPhasePhrase       = new CrossQueryPhrase(WorkItem.PHASE_FIELD, phaseIdPhrase);

            queries.Add(byPhasePhrase);

            EntityListResult <WorkItem> entitiesResult = entityService.Get <WorkItem>(workspaceContext, queries, null);

            Assert.AreEqual <int>(3, entitiesResult.total_count.Value);
            Assert.IsTrue(entitiesResult.data[0].Id == defect1.Id || entitiesResult.data[0].Id == defect3.Id || entitiesResult.data[0].Id == defect4.Id);
            Assert.IsTrue(entitiesResult.data[1].Id == defect1.Id || entitiesResult.data[1].Id == defect3.Id || entitiesResult.data[1].Id == defect4.Id);
            Assert.IsTrue(entitiesResult.data[2].Id == defect1.Id || entitiesResult.data[2].Id == defect3.Id || entitiesResult.data[2].Id == defect4.Id);


            //check group by
            GroupResult groupResult = entityService.GetWithGroupBy <WorkItem>(workspaceContext, queries, "severity");

            Assert.AreEqual(2, groupResult.groupsTotalCount);
            Group group1 = groupResult.groups[0];
            Group group2 = groupResult.groups[1];

            if (group1.count == 1)
            {
                Group temp = group1;
                group1 = group2;
                group2 = temp;
            }

            Assert.AreEqual <int>(2, group1.count);
            Assert.AreEqual <String>("list_node.severity.high", group1.value.logical_name);
            Assert.AreEqual <int>(1, group2.count);
            Assert.AreEqual <String>("list_node.severity.urgent", group2.value.logical_name);
        }