Skip to content

Commit e9b562e

Browse files
authored
Merge pull request #1316 from cloudbees-oss/merge-v1-20260604-part2
Merge v1 20260604 part2
2 parents 316eace + e58d75d commit e9b562e

6 files changed

Lines changed: 338 additions & 101 deletions

File tree

smart_tests/test_runners/robot.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,29 @@ def parse_suite(suite: ET.Element):
2929
nested_status = nested_status_node.get('status') if nested_status_node is not None else None
3030

3131
if status is not None:
32-
start_time_str = status_node.get('starttime') if status_node is not None else ''
33-
end_time_str = status_node.get('endtime') if status_node is not None else ''
34-
35-
if start_time_str != '' and end_time_str != '':
36-
start_time = datetime.strptime(str(start_time_str), DATETIME_FORMAT)
37-
end_time = datetime.strptime(str(end_time_str), DATETIME_FORMAT)
38-
39-
duration = end_time - start_time
32+
duration_seconds = None
33+
34+
if status_node is not None:
35+
# RF 7.0+: elapsed attribute in seconds
36+
elapsed_str = status_node.get('elapsed')
37+
if elapsed_str is not None:
38+
duration_seconds = float(elapsed_str)
39+
else:
40+
# RF < 7.0: starttime/endtime attributes
41+
start_time_str = status_node.get('starttime', '')
42+
end_time_str = status_node.get('endtime', '')
43+
if start_time_str and end_time_str:
44+
try:
45+
start_time = datetime.strptime(start_time_str, DATETIME_FORMAT)
46+
end_time = datetime.strptime(end_time_str, DATETIME_FORMAT)
47+
duration_seconds = (end_time - start_time).total_seconds()
48+
except ValueError:
49+
duration_seconds = 0
4050

4151
testcase = ET.SubElement(testsuite, "testcase", {
4252
"name": str(test_name),
4353
"classname": str(suite_name),
44-
"time": str(duration.total_seconds()) if duration is not None else '0',
54+
"time": str(duration_seconds) if duration_seconds is not None else '0',
4555
})
4656

4757
if status == "FAIL":

tests/data/robot/output.xml

