Пример #1
0
    def case_runs_filter_criteria(form):
        filter_criteria = {}

        priority = form.cleaned_data['priority']
        if priority:
            filter_criteria['case__priority__pk'] = priority

        tester = form.cleaned_data['tester']
        if tester is not None:
            if tester == 0:
                filter_criteria['tested_by'] = None
            else:
                filter_criteria['tested_by__pk'] = tester

        status = form.cleaned_data['status']
        if status:
            status_id = TestCaseRunStatus.get_names_ids()[status.upper()]
            filter_criteria['case_run_status'] = status_id

        return filter_criteria
Пример #2
0
    def case_runs_filter_criteria(self, form):
        filter_criteria = {}

        priority = form.cleaned_data['priority']
        if priority:
            filter_criteria['case__priority__pk'] = priority

        tester = form.cleaned_data['tester']
        if tester is not None:
            if tester == 0:
                filter_criteria['tested_by'] = None
            else:
                filter_criteria['tested_by__pk'] = tester

        status = form.cleaned_data['status']
        if status:
            status_id = TestCaseRunStatus.get_names_ids()[status.upper()]
            filter_criteria['case_run_status'] = status_id

        return filter_criteria
Пример #3
0
    def _report_data_context(self):
        form = self._get_search_form()
        context = {'form': form}

        if not form.is_valid():
            context.update({'builds': ()})
            return context

        _data = self.data_class(form)
        self._data = _data

        builds = _data._get_builds()
        build_ids = [build.pk for build in builds]

        # TODO: remove this after upgrading MySQL-python to 1.2.5
        build_ids = workaround_single_value_for_in_clause(build_ids)

        if build_ids:
            # Summary header data
            runs_subtotal = _data.runs_subtotal()
            plans_subtotal = _data.plans_subtotal()
            case_runs_subtotal = _data.case_runs_subtotal()
            isautomated_subtotal = _data.cases_isautomated_subtotal()

            # Staus matrix used to render progress bar for each build
            case_runs_status_matrix = _data.status_matrix()

            status_names_ids = TestCaseRunStatus.get_names_ids()
            # FIXME: this would raise KeyError once status names are modified
            # to other ones.
            passed_id = status_names_ids['PASSED']
            failed_id = status_names_ids['FAILED']

            for build in builds:
                bid = build.pk
                build.runs_count = runs_subtotal.get(bid, 0)
                build.plans_count = plans_subtotal.get(bid, 0)
                build.case_runs_count = case_runs_subtotal.get(bid, 0)

                status_subtotal = case_runs_status_matrix.get(bid, {})
                passed_count = status_subtotal.get(passed_id, 0)
                failed_count = status_subtotal.get(failed_id, 0)

                c = case_runs_subtotal.get(bid, 0)

                if c:
                    build.passed_case_runs_percent = passed_count * 100.0 / c
                    build.failed_case_runs_percent = failed_count * 100.0 / c
                else:
                    build.passed_case_runs_percent = .0
                    build.failed_case_runs_percent = .0

                build.passed_case_runs_count = passed_count
                build.failed_case_runs_count = failed_count
                build.case_runs_count = c

            context.update({
                # TODO: replace following three TOTAL key lookup with total
                # method invocation.
                'total_runs_count': runs_subtotal.get('TOTAL', 0),
                'total_plans_count': plans_subtotal.get('TOTAL', 0),
                'total_count': isautomated_subtotal.get('TOTAL', 0),
                'manual_count': isautomated_subtotal.get(0, 0),
                'auto_count': isautomated_subtotal.get(1, 0),
                'both_count': isautomated_subtotal.get(2, 0),
            })

        context.update({'builds': builds})
        return context
Пример #4
0
    def _report_data_context(self):
        form = self._get_search_form()
        context = {'form': form}

        if not form.is_valid():
            context.update({'builds': ()})
            return context

        _data = self.data_class(form)
        self._data = _data

        builds = _data._get_builds()
        build_ids = [build.pk for build in builds]

        # TODO: remove this after upgrading MySQL-python to 1.2.5
        build_ids = workaround_single_value_for_in_clause(build_ids)

        if build_ids:
            # Summary header data
            runs_subtotal = _data.runs_subtotal()
            plans_subtotal = _data.plans_subtotal()
            case_runs_subtotal = _data.case_runs_subtotal()
            isautomated_subtotal = _data.cases_isautomated_subtotal()

            # Staus matrix used to render progress bar for each build
            case_runs_status_matrix = _data.status_matrix()

            status_names_ids = TestCaseRunStatus.get_names_ids()
            # FIXME: this would raise KeyError once status names are modified
            # to other ones.
            passed_id = status_names_ids['PASSED']
            failed_id = status_names_ids['FAILED']

            for build in builds:
                bid = build.pk
                build.runs_count = runs_subtotal.get(bid, 0)
                build.plans_count = plans_subtotal.get(bid, 0)
                build.case_runs_count = case_runs_subtotal.get(bid, 0)

                status_subtotal = case_runs_status_matrix.get(bid, {})
                passed_count = status_subtotal.get(passed_id, 0)
                failed_count = status_subtotal.get(failed_id, 0)

                c = case_runs_subtotal.get(bid, 0)

                if c:
                    build.passed_case_runs_percent = passed_count * 100.0 / c
                    build.failed_case_runs_percent = failed_count * 100.0 / c
                else:
                    build.passed_case_runs_percent = .0
                    build.failed_case_runs_percent = .0

                build.passed_case_runs_count = passed_count
                build.failed_case_runs_count = failed_count
                build.case_runs_count = c

            context.update({
                # TODO: replace following three TOTAL key lookup with total
                # method invocation.
                'total_runs_count': runs_subtotal.get('TOTAL', 0),
                'total_plans_count': plans_subtotal.get('TOTAL', 0),
                'total_count': isautomated_subtotal.get('TOTAL', 0),
                'manual_count': isautomated_subtotal.get(0, 0),
                'auto_count': isautomated_subtotal.get(1, 0),
                'both_count': isautomated_subtotal.get(2, 0),
            })

        context.update({'builds': builds})
        return context