def open_run_get_case_runs(request, run): """Prepare for case runs list in a TestRun page This is an internal method. Do not call this directly. """ tcrs = run.case_run.select_related('run', 'case') tcrs = tcrs.only('run__run_id', 'run__plan', 'case_run_status', 'assignee', 'tested_by', 'case_text_version', 'sortkey', 'case__summary', 'case__is_automated_proposed', 'case__is_automated', 'case__priority', 'case__category__name') # Get the bug count for each case run # 5. have to show the number of bugs of each case run tcrs = tcrs.annotate(num_bug=Count('case_run_bug', distinct=True)) # todo: is this last distinct necessary tcrs = tcrs.distinct() # Continue to search the case runs with conditions # 4. case runs preparing for render case runs table tcrs = tcrs.filter(**clean_request(request)) order_by = request.GET.get('order_by') if order_by: tcrs = tcrs.order_by(order_by) else: tcrs = tcrs.order_by('sortkey', 'pk') return tcrs
def _open_run_get_executions(request, run): # pylint: disable=missing-permission-required """Prepare for executions list in a TestRun page This is an internal method. Do not call this directly. """ executions = run.case_run.select_related('run', 'case').only( 'run_id', 'status', 'assignee', 'tested_by', 'case_text_version', 'sortkey', 'case__summary', 'case__is_automated', 'case__priority', 'case__category__name') # Continue to search the executionss with conditions # 4. executions preparing for render executions table executions = executions.filter(**clean_request(request)) order_by = request.GET.get('order_by') if order_by: return executions.order_by(order_by) return executions.order_by('sortkey', 'pk')
def open_run_get_case_runs(request, run): """Prepare for case runs list in a TestRun page This is an internal method. Do not call this directly. """ tcrs = run.case_run.select_related('run', 'case', 'case__priority', 'case__category') tcrs = tcrs.only('run__run_id', 'run__plan', 'case_run_status', 'assignee', 'tested_by', 'case_text_version', 'sortkey', 'case__summary', 'case__is_automated_proposed', 'case__is_automated', 'case__priority', 'case__category__name') # Continue to search the case runs with conditions # 4. case runs preparing for render case runs table tcrs = tcrs.filter(**clean_request(request)) order_by = request.GET.get('order_by') if order_by: tcrs = tcrs.order_by(order_by) else: tcrs = tcrs.order_by('sortkey', 'pk') return tcrs
# Get the test case runs belong to the run tcrs = tr.case_run.all() # Get the list of testcases belong to the run tcs = [tcr.case_id for tcr in tcrs] # Count the status status_counter = CaseRunStatusCounter(tcrs) # Redirect to assign case page when a run does not contain any case run if not tcrs.count(): return HttpResponseRedirect( reverse('tcms.apps.testruns.views.assign_case', args=[run_id,]) ) # Continue to search the case runs with conditions tcrs = tcrs.filter(**clean_request(request)) if request.REQUEST.get('order_by'): tcrs = tcrs.order_by(request.REQUEST['order_by']) tcrs = tcrs.select_related( 'run', 'case_run_status', 'build', 'environment', 'environment__product', 'case__components', 'tested_by', 'case__priority', 'case__category', 'case__author', 'case', 'assignee') # Get the bug count for each case run tcrs = tcrs.extra(select={ 'num_bug': RawSQL.num_case_run_bugs, }) tcrs = tcrs.distinct() # Get the test case run bugs summary