Lines changed: 51 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,98 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<robot generator="Robot 3.2.2 (Python 3.9.1 on darwin)" generated="20210319 11:34:50.044" rpa="false">
3-
<suite id="s1" name="Rocket-Car-Robot" source="/src/github.com/launchableinc/rocket-car-robot">
4-
<suite id="s1-s1" name="Minus" source="/src/github.com/launchableinc/rocket-car-robot/minus.robot">
5-
<test id="s1-s1-t1" name="Check method">
6-
<kw name="Result Is" library="Calculator">
7-
<arguments>
2+
<robot generator="Robot 7.4.2 (Python 3.13.13 on darwin)" generated="2026-06-04T16:18:55.667057" rpa="false" schemaversion="5">
3+
<suite id="s1" name="Robot" source="/Users/ryabuki/src/github.com/cloudbees-oss/smart-tests-integration-examples/robot">
4+
<suite id="s1-s1" name="Minus" source="/Users/ryabuki/src/github.com/cloudbees-oss/smart-tests-integration-examples/robot/minus.robot">
5+
<test id="s1-s1-t1" name="Check method" line="6">
6+
<kw name="Result Is" owner="Calculator">
87
<arg>-1</arg>
9-
</arguments>
10-
<msg timestamp="20210319 11:34:50.087" level="FAIL">0 != -1</msg>
11-
<status status="FAIL" starttime="20210319 11:34:50.085" endtime="20210319 11:34:50.087"></status>
8+
<status status="NOT RUN" start="2026-06-04T16:18:55.688016" elapsed="0.000060"/>
129
</kw>
13-
<status status="FAIL" starttime="20210319 11:34:50.085" endtime="20210319 11:34:50.087" critical="yes">0 != -1</status>
10+
<status status="PASS" start="2026-06-04T16:18:55.687743" elapsed="0.000411"/>
1411
</test>
15-
<test id="s1-s1-t2" name="Minus method">
16-
<kw name="Plus" library="Calculator">
17-
<arguments>
12+
<test id="s1-s1-t2" name="Minus method" line="9">
13+
<kw name="Plus" owner="Calculator">
1814
<arg>1</arg>
19-
</arguments>
20-
<status status="PASS" starttime="20210319 11:34:50.088" endtime="20210319 11:34:50.088"></status>
15+
<status status="NOT RUN" start="2026-06-04T16:18:55.688330" elapsed="0.000034"/>
2116
</kw>
22-
<kw name="Minus" library="Calculator">
23-
<arguments>
17+
<kw name="Minus" owner="Calculator">
2418
<arg>1</arg>
25-
</arguments>
26-
<status status="PASS" starttime="20210319 11:34:50.088" endtime="20210319 11:34:50.089"></status>
19+
<status status="NOT RUN" start="2026-06-04T16:18:55.688410" elapsed="0.000021"/>
2720
</kw>
28-
<kw name="Result Is" library="Calculator">
29-
<arguments>
21+
<kw name="Result Is" owner="Calculator">
3022
<arg>0</arg>
31-
</arguments>
32-
<status status="PASS" starttime="20210319 11:34:50.089" endtime="20210319 11:34:50.089"></status>
23+
<status status="NOT RUN" start="2026-06-04T16:18:55.688468" elapsed="0.000018"/>
3324
</kw>
34-
<status status="PASS" starttime="20210319 11:34:50.087" endtime="20210319 11:34:50.089" critical="yes"></status>
25+
<status status="PASS" start="2026-06-04T16:18:55.688231" elapsed="0.000296"/>
3526
</test>
36-
<test id="s1-s1-t3" name="Minus method 2">
37-
<kw name="Plus" library="Calculator">
38-
<arguments>
27+
<test id="s1-s1-t3" name="Minus method 2" line="14">
28+
<kw name="Plus" owner="Calculator">
3929
<arg>10</arg>
40-
</arguments>
41-
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
30+
<status status="NOT RUN" start="2026-06-04T16:18:55.688668" elapsed="0.000020"/>
4231
</kw>
43-
<kw name="Minus" library="Calculator">
44-
<arguments>
32+
<kw name="Minus" owner="Calculator">
4533
<arg>20</arg>
46-
</arguments>
47-
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
34+
<status status="NOT RUN" start="2026-06-04T16:18:55.688722" elapsed="0.000017"/>
4835
</kw>
49-
<kw name="Result Is" library="Calculator">
50-
<arguments>
36+
<kw name="Result Is" owner="Calculator">
5137
<arg>-10</arg>
52-
</arguments>
53-
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
38+
<status status="NOT RUN" start="2026-06-04T16:18:55.688772" elapsed="0.000017"/>
5439
</kw>
55-
<status status="PASS" starttime="20210319 11:34:50.089" endtime="20210319 11:34:50.091" critical="yes"></status>
40+
<status status="PASS" start="2026-06-04T16:18:55.688587" elapsed="0.000240"/>
5641
</test>
57-
<status status="FAIL" starttime="20210319 11:34:50.080" endtime="20210319 11:34:50.091"></status>
42+
<status status="PASS" start="2026-06-04T16:18:55.686349" elapsed="0.002607"/>
5843
</suite>
59-
<suite id="s1-s2" name="Plus" source="/src/github.com/launchableinc/rocket-car-robot/plus.robot">
60-
<test id="s1-s2-t1" name="Check method">
61-
<kw name="Result Is" library="Calculator">
62-
<arguments>
44+
<suite id="s1-s2" name="Plus" source="/Users/ryabuki/src/github.com/cloudbees-oss/smart-tests-integration-examples/robot/plus.robot">
45+
<test id="s1-s2-t1" name="Check method" line="6">
46+
<kw name="Result Is" owner="Calculator">
6347
<arg>-1</arg>
64-
</arguments>
65-
<msg timestamp="20210319 11:34:50.095" level="FAIL">0 != -1</msg>
66-
<status status="FAIL" starttime="20210319 11:34:50.095" endtime="20210319 11:34:50.095"></status>
48+
<status status="NOT RUN" start="2026-06-04T16:18:55.689659" elapsed="0.000021"/>
6749
</kw>
68-
<status status="FAIL" starttime="20210319 11:34:50.094" endtime="20210319 11:34:50.095" critical="yes">0 != -1</status>
50+
<status status="PASS" start="2026-06-04T16:18:55.689575" elapsed="0.000142"/>
6951
</test>
70-
<test id="s1-s2-t2" name="Plus method">
71-
<kw name="Plus" library="Calculator">
72-
<arguments>
52+
<test id="s1-s2-t2" name="Plus method" line="9">
53+
<kw name="Plus" owner="Calculator">
7354
<arg>1</arg>
74-
</arguments>
75-
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
55+
<status status="NOT RUN" start="2026-06-04T16:18:55.689845" elapsed="0.000020"/>
7656
</kw>
77-
<kw name="Plus" library="Calculator">
78-
<arguments>
57+
<kw name="Plus" owner="Calculator">
7958
<arg>1</arg>
80-
</arguments>
81-
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
59+
<status status="NOT RUN" start="2026-06-04T16:18:55.689897" elapsed="0.000017"/>
8260
</kw>
83-
<kw name="Result Is" library="Calculator">
84-
<arguments>
61+
<kw name="Result Is" owner="Calculator">
8562
<arg>2</arg>
86-
</arguments>
87-
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
63+
<status status="NOT RUN" start="2026-06-04T16:18:55.689945" elapsed="0.000016"/>
8864
</kw>
89-
<status status="PASS" starttime="20210319 11:34:50.095" endtime="20210319 11:34:50.097" critical="yes"></status>
65+
<status status="PASS" start="2026-06-04T16:18:55.689772" elapsed="0.000225"/>
9066
</test>
91-
<test id="s1-s2-t3" name="Plus method 2">
92-
<kw name="Plus" library="Calculator">
93-
<arguments>
67+
<test id="s1-s2-t3" name="Plus method 2" line="14">
68+
<kw name="Plus" owner="Calculator">
9469
<arg>10</arg>
95-
</arguments>
96-
<status status="PASS" starttime="20210319 11:34:50.097" endtime="20210319 11:34:50.098"></status>
70+
<status status="NOT RUN" start="2026-06-04T16:18:55.690120" elapsed="0.000021"/>
9771
</kw>
98-
<kw name="Plus" library="Calculator">
99-
<arguments>
72+
<kw name="Plus" owner="Calculator">
10073
<arg>20</arg>
101-
</arguments>
102-
<status status="PASS" starttime="20210319 11:34:50.098" endtime="20210319 11:34:50.098"></status>
74+
<status status="NOT RUN" start="2026-06-04T16:18:55.690175" elapsed="0.000018"/>
10375
</kw>
104-
<kw name="Result Is" library="Calculator">
105-
<arguments>
76+
<kw name="Result Is" owner="Calculator">
10677
<arg>30</arg>
107-
</arguments>
108-
<status status="PASS" starttime="20210319 11:34:50.098" endtime="20210319 11:34:50.098"></status>
78+
<status status="NOT RUN" start="2026-06-04T16:18:55.690226" elapsed="0.000016"/>
10979
</kw>
110-
<status status="PASS" starttime="20210319 11:34:50.097" endtime="20210319 11:34:50.099" critical="yes"></status>
80+
<status status="PASS" start="2026-06-04T16:18:55.690050" elapsed="0.000227"/>
11181
</test>
112-
<status status="FAIL" starttime="20210319 11:34:50.092" endtime="20210319 11:34:50.099"></status>
82+
<status status="PASS" start="2026-06-04T16:18:55.689089" elapsed="0.001258"/>
11383
</suite>
114-
<status status="FAIL" starttime="20210319 11:34:50.046" endtime="20210319 11:34:50.100"></status>
84+
<status status="PASS" start="2026-06-04T16:18:55.668356" elapsed="0.022122"/>
11585
</suite>
11686
<statistics>
11787
<total>
118-
<stat pass="4" fail="2">Critical Tests</stat>
119-
<stat pass="4" fail="2">All Tests</stat>
88+
<stat pass="6" fail="0" skip="0">All Tests</stat>
12089
</total>
12190
<tag>
12291
</tag>
12392
<suite>
124-
<stat pass="4" fail="2" id="s1" name="Rocket-Car-Robot">Rocket-Car-Robot</stat>
125-
<stat pass="2" fail="1" id="s1-s1" name="Minus">Rocket-Car-Robot.Minus</stat>
126-
<stat pass="2" fail="1" id="s1-s2" name="Plus">Rocket-Car-Robot.Plus</stat>
93+
<stat name="Robot" id="s1" pass="6" fail="0" skip="0">Robot</stat>
94+
<stat name="Minus" id="s1-s1" pass="3" fail="0" skip="0">Robot.Minus</stat>
95+
<stat name="Plus" id="s1-s2" pass="3" fail="0" skip="0">Robot.Plus</stat>
12796
</suite>
12897
</statistics>
12998
<errors>

