Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test suite name to slack messages #13

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test_harness/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def main(args):
await reporter.get_auth()
await reporter.create_test_run(next(iter(tests.values())))
slacker = Slacker()
report = await run_tests(reporter, slacker, tests, logger)
report = await run_tests(reporter, slacker, tests, logger, args["suite"])

logger.info("Finishing up test run...")
await reporter.finish_test_run()
Expand Down
7 changes: 4 additions & 3 deletions test_harness/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def run_tests(
slacker: Slacker,
tests: Dict[str, TestCase],
logger: logging.Logger = logging.getLogger(__name__),
suite_name: str = "automated tests",
) -> Dict:
"""Send tests through the Test Runners."""
start_time = time.time()
Expand All @@ -47,7 +48,7 @@ async def run_tests(
env = "None"
await slacker.post_notification(
messages=[
f"Running {len(tests)} tests...\n<{reporter.base_path}/test-runs/{reporter.test_run_id}|View in the Information Radiator>"
f"Running {suite_name} ({len(tests)} tests)...\n<{reporter.base_path}/test-runs/{reporter.test_run_id}|View in the Information Radiator>"
]
)
# loop over all tests
Expand Down Expand Up @@ -271,8 +272,8 @@ async def run_tests(

await slacker.post_notification(
messages=[
"""Test Suite: {test_suite_id}\nDuration: {duration} | Environment: {env}\n<{ir_url}|View in the Information Radiator>\n> Test Results:\n> Passed: {num_passed}, Failed: {num_failed}, Skipped: {num_skipped}""".format(
test_suite_id=1,
"""Test Suite: {test_suite}\nDuration: {duration} | Environment: {env}\n<{ir_url}|View in the Information Radiator>\n> Test Results:\n> Passed: {num_passed}, Failed: {num_failed}, Skipped: {num_skipped}""".format(
test_suite=suite_name,
duration=round(time.time() - start_time, 2),
env=env,
ir_url=f"{reporter.base_path}/test-runs/{reporter.test_run_id}",
Expand Down
Loading