Skip to content

Commit 7bcb128

Browse files
authored
Add main() to system tests of lobster-html-report (#500)
1 parent e781be2 commit 7bcb128

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

tests_system/lobster_html_report/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ py_library(
3030
py_test(
3131
name = "test_html_report",
3232
srcs = ["test_html_report.py"],
33+
# TODO: This test is manual because Selenium tests require a Googlechrome driver
34+
# from googlechromelabs.github.io, which needs to be provided first.
35+
# We need to update Bazel to download it first.
36+
tags = ["manual"],
3337
deps = [
3438
":lobster_html_report",
3539
"//lobster/tools/core/html_report",

tests_system/lobster_html_report/test_html_content.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import unittest
23
from tests_system.lobster_html_report.lobster_UI_system_test_case_base import (
34
LobsterUISystemTestCaseBase)
45
from tests_system.asserter import Asserter
@@ -277,3 +278,7 @@ def test_message_in_item(self):
277278
asserter.assertStdOutText(expected_stdout)
278279
asserter.assertExitCode(0)
279280
asserter.assertOutputFiles()
281+
282+
283+
if __name__ == "__main__":
284+
unittest.main()

tests_system/lobster_html_report/test_html_report.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
from datetime import datetime, timezone
44
import json
5+
import unittest
56
from selenium.webdriver.common.by import By
67
from selenium.webdriver.support.ui import WebDriverWait
78
from selenium.webdriver.support import expected_conditions as EC
@@ -149,3 +150,7 @@ def test_meta_tag(self):
149150
self.assertEqual(meta_element.get_attribute('http-equiv'), "Content-Type")
150151
self.assertEqual(
151152
meta_element.get_attribute('content'), "text/html; charset=utf-8")
153+
154+
155+
if __name__ == "__main__":
156+
unittest.main()

tests_system/lobster_html_report/test_input_file.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import unittest
23
from lobster.tools.core.html_report.html_report import is_dot_available
34
from tests_system.lobster_html_report.lobster_UI_system_test_case_base import (
45
LobsterUISystemTestCaseBase)
@@ -145,3 +146,7 @@ def test_valid_md_lobster_file_succeeds(self):
145146
asserter.assertStdOutText(expected_stdout)
146147
asserter.assertExitCode(0)
147148
asserter.assertOutputFiles()
149+
150+
151+
if __name__ == "__main__":
152+
unittest.main()

tests_system/lobster_html_report/test_online_report_input.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from pathlib import Path
2+
import unittest
23
from tests_system.lobster_html_report.lobster_UI_system_test_case_base import (
34
LobsterUISystemTestCaseBase)
45
from tests_system.asserter import Asserter
56
from tests_system.tests_utils.update_version_in_html import update_version_in_html_file
67
from tests_system.tests_utils.update_html_expected_output import update_html_output_file
7-
from lobster.tools.core.html_report.html_report import is_dot_available
88

99

1010
class LobsterOnlineReportInputTest(LobsterUISystemTestCaseBase):
@@ -51,20 +51,16 @@ def test_online_report_input(self):
5151
completed_process = self.test_runner.run_tool_test()
5252
asserter = Asserter(self, completed_process, self.test_runner)
5353

54-
if is_dot_available(dot=None):
55-
expected_stdout = f"LOBSTER HTML report written to {output_filename}\n"
54+
expected_stdout = f"LOBSTER HTML report written to {output_filename}\n"
5655

57-
else:
58-
expected_stdout = (
59-
"warning: dot utility not found, report will not include "
60-
"the tracing policy visualisation\n"
61-
"> please install Graphviz (https://graphviz.org)\n"
62-
f"LOBSTER HTML report written to {output_filename}\n"
63-
)
6456
self.assertIn(
6557
f"LOBSTER HTML report written to {output_filename}\n",
6658
completed_process.stdout,
6759
)
68-
asserter.assertStdOutText(expected_stdout)
60+
self.assertIn(expected_stdout, completed_process.stdout)
6961
asserter.assertExitCode(0)
7062
asserter.assertOutputFiles()
63+
64+
65+
if __name__ == "__main__":
66+
unittest.main()

0 commit comments

Comments
 (0)