Skip to content

Commit 21571c8

Browse files
authored
Set testCaseId for all test results produced by allure_robotframework (#884)
1 parent 466b1dd commit 21571c8

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

allure-robotframework/src/listener/allure_listener.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def start_test(self, name, attributes):
132132
test_result.name = name
133133
test_result.fullName = long_name
134134
test_result.titlePath = attributes.get("titlepath", [])
135-
test_result.historyId = md5(long_name)
135+
test_result.testCaseId = md5(long_name)
136+
test_result.historyId = test_result.testCaseId
136137
test_result.start = now()
137138

138139
for container in self.lifecycle.containers():
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from hamcrest import assert_that
2+
from hamcrest import all_of
3+
from hamcrest import contains_string
4+
from tests.allure_robotframework.robot_runner import AllureRobotRunner
5+
from allure_commons_test.report import has_test_case
6+
from allure_commons_test.result import has_full_name
7+
from allure_commons_test.result import has_test_case_id
8+
from allure_commons_test.result import has_history_id
9+
10+
11+
def test_identifiers_are_set(docstring, robot_runner: AllureRobotRunner):
12+
"""
13+
*** Test Cases ***
14+
Foo
15+
No Operation
16+
"""
17+
18+
robot_runner.run_robotframework(
19+
suite_literals={"Bar.robot": docstring}
20+
)
21+
22+
assert_that(
23+
robot_runner.allure_results,
24+
has_test_case(
25+
"Foo",
26+
has_full_name(
27+
all_of(
28+
contains_string("Foo"),
29+
contains_string("Bar"),
30+
),
31+
),
32+
has_test_case_id(),
33+
has_history_id(),
34+
)
35+
)

0 commit comments

Comments
 (0)