How to use _format_steps_aggregation method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

top.py

Source:top.py Github

copy

Full Screen

...118 @staticmethod119 def _get_steps_average_duration(steps):120 return get_total_duration(steps) / len(steps)121 @staticmethod122 def _format_steps_aggregation(description, occurrences, min_duration, max_duration, average_duration, duration,123 duration_pct):124 return (125 description,126 str(occurrences),127 humanize_duration(min_duration, show_milliseconds=True),128 humanize_duration(max_duration, show_milliseconds=True),129 humanize_duration(average_duration, show_milliseconds=True),130 humanize_duration(duration, show_milliseconds=True),131 "%d%%" % duration_pct132 )133 @staticmethod134 def _get_steps_aggregation(steps):135 steps_by_description = TopSteps._group_steps_by_description(steps)136 total_duration = get_total_duration(steps)137 data = []138 for description, steps in steps_by_description.items():139 duration = get_total_duration(steps)140 data.append([141 description,142 len(steps),143 TopSteps._get_steps_min_duration(steps),144 TopSteps._get_steps_max_duration(steps),145 TopSteps._get_steps_average_duration(steps),146 duration,147 (duration / total_duration * 100) if total_duration else 100148 ])149 return sorted(data, key=lambda row: row[-2], reverse=True)150 @staticmethod151 def get_top_steps(report, step_filter):152 steps = list(filter(step_filter, report.all_steps()))153 steps_aggregation = TopSteps._get_steps_aggregation(steps)154 return [TopSteps._format_steps_aggregation(*agg) for agg in steps_aggregation]155 def run_cmd(self, cli_args):156 report_path = get_report_path(cli_args)157 report = load_report(report_path, auto_detect_reporting_backends())158 step_filter = make_step_filter(cli_args)159 print_table(160 "Steps, aggregated and ordered by duration",161 ("Step", "Occ.", "Min.", "Max", "Avg.", "Total", "In %"),162 TopSteps.get_top_steps(report, step_filter)163 )...

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:

YouTube

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

Run Lemoncheesecake 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?

Helpful

NotHelpful