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 " 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)