def test_012_get_back_linked_work_items(self): req = Requirement(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id_2) items = req.get_back_linked_work_items() self.assertTrue(len(items) == 1) wi = items[0] self.assertEqual(wi.work_item_id, self.work_item_id)
def test_013_multiple_types(self): req = Requirement() tc = TestCase() with self.assertRaises(AttributeError): tc.reqtype with self.assertRaises(AttributeError): req.caseimportance req.title = "req1" tc.title = "tc1" self.assertNotEqual(req.title, tc.title)
def test_custom_workitem(self): tc2 = TestCase(project_id=DEFAULT_PROJ, work_item_id=self.TEST_CASE_ID) self.assertIsNotNone(tc2.caseautomation) with self.assertRaises(PyleroLibException): tc2.caseautomation = "bad" tc2.caseautomation = "automated" # check for shared memory issue self.assertNotEqual(self.tc.caseautomation, tc2.caseautomation) req = Requirement() with self.assertRaises(PyleroLibException): req.reqtype = "bad" req.reqtype = 'functional'
def setUpClass(cls): req1 = Requirement.create(DEFAULT_PROJ, "regression", "regression", severity="should_have", reqtype="functional") cls.NEW_REQ = req1.work_item_id req2 = Requirement.create(DEFAULT_PROJ, "regression", "regression", severity="should_have", reqtype="functional") cls.NEW_REQ2 = req2.work_item_id
def list_workitems_by_query(self, query, wi_type): fields = ['work_item_id', 'title', 'author', 'created'] if wi_type in ["testcase", "TestCase"]: workitem_list = TestCase.query(query, fields) elif wi_type in ["requirement", "Requirement"]: workitem_list = Requirement.query(query, fields) elif wi_type == '': workitem_list = TestCase.query(query, fields) + \ Requirement.query(query, fields) else: print("'%s' is invalid. Use testcase or requirement" % wi_type) exit(0) return workitem_list
def print_links_for_requirement(self, req_id): req = Requirement(Requirement.default_project, req_id) print('ID%-12sRole' % ('')) print('-------%7s------' % ('')) for linked in req.linked_work_items_derived: print('%-13s %-13s' % (linked.work_item_id, linked.role))
def test_007_add_linked_work_item(self): tc = TestCase(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id) self.assertTrue(tc.add_linked_item(self.work_item_id_2, "verifies")) tc2 = TestCase(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id) self.assertTrue(len(tc2.linked_work_items) == 1) link = tc2.linked_work_items[0] self.assertEqual(link.work_item_id, self.work_item_id_2) self.assertEqual(link.role, "verifies") req3 = Requirement(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id_2) self.assertTrue(len(req3.linked_work_items_derived) == 1) link = req3.linked_work_items_derived[0] self.assertEqual(link.work_item_id, self.work_item_id) self.assertEqual(link.role, "verifies")
def setUpClass(cls): tc = TestCase.create(DEFAULT_PROJ, "regression", "regression", caseimportance="high", caselevel="component", caseautomation="notautomated", caseposneg="positive", testtype="functional", subtype1="-") req = Requirement.create(DEFAULT_PROJ, "regression _link", "regression link", reqtype="functional", severity="should_have", priority="50.0") cls.work_item_id = tc.work_item_id cls.work_item_uri = tc.uri cls.work_item_id_2 = req.work_item_id cls.work_item_uri_2 = req.uri