tests/data/robot/output_legacy.xml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<robot generator="Robot 3.2.2 (Python 3.9.1 on darwin)" generated="20210319 11:34:50.044" rpa="false">
3+
<suite id="s1" name="Rocket-Car-Robot" source="/src/github.com/launchableinc/rocket-car-robot">
4+
<suite id="s1-s1" name="Minus" source="/src/github.com/launchableinc/rocket-car-robot/minus.robot">
5+
<test id="s1-s1-t1" name="Check method">
6+
<kw name="Result Is" library="Calculator">
7+
<arguments>
8+
<arg>-1</arg>
9+
</arguments>
10+
<msg timestamp="20210319 11:34:50.087" level="FAIL">0 != -1</msg>
11+
<status status="FAIL" starttime="20210319 11:34:50.085" endtime="20210319 11:34:50.087"></status>
12+
</kw>
13+
<status status="FAIL" starttime="20210319 11:34:50.085" endtime="20210319 11:34:50.087" critical="yes">0 != -1</status>
14+
</test>
15+
<test id="s1-s1-t2" name="Minus method">
16+
<kw name="Plus" library="Calculator">
17+
<arguments>
18+
<arg>1</arg>
19+
</arguments>
20+
<status status="PASS" starttime="20210319 11:34:50.088" endtime="20210319 11:34:50.088"></status>
21+
</kw>
22+
<kw name="Minus" library="Calculator">
23+
<arguments>
24+
<arg>1</arg>
25+
</arguments>
26+
<status status="PASS" starttime="20210319 11:34:50.088" endtime="20210319 11:34:50.089"></status>
27+
</kw>
28+
<kw name="Result Is" library="Calculator">
29+
<arguments>
30+
<arg>0</arg>
31+
</arguments>
32+
<status status="PASS" starttime="20210319 11:34:50.089" endtime="20210319 11:34:50.089"></status>
33+
</kw>
34+
<status status="PASS" starttime="20210319 11:34:50.087" endtime="20210319 11:34:50.089" critical="yes"></status>
35+
</test>
36+
<test id="s1-s1-t3" name="Minus method 2">
37+
<kw name="Plus" library="Calculator">
38+
<arguments>
39+
<arg>10</arg>
40+
</arguments>
41+
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
42+
</kw>
43+
<kw name="Minus" library="Calculator">
44+
<arguments>
45+
<arg>20</arg>
46+
</arguments>
47+
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
48+
</kw>
49+
<kw name="Result Is" library="Calculator">
50+
<arguments>
51+
<arg>-10</arg>
52+
</arguments>
53+
<status status="PASS" starttime="20210319 11:34:50.090" endtime="20210319 11:34:50.090"></status>
54+
</kw>
55+
<status status="PASS" starttime="20210319 11:34:50.089" endtime="20210319 11:34:50.091" critical="yes"></status>
56+
</test>
57+
<status status="FAIL" starttime="20210319 11:34:50.080" endtime="20210319 11:34:50.091"></status>
58+
</suite>
59+
<suite id="s1-s2" name="Plus" source="/src/github.com/launchableinc/rocket-car-robot/plus.robot">
60+
<test id="s1-s2-t1" name="Check method">
61+
<kw name="Result Is" library="Calculator">
62+
<arguments>
63+
<arg>-1</arg>
64+
</arguments>
65+
<msg timestamp="20210319 11:34:50.095" level="FAIL">0 != -1</msg>
66+
<status status="FAIL" starttime="20210319 11:34:50.095" endtime="20210319 11:34:50.095"></status>
67+
</kw>
68+
<status status="FAIL" starttime="20210319 11:34:50.094" endtime="20210319 11:34:50.095" critical="yes">0 != -1</status>
69+
</test>
70+
<test id="s1-s2-t2" name="Plus method">
71+
<kw name="Plus" library="Calculator">
72+
<arguments>
73+
<arg>1</arg>
74+
</arguments>
75+
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
76+
</kw>
77+
<kw name="Plus" library="Calculator">
78+
<arguments>
79+
<arg>1</arg>
80+
</arguments>
81+
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
82+
</kw>
83+
<kw name="Result Is" library="Calculator">
84+
<arguments>
85+
<arg>2</arg>
86+
</arguments>
87+
<status status="PASS" starttime="20210319 11:34:50.096" endtime="20210319 11:34:50.096"></status>
88+
</kw>
89+
<status status="PASS" starttime="20210319 11:34:50.095" endtime="20210319 11:34:50.097" critical="yes"></status>
90+
</test>
91+
<test id="s1-s2-t3" name="Plus method 2">
92+
<kw name="Plus" library="Calculator">
93+
<arguments>
94+
<arg>10</arg>
95+
</arguments>
96+
<status status="PASS" starttime="20210319 11:34:50.097" endtime="20210319 11:34:50.098"></status>
97+
</kw>
98+
<kw name="Plus" library="Calculator">
99+
<arguments>
100+
<arg>20</arg>
101+
</arguments>
102+
<status status="PASS" starttime="20210319 11:34:50.098" endtime="20210319 11:34:50.098"></status>
103+
</kw>
104+
<kw name="Result Is" library="Calculator">
105+
<arguments>
106+
<arg>30</arg>
107+
</arguments>
108+
<status status="PASS" starttime="20210319 11:34:50.098" endtime="20210319 11:34:50.098"></status>
109+
</kw>
110+
<status status="PASS" starttime="20210319 11:34:50.097" endtime="20210319 11:34:50.099" critical="yes"></status>
111+
</test>
112+
<status status="FAIL" starttime="20210319 11:34:50.092" endtime="20210319 11:34:50.099"></status>
113+
</suite>
114+
<status status="FAIL" starttime="20210319 11:34:50.046" endtime="20210319 11:34:50.100"></status>
115+
</suite>
116+
<statistics>
117+
<total>
118+
<stat pass="4" fail="2">Critical Tests</stat>
119+
<stat pass="4" fail="2">All Tests</stat>
120+
</total>
121+
<tag>
122+
</tag>
123+
<suite>
124+
<stat pass="4" fail="2" id="s1" name="Rocket-Car-Robot">Rocket-Car-Robot</stat>
125+
<stat pass="2" fail="1" id="s1-s1" name="Minus">Rocket-Car-Robot.Minus</stat>
126+
<stat pass="2" fail="1" id="s1-s2" name="Plus">Rocket-Car-Robot.Plus</stat>
127+
</suite>
128+
</statistics>
129+
<errors>
130+
</errors>
131+
</robot>

0 commit comments

Comments
 (0)