Ejemplo n.º 1
0
    def get_result_list(self,
                   testcase_id,
                   testrun_id = None,
                   includedtestcase_list = None,
                   tcassignment_list = None):

        if tcassignment_list is None:
            # we need to get it first
            if includedtestcase_list is None:
                # we need to get it first
                if testrun_id is None:
                    assert False, "we need at least a testrun_id to fetch a result"
                includedtestcase_list = self.get_included_testcases(testrun_id)

            incl_testcase = verify_single_item_in_list(includedtestcase_list, "testCaseId", testcase_id)
            includedtestcase_id = get_resource_identity(incl_testcase)[0]
            tcassignment_list = self.get_testcase_assignments(includedtestcase_id)


        found_assignment = verify_single_item_in_list(tcassignment_list, "testCaseId", testcase_id)
        assignment_id = get_resource_identity(found_assignment)[0]
        return_list =  self.get_list_from_endpoint("%s/assignments/%s/results" % \
                                                (self.root_path, assignment_id),
                                               tcm_type = "testresult")
#        assert False, jstr(return_list)
        return return_list
Ejemplo n.º 2
0
def user_marks_testcase_status(step, stored_user, user_name, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun_name = trModel.get_stored_or_store_name(stored_testrun, testrun_name)
    userModel = UserModel()
    user_name = userModel.get_stored_or_store_name(stored_user, user_name)

    # first we need the testrun id so we can get the latest version to approve
#    user_id = UserModel().get_resid(user_name)[0]
    testrun_id = trModel.get_resid(testrun_name)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result_obj = trModel.get_result(testcase_id,
                                    includedtestcase_list = includedtestcase_list)
        result_id = get_resource_identity(result_obj)[0]

        started_result = trModel.start_testcase(result_obj, user_name)
        started_result_version = get_resource_identity(started_result)[1]
        # now finally mark it with the specified status

        trModel.set_testcase_status(result_id, started_result_version, user_name, tc["status"])
Ejemplo n.º 3
0
    def get_result_list(self,
                        testcase_id,
                        testrun_id=None,
                        includedtestcase_list=None,
                        tcassignment_list=None):

        if tcassignment_list is None:
            # we need to get it first
            if includedtestcase_list is None:
                # we need to get it first
                if testrun_id is None:
                    assert False, "we need at least a testrun_id to fetch a result"
                includedtestcase_list = self.get_included_testcases(testrun_id)

            incl_testcase = verify_single_item_in_list(includedtestcase_list,
                                                       "testCaseId",
                                                       testcase_id)
            includedtestcase_id = get_resource_identity(incl_testcase)[0]
            tcassignment_list = self.get_testcase_assignments(
                includedtestcase_id)

        found_assignment = verify_single_item_in_list(tcassignment_list,
                                                      "testCaseId",
                                                      testcase_id)
        assignment_id = get_resource_identity(found_assignment)[0]
        return_list =  self.get_list_from_endpoint("%s/assignments/%s/results" % \
                                                (self.root_path, assignment_id),
                                               tcm_type = "testresult")
        #        assert False, jstr(return_list)
        return return_list
def retest_for_testcases(step, stored_testrun, testrun_name):
    '''
        Step hashes can have a user name field or not.  If it's not specified, it will,
        obviously, not pass a user id, so it will assign the new result object to the
        user of the previous result.
    '''
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        try:
            tester_id = UserModel().get_resid(tc["user name"])[0]

        except KeyError:
            tester_id = None

        result = trModel.get_result(
            testcase_id, includedtestcase_list=includedtestcase_list)

        result_id = get_resource_identity(result)[0]

        trModel.retest_single(result_id, tester_id)
Ejemplo n.º 5
0
def retest_for_testcases(step, stored_testrun, testrun_name):
    '''
        Step hashes can have a user name field or not.  If it's not specified, it will,
        obviously, not pass a user id, so it will assign the new result object to the
        user of the previous result.
    '''
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        try:
            tester_id = UserModel().get_resid(tc["user name"])[0]

        except KeyError:
            tester_id = None

        result = trModel.get_result(testcase_id,
                                    includedtestcase_list = includedtestcase_list)

        result_id = get_resource_identity(result)[0]

        trModel.retest_single(result_id, tester_id)
Ejemplo n.º 6
0
    def get_result_list(self,
                   testcase_id,
                   testrun_id = None,
                   includedtestcase_list = None,
                   tcassignment_list = None):
        '''
            I *think* this is the best way to overload the method for several possible parameters.
            trying this technique
        '''
        if tcassignment_list is None:
            # we need to get it first
            if includedtestcase_list is None:
                # we need to get it first
                if testrun_id is None:
                    assert False, "we need at least a testrun_id to fetch a result"
                includedtestcase_list = self.get_included_testcases(testrun_id)

            incl_testcase = verify_single_item_in_list(includedtestcase_list, "testCaseId", testcase_id)
            includedtestcase_id = get_resource_identity(incl_testcase)[0]
            tcassignment_list = self.get_testcase_assignments(includedtestcase_id)


        found_assignment = verify_single_item_in_list(tcassignment_list, "testCaseId", testcase_id)
        assignment_id = get_resource_identity(found_assignment)[0]
        return self.get_list_from_endpoint("%s/assignments/%s/results" % \
                                                (self.root_path, assignment_id),
                                           tcm_type = "testresult")
def user_marks_testcase_status(step, stored_user, user_name, stored_testrun,
                               testrun_name):
    trModel = TestrunModel()
    testrun_name = trModel.get_stored_or_store_name(stored_testrun,
                                                    testrun_name)
    userModel = UserModel()
    user_name = userModel.get_stored_or_store_name(stored_user, user_name)

    # first we need the testrun id so we can get the latest version to approve
    #    user_id = UserModel().get_resid(user_name)[0]
    testrun_id = trModel.get_resid(testrun_name)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result_obj = trModel.get_result(
            testcase_id, includedtestcase_list=includedtestcase_list)
        result_id = get_resource_identity(result_obj)[0]

        started_result = trModel.start_testcase(result_obj, user_name)
        started_result_version = get_resource_identity(started_result)[1]
        # now finally mark it with the specified status

        trModel.set_testcase_status(result_id, started_result_version,
                                    user_name, tc["status"])
Ejemplo n.º 8
0
def fetch_results_by_ids(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        # for each testcase name, fetch the result that matches it in the testrun list
        testcase_obj = testcaseModel.get_by_name(testcase["name"])
        testcase_id = get_resource_identity(testcase_obj)[0]

        result_from_list = testrunModel.get_result(testcase_id,
                                                   testrun_id = testrun_id)
        testresult_id = get_resource_identity(result_from_list)[0]
        result_from_endpoint = testrunModel.get_result_by_id(testresult_id)
        compare_dicts_by_keys(result_from_list, result_from_endpoint, ("testCaseId", "testRunId", "testSuiteId"))
Ejemplo n.º 9
0
    def approve_result(self, testrun_id, testcase_id):

        #/testruns/results/{resultId}/approve/
        result_obj = self.get_result(testcase_id, testrun_id)
        result_id, version = get_resource_identity(result_obj)
        return do_put("%s/results/%s/approve" % (self.root_path, result_id),
                      body={"originalVersionId": version})
Ejemplo n.º 10
0
    def get_stored_or_store_obj(self,
                                stored,
                                name):
        '''
            If stored is not None and has the word "that" in it, then we try to use the last stored object
            of that type.  This can be tricky, because that last stored one might not have the latest verison id.
            Some step code may need to refetch the latest version.  Or perhaps we should re-fetch the latest
            version here?

            If stored IS None, then we do a search for the object of that type with that name.  For type of "users"
            we have to split the name to first and last.  Sucky special case.
        '''
        if stored == None:
            # search for the object with that name
            if self.singular == "user":
                names = name.split()
                params = {"firstName": names[0], "lastName": names[1]}
            else:
                params = {"name": name}
            tcm_obj = self.get_single_item_from_search(self.root_path, params)
            self.store_latest(tcm_obj)
        else:
            # returned the stored object
            # DO WE RE-FETCH IT TO GET THE LATEST VERSION?
            tcm_obj = self.get_latest_stored()
            tcm_obj = self.get_single_item_from_endpoint("%s/%s" % \
                                                         (self.root_path,
                                                         str(get_resource_identity(tcm_obj)[0])))
            return tcm_obj
Ejemplo n.º 11
0
    def get_stored_or_store_obj(self, stored, name):
        '''
            If stored is not None and has the word "that" in it, then we try to use the last stored object
            of that type.  This can be tricky, because that last stored one might not have the latest verison id.
            Some step code may need to refetch the latest version.  Or perhaps we should re-fetch the latest
            version here?

            If stored IS None, then we do a search for the object of that type with that name.  For type of "users"
            we have to split the name to first and last.  Sucky special case.
        '''
        if stored == None:
            # search for the object with that name
            if self.singular == "user":
                names = name.split()
                params = {"firstName": names[0], "lastName": names[1]}
            else:
                params = {"name": name}
            tcm_obj = self.get_single_item_from_search(self.root_path, params)
            self.store_latest(tcm_obj)
        else:
            # returned the stored object
            # DO WE RE-FETCH IT TO GET THE LATEST VERSION?
            tcm_obj = self.get_latest_stored()
            tcm_obj = self.get_single_item_from_endpoint("%s/%s" % \
                                                         (self.root_path,
                                                         str(get_resource_identity(tcm_obj)[0])))
            return tcm_obj
Ejemplo n.º 12
0
def remember_the_url_for_the_testcase_result(step, stored_testcase, testcase_name, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list = includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]
    get_stored_or_store_field("url", "testcaseRunResult", "", testresult_url)
Ejemplo n.º 13
0
def last_referenced_user_has_values(step):
    userModel = UserModel()
    act_user = userModel.get_latest_stored()
    # fetch the latest values for this user
    act_user = userModel.get_by_id(get_resource_identity(act_user)[0])

    exp_user = step.hashes[0].copy()
    userModel.check_values(act_user, exp_user)
Ejemplo n.º 14
0
def last_referenced_user_has_values(step):
    userModel = UserModel()
    act_user = userModel.get_latest_stored()
    # fetch the latest values for this user
    act_user = userModel.get_by_id(get_resource_identity(act_user)[0])

    exp_user = step.hashes[0].copy()
    userModel.check_values(act_user, exp_user)
Ejemplo n.º 15
0
    def retest(self, testrun, only_failed=False):
        testrun_id, version = get_resource_identity(testrun)

        do_post("%s/%s/retest" % (self.root_path, testrun_id),
                body={
                    "originalVersionId": version,
                    "failedResultsOnly": only_failed
                })
Ejemplo n.º 16
0
def get_new_user_by_id(step):
    userModel = UserModel()
    last_created_user = userModel.get_latest_stored()
    user_id = get_resource_identity(last_created_user)[0]
    user_obj = userModel.get_by_id(user_id)

    compare_dicts_by_keys(
        last_created_user, user_obj,
        ("firstName", "lastName", "email", "screenName", "companyId"))
Ejemplo n.º 17
0
def get_new_user_by_id(step):
    userModel = UserModel()
    last_created_user = userModel.get_latest_stored()
    user_id = get_resource_identity(last_created_user)[0]
    user_obj = userModel.get_by_id(user_id)

    compare_dicts_by_keys(last_created_user,
                          user_obj,
                          ("firstName", "lastName", "email", "screenName", "companyId"))
def fetch_results_by_ids(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        # for each testcase name, fetch the result that matches it in the testrun list
        testcase_obj = testcaseModel.get_by_name(testcase["name"])
        testcase_id = get_resource_identity(testcase_obj)[0]

        result_from_list = testrunModel.get_result(testcase_id,
                                                   testrun_id=testrun_id)
        testresult_id = get_resource_identity(result_from_list)[0]
        result_from_endpoint = testrunModel.get_result_by_id(testresult_id)
        compare_dicts_by_keys(result_from_list, result_from_endpoint,
                              ("testCaseId", "testRunId", "testSuiteId"))
Ejemplo n.º 19
0
def testcases_have_environments(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(testcase_id,
                                    includedtestcase_list = includedtestcase_list)
        testresult_id = get_resource_identity(result)[0]
        environments_list = trModel.get_result_environments_list(testresult_id)

        verify_single_item_in_list(environments_list, "name", tc["environment"])
def remember_the_url_for_the_testcase_result(step, stored_testcase,
                                             testcase_name, stored_testrun,
                                             testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list=includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]
    get_stored_or_store_field("url", "testcaseRunResult", "", testresult_url)
Ejemplo n.º 21
0
    def start_testcase(self, result_obj, user_name):
        result_id, result_version = get_resource_identity(result_obj)

        # start the test
        headers = get_form_headers(UserModel().get_auth_header(user_name))
        testresult = do_put("%s/results/%s/start" % (self.root_path, result_id),
                            {"originalVersionId": result_version}, headers)
        started_result = json_to_obj(testresult)[ns("testresult")][0]
        return started_result
def testcycle_has_percent_complete_of_X(step, stored_testcycle, testcycle_name, exp_percent):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    act_percent = testcycleModel.get_percent_complete(testcycle_id)

    eq_(act_percent[ns("categoryValue")], int(exp_percent), "percent complete check")
Ejemplo n.º 23
0
    def approve_result(self, testrun_id, testcase_id):

        #/testruns/results/{resultId}/approve/
        result_obj = self.get_result(testcase_id, testrun_id)
        result_id, version = get_resource_identity(result_obj)
        return do_put("%s/results/%s/approve" % (self.root_path,
                                                 result_id),
                      body = {"originalVersionId": version}
                      )
def testcases_have_environments(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(
            testcase_id, includedtestcase_list=includedtestcase_list)
        testresult_id = get_resource_identity(result)[0]
        environments_list = trModel.get_result_environments_list(testresult_id)

        verify_single_item_in_list(environments_list, "name",
                                   tc["environment"])
Ejemplo n.º 25
0
    def start_testcase(self, result_obj, user_name):
        result_id, result_version = get_resource_identity(result_obj)

        # start the test
        headers = get_form_headers(UserModel().get_auth_header(user_name))
        testresult = do_put(
            "%s/results/%s/start" % (self.root_path, result_id),
            {"originalVersionId": result_version}, headers)
        started_result = json_to_obj(testresult)[ns("testresult")][0]
        return started_result
Ejemplo n.º 26
0
def approve_result_for_testrun(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        testrunModel.approve_result(testrun_id, testcase_id)
def approve_result_for_testrun(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        testrunModel.approve_result(testrun_id, testcase_id)
Ejemplo n.º 28
0
    def search_for_resid(self, params = {}):
        '''
            Return the id and version as a tuple

        '''

        item = self.get_single_item_from_search(self.root_path, params = params)
        assert item != None, "%s not found in search with these params:\n%s" % \
            (self.singular, jstr(params))

        return get_resource_identity(item)
Ejemplo n.º 29
0
    def search_for_resid(self, params={}):
        '''
            Return the id and version as a tuple

        '''

        item = self.get_single_item_from_search(self.root_path, params=params)
        assert item != None, "%s not found in search with these params:\n%s" % \
            (self.singular, jstr(params))

        return get_resource_identity(item)
Ejemplo n.º 30
0
def testcycle_has_percent_complete_of_X(step, stored_testcycle, testcycle_name,
                                        exp_percent):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle,
                                                       testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    act_percent = testcycleModel.get_percent_complete(testcycle_id)

    eq_(act_percent[ns("categoryValue")], int(exp_percent),
        "percent complete check")
Ejemplo n.º 31
0
def testrun_has_components(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    component_list = testrunModel.get_component_list(testrun_id)

    # walk through and verify that each testcase has the expected status
    for component in step.hashes:
        # find that in the list of testcases
        verify_single_item_in_list(component_list, "name", component["name"])
def testrun_has_components(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    component_list = testrunModel.get_component_list(testrun_id)

    # walk through and verify that each testcase has the expected status
    for component in step.hashes:
        # find that in the list of testcases
        verify_single_item_in_list(component_list, "name", component["name"])
Ejemplo n.º 33
0
def check_url_for_the_testcase_result_has_not_changed(step, stored_testcase, testcase_name, stored_testrun, testrun_name):
    stored_url = get_stored_or_store_field("url", "testcaseRunResult", "that url", None)


    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list = includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]

    eq_(testresult_url,
            stored_url,
            "testRunResult URL check")
Ejemplo n.º 34
0
def testrun_results_have_approval_statuses(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        result_obj = testrunModel.get_result(testcase_id, testrun_id)
        eq_(result_obj[ns("approvalStatusId")],
            get_approval_status_id(testcase["status"]),
            "Wrong approvalStatusId for result.  Expected:\n%s" % testcase)
def testrun_results_have_approval_statuses(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        result_obj = testrunModel.get_result(testcase_id, testrun_id)
        eq_(result_obj[ns("approvalStatusId")],
            get_approval_status_id(testcase["status"]),
            "Wrong approvalStatusId for result.  Expected:\n%s" % testcase)
def check_url_for_the_testcase_result_has_not_changed(step, stored_testcase,
                                                      testcase_name,
                                                      stored_testrun,
                                                      testrun_name):
    stored_url = get_stored_or_store_field("url", "testcaseRunResult",
                                           "that url", None)

    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list=includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]

    eq_(testresult_url, stored_url, "testRunResult URL check")
Ejemplo n.º 37
0
def testrun_has_testcases(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    # get the list of testcases for this testrun
    includedtestcase_list = testrunModel.get_included_testcases(testrun_id)

    # walk through and verify that each testcase has the expected status
    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]
        # find that in the list of testcases
        verify_single_item_in_list(includedtestcase_list, "testCaseId", testcase_id)
Ejemplo n.º 38
0
    def upload_attachment(self, filename, testcase_obj):
        testcase_id, version = get_resource_identity(testcase_obj)

        content_type, body = encode_multipart_formdata([], [{'key': filename,
                                                             'filename': filename,
                                                             'value': open(world.testfile_dir + filename, 'rb')}])

        headers = {"Accept": "application/xml",
                   "Content-Type":content_type,
                   "Content-Length": "%d" % len(body) }

        do_post("%s/%s/attachments/upload" % (self.root_path, testcase_id),
                body,
                params = {"originalVersionId": version},
                headers = headers)
def testrun_has_testcases(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    # get the list of testcases for this testrun
    includedtestcase_list = testrunModel.get_included_testcases(testrun_id)

    # walk through and verify that each testcase has the expected status
    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]
        # find that in the list of testcases
        verify_single_item_in_list(includedtestcase_list, "testCaseId",
                                   testcase_id)
Ejemplo n.º 40
0
    def assign_testcase(self, testrun_name, user_id, testcase_name):
        testrun_id, testrun_version = self.get_resid(testrun_name)
        testcase_id = TestcaseModel().get_resid(testcase_name)[0]

        # get the list of testcases for this testrun
        includedtestcase_list = self.get_included_testcases(testrun_id)
        # find that in the list of testcases
        includedtestcase = verify_single_item_in_list(includedtestcase_list, "testCaseId", testcase_id)

        includedtestcase_id = get_resource_identity(includedtestcase)[0]

        post_uri = "%s/includedtestcases/%s/assignments/" % (self.root_path, includedtestcase_id)
        body = {"testerId": user_id,
                "originalVersionId": testrun_version}

        do_post(post_uri, body)
Ejemplo n.º 41
0
def testcycle_has_team_members(step, stored_testcycle, testcycle_name, expect_any):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    teammember_list = testcycleModel.get_team_members_list(testcycle_id)

    eq_list_length(teammember_list, step.hashes)

    for teammember in step.hashes:
        names = teammember["name"].split()

        verify_single_item_in_list(teammember_list,
                                   params = {"firstName": names[0],
                                             "lastName": names[1]}
                                   )
Ejemplo n.º 42
0
def testcycle_has_testruns(step, stored_testcycle, testcycle_name, expect_any):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle,
                                                       testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    testrun_list = testcycleModel.get_testrun_list(testcycle_id)

    eq_list_length(testrun_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for testrun in step.hashes:
        # find that in the list of testcases
        exp_name = testrun["name"]

        verify_single_item_in_list(testrun_list, "name", exp_name)
Ejemplo n.º 43
0
    def assign_testcase(self, testrun_name, user_id, testcase_name):
        testrun_id, testrun_version = self.get_resid(testrun_name)
        testcase_id = TestcaseModel().get_resid(testcase_name)[0]

        # get the list of testcases for this testrun
        includedtestcase_list = self.get_included_testcases(testrun_id)
        # find that in the list of testcases
        includedtestcase = verify_single_item_in_list(includedtestcase_list,
                                                      "testCaseId",
                                                      testcase_id)

        includedtestcase_id = get_resource_identity(includedtestcase)[0]

        post_uri = "%s/includedtestcases/%s/assignments/" % (
            self.root_path, includedtestcase_id)
        body = {"testerId": user_id, "originalVersionId": testrun_version}

        do_post(post_uri, body)
def testrun_has_team_members(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    teammember_list = testrunModel.get_team_members_list(testrun_id)

    eq_list_length(teammember_list, step.hashes)

    for teammember in step.hashes:
        names = teammember["name"].split()

        verify_single_item_in_list(teammember_list,
                                   params={
                                       "firstName": names[0],
                                       "lastName": names[1]
                                   })
def testcases_have_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(
            testcase_id, includedtestcase_list=includedtestcase_list)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            get_result_status_id(tc["status"]), "testRunResultStatusId check")
Ejemplo n.º 46
0
def testcycle_has_testruns(step, stored_testcycle, testcycle_name, expect_any):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    testrun_list = testcycleModel.get_testrun_list(testcycle_id)

    eq_list_length(testrun_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for testrun in step.hashes:
        # find that in the list of testcases
        exp_name = testrun["name"]

        verify_single_item_in_list(testrun_list,
                                   "name",
                                   exp_name)
Ejemplo n.º 47
0
def testcycle_has_summary_counts(step, stored_testcycle, testcycle_name):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    summary_list = testcycleModel.get_summary_list(testcycle_id)

    eq_list_length(summary_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for category in step.hashes:
        # find that in the list of testcases
        status_id = get_result_status_id(category["name"])
        categoryInfo = verify_single_item_in_list(summary_list, "categoryName",
                                                  status_id)
        assert str(categoryInfo[ns("categoryValue")]) == category["count"], \
            "%s count was wrong.  Expected categoryName: %s , categoryValue: %s:\n%s" % \
            (category["name"], status_id, category["count"], jstr(categoryInfo))
Ejemplo n.º 48
0
def testcases_have_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(testcase_id,
                                    includedtestcase_list = includedtestcase_list)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            get_result_status_id(tc["status"]),
            "testRunResultStatusId check")
Ejemplo n.º 49
0
def testcycle_has_environmentgroups(step, stored_testcycle, testcycle_name, expect_any):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    envgrp_list = testcycleModel.get_environmentgroup_list(testcycle_id)

    # this checks that the lengths match.  The expect_any holder is not used, but it allows for
    # alternate wording in the step.
    eq_list_length(envgrp_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for envgrp in step.hashes:
        # find that in the list of testcases
        exp_name = envgrp["name"]

        verify_single_item_in_list(envgrp_list,
                                   "name",
                                   exp_name)
Ejemplo n.º 50
0
    def upload_attachment(self, filename, testcase_obj):
        testcase_id, version = get_resource_identity(testcase_obj)

        content_type, body = encode_multipart_formdata(
            [], [{
                'key': filename,
                'filename': filename,
                'value': open(world.testfile_dir + filename, 'rb')
            }])

        headers = {
            "Accept": "application/xml",
            "Content-Type": content_type,
            "Content-Length": "%d" % len(body)
        }

        do_post("%s/%s/attachments/upload" % (self.root_path, testcase_id),
                body,
                params={"originalVersionId": version},
                headers=headers)
def product_has_environmentgroups(step, stored_product, product_name, expect_any):
    productModel = ProductModel()
    product = productModel.get_stored_or_store_obj(stored_product, product_name)
    product_id = get_resource_identity(product)[0]

    # get the list of testcases for this product
    envgrp_list = productModel.get_environmentgroup_list(product_id)

    # this checks that the lengths match.  The expect_any holder is not used, but it allows for
    # alternate wording in the step.
    eq_list_length(envgrp_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for envgrp in step.hashes:
        # find that in the list of testcases
        exp_name = envgrp["name"]

        verify_single_item_in_list(envgrp_list,
                                   "name",
                                   exp_name)
Ejemplo n.º 52
0
def testcycle_has_summary_counts(step, stored_testcycle, testcycle_name):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle,
                                                       testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    summary_list = testcycleModel.get_summary_list(testcycle_id)

    eq_list_length(summary_list, step.hashes)

    # walk through and verify that each testcase has the expected status
    for category in step.hashes:
        # find that in the list of testcases
        status_id = get_result_status_id(category["name"])
        categoryInfo = verify_single_item_in_list(summary_list, "categoryName",
                                                  status_id)
        assert str(categoryInfo[ns("categoryValue")]) == category["count"], \
            "%s count was wrong.  Expected categoryName: %s , categoryValue: %s:\n%s" % \
            (category["name"], status_id, category["count"], jstr(categoryInfo))
def testcases_have_pending_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]
    status_id = get_result_status_id("Pending")
    # get the list of testcases for this testrun
    result_list = trModel.search_for_results_by_result_status(
        testrun_id, status_id)

    eq_list_length(result_list, step.hashes)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = verify_single_item_in_list(result_list, "testCaseId",
                                            testcase_id)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")], status_id,
            "testRunResultStatusId check")
Ejemplo n.º 54
0
def testcases_have_pending_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]
    status_id = get_result_status_id("Pending")
    # get the list of testcases for this testrun
    result_list = trModel.search_for_results_by_result_status(testrun_id,
                                                              status_id)

    eq_list_length(result_list, step.hashes)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = verify_single_item_in_list(result_list, "testCaseId", testcase_id)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            status_id,
            "testRunResultStatusId check")
Ejemplo n.º 55
0
 def get_latestversion_resid(self, testcase_id):
     return get_resource_identity(self.get_latestversion(testcase_id))
Ejemplo n.º 56
0
 def approve_all_results(self, testcycle):
     tcm_id, version = get_resource_identity(testcycle)
     return do_put("%s/%s/approveallresults" % (self.root_path,
                                              tcm_id),
                   body = {"originalVersionId": version}
                   )
Ejemplo n.º 57
0
 def get_latestversion_resid(self, testcase_id):
     return get_resource_identity(self.get_latestversion(testcase_id))
Ejemplo n.º 58
0
 def approve_all_results(self, testcycle):
     tcm_id, version = get_resource_identity(testcycle)
     return do_put("%s/%s/approveallresults" % (self.root_path, tcm_id),
                   body={"originalVersionId": version})
Ejemplo n.º 59
0
 def get_summary_list(self, testrun):
     testcycle_id = self.get_cycle_id(testrun)
     testrun_id = get_resource_identity(testrun)[0]
     params = {"testRunId": testrun_id}
     return super(TestrunModel, self).get_summary_list(testcycle_id,
                                                       params=params)
Ejemplo n.º 60
0
    def retest(self, testrun, only_failed = False):
        testrun_id, version = get_resource_identity(testrun)

        do_post("%s/%s/retest" % (self.root_path, testrun_id),
                body = {"originalVersionId": version,
                        "failedResultsOnly": only_failed})