def test_014_steps(self): test1 = ["Test 1", "Result 1"] test2 = ["Test 2", "Result 2"] test3 = ["Test 3", "Result 3"] ts1 = TestStep() ts1.values = test1 ts2 = TestStep() ts2.values = test2 ts3 = TestStep() ts3.values = test3 set_steps = [ts1, ts2, ts3] tc = TestCase(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id) tc.set_test_steps(set_steps) tc2 = TestCase(project_id=DEFAULT_PROJ, work_item_id=self.work_item_id) get_steps = tc2.get_test_steps() self.assertEqual(get_steps.steps[0].values[0].content, ts1.values[0].content) self.assertEqual(get_steps.steps[0].values[1].content, ts1.values[1].content) self.assertEqual(get_steps.steps[1].values[0].content, ts2.values[0].content) self.assertEqual(get_steps.steps[1].values[1].content, ts2.values[1].content) self.assertEqual(get_steps.steps[2].values[0].content, ts3.values[0].content) self.assertEqual(get_steps.steps[2].values[1].content, ts3.values[1].content)
def test_013_incident_report_test(self): """This test does the following: * gets a TestRun * gets a TestCase * adds test_steps * creates a TestRecord * populates the TestRecord * Fail the testRecord * reloads the TestCase * Verifies that an Incident Report was Created """ tr = TestRun(project_id=DEFAULT_PROJ, test_run_id=TEST_RUN_ID) tests = [["Test 1", "Result 1"], ["Test 2", "Result 2"], ["Test 3", "Result 3"]] set_steps = [] for test in tests: ts = TestStep() ts.values = test set_steps.append(ts) tc = TestCase(work_item_id=self.NEW_TEST_CASE) tc.set_test_steps(set_steps) tc.update() tc.reload() steps = tc.test_steps.steps results = [] for step in steps: res = TestStepResult() res.result = "failed" res.comment = "This is the result" results.append(res) rec = TestRecord() rec.test_step_results = results rec.test_case_id = self.NEW_TEST_CASE rec.comment = "Incident Report was Created" rec.duration = "50.5" rec.result = "failed" rec.executed_by = tr.logged_in_user_id rec.executed = datetime.datetime.now() tr.update_test_record_by_object(self.NEW_TEST_CASE, rec) tc.reload() linked_work_items = tc.linked_work_items_derived idx = len(linked_work_items) - 1 incident = Incident(project_id="proj1", work_item_id=linked_work_items[idx].work_item_id) self.assertIsNotNone(incident)