How to use get_query_set_with_joins method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...35 total count in the group, plus keys for each of the extra_select_fields.36 The keys for the extra_select_fields are determined by the "AS" alias of37 the field.38 """39 query = models.TestView.objects.get_query_set_with_joins(filter_data)40 # don't apply presentation yet, since we have extra selects to apply41 query = models.TestView.query_objects(filter_data, initial_query=query,42 apply_presentation=False)43 count_alias, count_sql = models.TestView.objects.get_count_sql(query)44 query = query.extra(select={count_alias: count_sql})45 if extra_select_fields:46 query = query.extra(select=extra_select_fields)47 query = models.TestView.apply_presentation(query, filter_data)48 group_processor = tko_rpc_utils.GroupDataProcessor(query, group_by,49 header_groups or [],50 fixed_headers or {})51 group_processor.process_group_dicts()52 return rpc_utils.prepare_for_serialization(group_processor.get_info_dict())53def get_num_groups(group_by, **filter_data):54 """55 Gets the count of unique groups with the given grouping fields.56 """57 query = models.TestView.objects.get_query_set_with_joins(filter_data)58 query = models.TestView.query_objects(filter_data, initial_query=query)59 return models.TestView.objects.get_num_groups(query, group_by)60def get_status_counts(group_by, header_groups=[], fixed_headers={},61 **filter_data):62 """63 Like get_group_counts, but also computes counts of passed, complete (and64 valid), and incomplete tests, stored in keys "pass_count', 'complete_count',65 and 'incomplete_count', respectively.66 """67 return get_group_counts(group_by, header_groups=header_groups,68 fixed_headers=fixed_headers,69 extra_select_fields=tko_rpc_utils.STATUS_FIELDS,70 **filter_data)71def get_latest_tests(group_by, header_groups=[], fixed_headers={},72 extra_info=[], **filter_data):73 """74 Similar to get_status_counts, but return only the latest test result per75 group. It still returns the same information (i.e. with pass count etc.)76 for compatibility. It includes an additional field "test_idx" with each77 group.78 @param extra_info a list containing the field names that should be returned79 with each cell. The fields are returned in the extra_info80 field of the return dictionary.81 """82 # find latest test per group83 initial_query = models.TestView.objects.get_query_set_with_joins(84 filter_data)85 query = models.TestView.query_objects(filter_data,86 initial_query=initial_query,87 apply_presentation=False)88 query = query.exclude(status__in=tko_rpc_utils._INVALID_STATUSES)89 query = query.extra(90 select={'latest_test_idx' : 'MAX(%s)' %91 models.TestView.objects.get_key_on_this_table('test_idx')})92 query = models.TestView.apply_presentation(query, filter_data)93 group_processor = tko_rpc_utils.GroupDataProcessor(query, group_by,94 header_groups,95 fixed_headers)96 group_processor.process_group_dicts()97 info = group_processor.get_info_dict()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?