def setUpClass(cls): tc1 = TestCase.create(DEFAULT_PROJ, "regression", "regression", caseimportance="high", caselevel="component", caseautomation="notautomated", caseposneg="positive", testtype="functional", subtype1="-") cls.NEW_TEST_CASE = tc1.work_item_id tc2 = TestCase.create(DEFAULT_PROJ, "regression", "regression", caseimportance="high", caselevel="component", caseautomation="notautomated", caseposneg="positive", testtype="functional", subtype1="-") cls.NEW_TEST_CASE2 = tc2.work_item_id Plan.create(plan_id=PLAN_ID, plan_name="regression", project_id=DEFAULT_PROJ, parent_id=None, template_id="release") cls.NEW_PLAN = PLAN_ID
def test_009_update(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.color = "red" plan.update() plan.color = "" plan.reload() self.assertEquals(plan.color, "red")
def test_002_create_plan(self): """This test does the following: * creates a test riun based on the template created in previous test * Verifies that the returned object exists and is not a template """ plan = Plan.create(PLAN_ID, "Regression", DEFAULT_PROJ, None, TEMPLATE_ID) self.assertIsNotNone(plan.plan_id) self.assertFalse(plan.is_template)
def test_001_create_template(self): """This test does the following: * Creates a Plan template with no parent * Verifies that the returned object exists and is a template The parent attribute is not returned """ template = Plan.create_plan_template(TEMPLATE_ID, "Regression", DEFAULT_PROJ, None) self.assertIsNotNone(template.plan_id) self.assertTrue(template.is_template)
def print_plan_ids(self, query): pls = Plan.search(query, sort='due_date', limit=-1, fields=['due_date', 'name', 'plan_id']) ttstr = ('Due Date%-5sPlan ID%-24sPlan Name' % ('', '')) lnstr = ('----------- ---------- %-20s---------' % '') print(ttstr) print(lnstr) for pl in pls: print('%-12s %-30s %s' % (pl.due_date, pl.plan_id, pl.name))
def create_testplan(project_id, release_testplan, build_testplan): """ Creates release test plan and build test plan """ from pylero.plan import Plan release_testplan_id = release_testplan.replace(".", "_") build_testplan_id = build_testplan.replace(".", "_") rst_res = Plan.search("id:{}".format(release_testplan_id)) if rst_res == []: Plan.create(release_testplan_id, release_testplan, project_id, None, "release") else: print("release test plan {} already exists".format(release_testplan)) plan = Plan(project_id=project_id, plan_id=release_testplan_id) if plan.status == "open": plan.status = "inprogress" plan.update() btp_res = Plan.search("id:{}".format(build_testplan_id)) if btp_res == []: res = Plan.create(build_testplan_id, build_testplan, project_id, release_testplan_id, "iteration") else: res = True print("build test plan {} already exists".format(build_testplan)) plan = Plan(project_id=project_id, plan_id=build_testplan_id) if plan.status == "open": plan.status = "inprogress" plan.update() return res
def test_010_delete(self): Plan.delete_plans(DEFAULT_PROJ, PLAN_ID) with self.assertRaises(PyleroLibException): Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID)
def test_008_remove_wi(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.remove_plan_items([self.NEW_REQ]) plan.reload() self.assertEquals(len(plan.records), 1) self.assertEquals(plan.records[0].item, self.NEW_REQ2)
def test_007_stats(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) stats = plan.get_statistics() self.assertEquals(stats.number_of_planned, 2)
def test_006_add_items(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.add_plan_items([self.NEW_REQ, self.NEW_REQ2]) plan.reload() self.assertEquals(len(plan.records), 2)
def test_005_get_plan(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) self.assertEquals(plan.plan_id, PLAN_ID) plan2 = Plan(uri=plan.uri) self.assertEquals(plan2.plan_id, PLAN_ID)
def test_004_search_plan(self): lst_res = Plan.search("id:%s" % PLAN_ID) self.assertEquals(len(lst_res), 1) self.assertEquals(lst_res[0].plan_id, PLAN_ID)
def test_003_search_template(self): lst_res = Plan.search("id:%s" % TEMPLATE_ID, search_templates=True) self.assertEquals(len(lst_res), 1) self.assertEquals(lst_res[0].plan_id, TEMPLATE_ID)