Example #1
0
 def test_001_create_template(self):
     """This test does the following:
     * Creates a TestRun template based on the "Empty" template
     * Verifies that the returned object exists and is a template
     * Adds a custom field as a kwarg
     * Tries to create another template with an invalid enum value in kwarg
     * Tries to create another template with an invalid kwarg
     """
     global TEMPLATE_ID
     template = TestRun.create_template(DEFAULT_PROJ,
                                        TEMPLATE_ID,
                                        "Empty",
                                        title=TEMPLATE_TITLE,
                                        arch="i386")
     TEMPLATE_ID = template.test_run_id
     self.assertIsNotNone(template.test_run_id)
     self.assertTrue(template.is_template)
     self.assertEqual(template.arch, "i386")
     with self.assertRaises(PylarionLibException):
         template = TestRun.create_template(DEFAULT_PROJ,
                                            TEMPLATE_ID + "1",
                                            "Empty",
                                            TEMPLATE_TITLE + "1",
                                            arch="BAD")
     with self.assertRaises(PylarionLibException):
         template = TestRun.create_template(DEFAULT_PROJ,
                                            TEMPLATE_ID + "2",
                                            "Empty",
                                            TEMPLATE_TITLE + "2",
                                            notaparm="BAD")
 def test_uri_obj(self):
     testrun2 = TestRun(project_id=DEFAULT_PROJ, test_run_id=TEST_RUN_ID)
     self.assertEqual(testrun2.template, "example")
     new_template = TestRun.create_template(DEFAULT_PROJ,
                                            TEMPLATE_ID,
                                            "example",
                                            title=TEMPLATE_TITLE)
     testrun2.template = new_template
     self.assertEqual(testrun2.template, new_template.test_run_id)
     self.assertNotEqual(testrun2.template, "example")
Example #3
0
    def create_test_run_template(self, template_id, case_type="automatedProcess", query=None):
        """
        Creates a TestRun template that can be used as a basis for other TestRuns

        :param template_id: a unique str to give as ID for this template
        :param case_type:
        :param query:
        :return:
        """
        from pylarion.test_run import TestRun
        test_template = TestRun.create_template(self.project, template_id, query=query,
                                                select_test_cases_by=case_type)
        return test_template
 def test_008_doc_test_run_template(self):
     global TEMPLATE_ID
     global TEST_RUN_ID
     doc_with_space = self.doc_create.space
     self.doc_create.session.tx_begin()
     tmp = TestRun.create_template(project_id=Document.default_project,
                             template_id=TEMPLATE_ID,
                             doc_with_space=doc_with_space,
                             title=TEMPLATE_TITLE)
     TEMPLATE_ID = tmp.test_run_id
     tr = TestRun.create(project_id=Document.default_project,
                         test_run_id=TEST_RUN_ID,
                         template=TEMPLATE_ID,
                         title=TEST_RUN_TITLE)
     TEST_RUN_ID = tr.test_run_id
     self.assertEquals(len(tr.records), 1)
     self.assertEquals(tr.records[0].test_case_id, WI_ID)
     self.doc_create.session.tx_commit()