From 061e6b089b1e1d5326840ef9a64a778e8dd4c2a8 Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Fri, 28 Nov 2025 21:11:38 +0700 Subject: [PATCH] feat(robotframework): add testCaseId --- .../src/listener/allure_listener.py | 3 +- .../identifiers_test.py | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/allure_robotframework/acceptance/robotframework_support/identifiers_test.py diff --git a/allure-robotframework/src/listener/allure_listener.py b/allure-robotframework/src/listener/allure_listener.py index 236a524e..29b4e0e3 100644 --- a/allure-robotframework/src/listener/allure_listener.py +++ b/allure-robotframework/src/listener/allure_listener.py @@ -132,7 +132,8 @@ def start_test(self, name, attributes): test_result.name = name test_result.fullName = long_name test_result.titlePath = attributes.get("titlepath", []) - test_result.historyId = md5(long_name) + test_result.testCaseId = md5(long_name) + test_result.historyId = test_result.testCaseId test_result.start = now() for container in self.lifecycle.containers(): diff --git a/tests/allure_robotframework/acceptance/robotframework_support/identifiers_test.py b/tests/allure_robotframework/acceptance/robotframework_support/identifiers_test.py new file mode 100644 index 00000000..92a3899f --- /dev/null +++ b/tests/allure_robotframework/acceptance/robotframework_support/identifiers_test.py @@ -0,0 +1,35 @@ +from hamcrest import assert_that +from hamcrest import all_of +from hamcrest import contains_string +from tests.allure_robotframework.robot_runner import AllureRobotRunner +from allure_commons_test.report import has_test_case +from allure_commons_test.result import has_full_name +from allure_commons_test.result import has_test_case_id +from allure_commons_test.result import has_history_id + + +def test_identifiers_are_set(docstring, robot_runner: AllureRobotRunner): + """ + *** Test Cases *** + Foo + No Operation + """ + + robot_runner.run_robotframework( + suite_literals={"Bar.robot": docstring} + ) + + assert_that( + robot_runner.allure_results, + has_test_case( + "Foo", + has_full_name( + all_of( + contains_string("Foo"), + contains_string("Bar"), + ), + ), + has_test_case_id(), + has_history_id(), + ) + )