Esempio n. 1
0
    def update_all_case_results_for_run(self, run, result, user, comment):

        run = run.strip()
        tr = TestRun(run, None, TestRun.default_project)
        print('\nUpdate %s:' % run)

        if not comment:
            comment = ''

        print('Total records: %d' % len(tr.records))
        print('Updated Date Time    Result  CaseID')
        print('-------------------  ------  -----------')

        if user == 'None':
            user = TestRun.logged_in_user_id

        for rec in tr.records:
            rec.executed = datetime.datetime.now()
            rec.executed_by = user
            executed_str = str(rec.executed).split('.')[0]
            rec.result = result
            rec.comment = comment

            print('%-20s %-7s %s' % (executed_str, result, rec.test_case_id))
            tr.update_test_record_by_object(rec.test_case_id, rec)
        print('Done!')
Esempio n. 2
0
    def print_runs_by_query(self, query, is_template=False):
        query_ful = 'project.id:%s AND %s' % (TestRun.default_project, query)
        fields = [
            'query', 'created', 'test_run_id', 'select_test_cases_by',
            'status', 'plannedin', 'assignee', 'author'
        ]

        st = TestRun.search(query_ful, fields, 'created', -1, is_template)
        Object = ''
        if is_template:
            Object = 'Template'

        prestr = 'Created Time %8sAuthor %3sAssignee' % ('', '')
        latstr = '%sStatus %3sPlanID%10s%s' % ('', '', '', Object)
        preln = '------------%9s------%4s------' % ('', '')
        latln = '%2s--------%2s-------%9s--------' % ('', '', '')

        print('%s %s' % (prestr, latstr))
        print('%s %s' % (preln, latln))

        for tp in st:
            created_time = str(tp.created).split('.')[0]
            print('%-20s %-9s %-8s %-10s%-15s %s' %
                  (created_time, tp.author, tp.assignee, tp.status,
                   tp.plannedin, tp.test_run_id))
Esempio n. 3
0
    def print_workitems(self, workitems):
        number = len(workitems)
        print('\nTotal workitems: %d' % number)
        print('Created%7sType%10sID%12sTitle' % ('', '', ''))
        print('---------%5s-------%7s-----%9s--------' % ('', '', ''))

        for wi in workitems:
            created = str(wi.created).split(' ')[0]
            print('%-13s %-13s %-13s %s' %
                  (created, wi.type, wi.work_item_id, wi.title))
Esempio n. 4
0
    def print_testcases_from_run(self, run):
        tr = TestRun(run, None, TestRun.default_project)
        print('(Only CaseID can be displayed when --run=$template)')
        print('List cases for: %s\n' % run)
        ttstr = ('Created Time %8sStatus %1sExecutedBy %2sCaseID' %
                 ('', '', ''))
        lnstr = ('------------%9s------%2s----------%3s------' % ('', '', ''))
        print(ttstr)
        print(lnstr)

        for rec in tr.records:
            time = str(rec.executed).split('.')[0]
            print('%-21s%-9s%-12s%-10s' %
                  (time, rec.result, rec.executed_by, rec.test_case_id))