From 331e6a2d747d41c2edff27b07c3f86c455b5fd45 Mon Sep 17 00:00:00 2001 From: Gayan Weerakutti Date: Fri, 25 Jul 2025 14:55:35 +0900 Subject: [PATCH 1/2] Display warning if total test duration is 0 This outputs a CLI warning if the total test duration is 0 (before rounding) when user executes `launchable record tests` --- launchable/commands/record/tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launchable/commands/record/tests.py b/launchable/commands/record/tests.py index 8d07a075e..a04efffc8 100644 --- a/launchable/commands/record/tests.py +++ b/launchable/commands/record/tests.py @@ -641,6 +641,10 @@ def recorded_result() -> Tuple[int, int, int, float]: rows = [[file_count, test_count, success_count, fail_count, duration]] click.echo(tabulate(rows, header, tablefmt="github", floatfmt=".2f")) + if duration == 0: + click.echo(click.style("\nTotal test duration is 0." + "\nPlease check whether the test duration times in report files are correct.", "yellow")) + click.echo( "\nVisit https://app.launchableinc.com/organizations/{organization}/workspaces/" "{workspace}/test-sessions/{test_session_id} to view uploaded test results " From 991e9197c1354f016cca60e2a4bced23638bac22 Mon Sep 17 00:00:00 2001 From: Gayan Weerakutti Date: Mon, 28 Jul 2025 10:22:54 +0900 Subject: [PATCH 2/2] Test to check output when zero test duration --- tests/commands/record/test_tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/commands/record/test_tests.py b/tests/commands/record/test_tests.py index 91d44609d..1e8c122e0 100644 --- a/tests/commands/record/test_tests.py +++ b/tests/commands/record/test_tests.py @@ -95,3 +95,15 @@ def test_parse_launchable_timeformat(self): self.assertEqual(parse_launchable_time2.timestamp(), 1621880944.285) self.assertEqual(INVALID_TIMESTAMP, parse_launchable_timeformat(t3)) + + @responses.activate + @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token}) + def test_when_total_test_duration_zero(self): + write_build(self.build_name) + + zero_duration_xml1 = str(Path(__file__).parent.joinpath('../../data/googletest/output_a.xml').resolve()) + zero_duration_xml2 = str(Path(__file__).parent.joinpath('../../data/googletest/output_b.xml').resolve()) + result = self.cli('record', 'tests', '--build', self.build_name, 'googletest', zero_duration_xml1, zero_duration_xml2) + + self.assert_success(result) + self.assertIn("Total test duration is 0.", result.output)