Best Python code snippet using lemoncheesecake
top.py
Source:top.py
...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 )...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!