robotframework-robotlog2db 1.3.8__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/PKG-INFO +1 -1
  2. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/RobotLog2DB.pdf +0 -0
  3. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/robotlog2db.py +101 -14
  4. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/version.py +2 -2
  5. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/xsd/robot.xsd +22 -2
  6. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/PKG-INFO +1 -1
  7. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/README.rst +0 -0
  8. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/CDataBase.py +0 -0
  9. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/__init__.py +0 -0
  10. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/RobotLog2DB/__main__.py +0 -0
  11. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/SOURCES.txt +0 -0
  12. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/dependency_links.txt +0 -0
  13. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/entry_points.txt +0 -0
  14. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/requires.txt +0 -0
  15. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/robotframework_robotlog2db.egg-info/top_level.txt +0 -0
  16. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/setup.cfg +0 -0
  17. {robotframework-robotlog2db-1.3.8 → robotframework-robotlog2db-1.4.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-robotlog2db
3
- Version: 1.3.8
3
+ Version: 1.4.0
4
4
  Summary: Imports robot result(s) to TestResultWebApp database
5
5
  Home-page: https://github.com/test-fullautomation/robotframework-robotlog2db
6
6
  Author: Tran Duy Ngoan
@@ -548,6 +548,81 @@ Format the given time string to TestResultWebApp's format for importing to db.
548
548
  fatal_error=True)
549
549
  return sFormatedTime
550
550
 
551
+ def retrieve_result_starttime(objResult):
552
+ """
553
+ Retrieve starttime infomration from given result object (TestSuite or TestCase).
554
+ In case the starttime in given suite is 'N/A', it will try to get this information from its children suite/test.
555
+
556
+ **Arguments:**
557
+
558
+ * ``stime``
559
+
560
+ / *Condition*: required / *Type*: `TestSuite` or `TestCase` object /
561
+
562
+ Result object to retrieve starttime.
563
+
564
+ **Returns:**
565
+
566
+ * / *Type*: str /
567
+
568
+ Start time of given result.
569
+ """
570
+ lStarttime = []
571
+ # Try to get starttime from root TestSuite to children TestCase
572
+ if type(objResult).__name__ == "TestSuite":
573
+ if objResult.starttime:
574
+ return objResult.starttime
575
+ elif len(objResult.suites) > 0:
576
+ lStarttime = [suite_starttime for suite in objResult.suites if (suite_starttime:=retrieve_result_starttime(suite)) is not None]
577
+ else:
578
+ lStarttime = [test_starttime for test in objResult.tests if (test_starttime:=retrieve_result_starttime(test)) is not None]
579
+ elif type(objResult).__name__ == "TestCase":
580
+ if objResult.starttime:
581
+ return objResult.starttime
582
+
583
+ if len(lStarttime):
584
+ return min(lStarttime)
585
+
586
+ return None
587
+
588
+ def retrieve_result_endtime(objResult):
589
+ """
590
+ Retrieve endtime infomration from given result object (TestSuite or TestCase).
591
+ In case the endtime in given suite is 'N/A', it will try to get this information from its children suite/test.
592
+
593
+ **Arguments:**
594
+
595
+ * ``stime``
596
+
597
+ / *Condition*: required / *Type*: `TestSuite` or `TestCase` object /
598
+
599
+ Result object to retrieve endtime.
600
+
601
+ **Returns:**
602
+
603
+ * / *Type*: str /
604
+
605
+ End time of given result.
606
+ """
607
+ lEndtime = []
608
+ # Try to get endtime from root TestSuite to children TestCase
609
+ if type(objResult).__name__ == "TestSuite":
610
+ if objResult.endtime:
611
+ return objResult.endtime
612
+ elif len(objResult.suites) > 0:
613
+ lEndtime = [suite_endtime for suite in objResult.suites if (suite_endtime:=retrieve_result_endtime(suite)) is not None]
614
+ else:
615
+ lEndtime = [test_endtime for test in objResult.tests if (test_endtime:=retrieve_result_endtime(test)) is not None]
616
+ elif type(objResult).__name__ == "TestCase":
617
+ if objResult.endtime:
618
+ return objResult.endtime
619
+
620
+ if len(lEndtime):
621
+ return max(lEndtime)
622
+
623
+ return None
624
+
625
+
551
626
  def __process_commandline():
552
627
  """
553
628
  Process provided argument(s) from command line.
@@ -738,13 +813,20 @@ Process to the lowest suite level (test file):
738
813
  else:
739
814
  # File metadata
740
815
  metadata_info = process_metadata(suite.metadata, root_metadata)
741
- _tbl_file_name = suite.source
816
+ _tbl_file_name = str(suite.source)
742
817
  _tbl_file_tester_account = metadata_info['tester']
743
818
  if dConfig != None and 'tester' in dConfig:
744
819
  _tbl_file_tester_account = dConfig['tester']
745
820
  _tbl_file_tester_machine = metadata_info['machine']
746
- _tbl_file_time_start = format_time(suite.starttime)
747
- _tbl_file_time_end = format_time(suite.endtime)
821
+
822
+ sSuiteStarttime = retrieve_result_starttime(suite)
823
+ sSuiteEndtime = retrieve_result_endtime(suite)
824
+ if not sSuiteStarttime:
825
+ Logger.log_error(f"Could not retieve start time of suite '{suite.name}'.")
826
+ if not sSuiteEndtime:
827
+ Logger.log_error(f"Could not retieve end time of suite '{suite.name}'.")
828
+ _tbl_file_time_start = format_time(sSuiteStarttime)
829
+ _tbl_file_time_end = format_time(sSuiteEndtime)
748
830
 
749
831
  # Process component information if not provided in metadata
750
832
  if metadata_info['component'] == '':
@@ -1208,23 +1290,28 @@ Flow to import Robot results to database:
1208
1290
  _tbl_result_version_sw_test = sVersionTest
1209
1291
 
1210
1292
  # Process start/end time info
1211
- sSuiteStarttime = result.suite.starttime
1212
- sSuiteEndtime = result.suite.endtime
1213
-
1214
- # Get start and end time of suite a as min and max time incase multiple suite results
1215
- if (len(sources) > 1) or (len(result.suite.suites) > 0):
1216
- sSuiteStarttime = min([suite.starttime for suite in result.suite.suites])
1217
- sSuiteEndtime = max([suite.endtime for suite in result.suite.suites])
1218
-
1219
- _tbl_result_time_start = format_time(sSuiteStarttime)
1220
- _tbl_result_time_end = format_time(sSuiteEndtime)
1293
+ sExecutionStarttime = retrieve_result_starttime(result.suite)
1294
+ sExecutionEndtime = retrieve_result_endtime(result.suite)
1295
+ if not sExecutionStarttime:
1296
+ Logger.log_error(f"Could not retieve execution start time."+
1297
+ "\nPlease use rebot with option '--starttime timestamp' when merging/combining result files."+
1298
+ "\nOr rerun Robotframework testcase(s) to get proper *.xml result file.",
1299
+ fatal_error=True)
1300
+ if not sExecutionEndtime:
1301
+ Logger.log_error(f"Could not retieve execution end time."+
1302
+ "\nPlease use rebot with option '--endtime timestamp' when merging/combining result files."+
1303
+ "\nOr rerun Robotframework testcase(s) to get proper *.xml result file",
1304
+ fatal_error=True)
1305
+
1306
+ _tbl_result_time_start = format_time(sExecutionStarttime)
1307
+ _tbl_result_time_end = format_time(sExecutionEndtime)
1221
1308
 
1222
1309
  # Set version as start time of the execution if not provided in metadata
1223
1310
  # Format: %Y%m%d_%H%M%S
1224
1311
  if _tbl_result_version_sw_target=="":
1225
1312
  bUseDefaultVersionSW = True
1226
1313
  _tbl_result_version_sw_target = re.sub(r'(\d{8})\s(\d{2}):(\d{2}):(\d{2})\.\d+',
1227
- r'\1_\2\3\4', sSuiteStarttime)
1314
+ r'\1_\2\3\4', sExecutionStarttime)
1228
1315
  if not args.append:
1229
1316
  Logger.log(f"Set project/variant to '{sVariant}' ({sMsgVarirantSetBy})")
1230
1317
  Logger.log(f"Set version_sw to '{_tbl_result_version_sw_target}' ({sMsgVersionSWSetBy})")
@@ -18,5 +18,5 @@
18
18
  #
19
19
  # Version and date of RobotLog2DB
20
20
  #
21
- VERSION = "1.3.8"
22
- VERSION_DATE = "21.06.2023"
21
+ VERSION = "1.4.0"
22
+ VERSION_DATE = "19.09.2023"
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3">
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="4">
3
3
  <xs:annotation>
4
4
  <xs:documentation xml:lang="en">
5
5
  = Robot Framework output.xml schema =
@@ -33,7 +33,7 @@
33
33
  <xs:simpleType name="SpecVersion">
34
34
  <xs:restriction base="xs:integer">
35
35
  <xs:minInclusive value="2" />
36
- <xs:maxInclusive value="3" />
36
+ <xs:maxInclusive value="4" />
37
37
  </xs:restriction>
38
38
  </xs:simpleType>
39
39
  <xs:complexType name="Suite">
@@ -58,6 +58,13 @@
58
58
  </xs:extension>
59
59
  </xs:simpleContent>
60
60
  </xs:complexType>
61
+ <xs:complexType name="Error">
62
+ <xs:choice maxOccurs="unbounded">
63
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
64
+ <xs:element name="msg" type="Message" />
65
+ <xs:element name="status" type="Status" />
66
+ </xs:choice>
67
+ </xs:complexType>
61
68
  <xs:complexType name="Test">
62
69
  <xs:choice maxOccurs="unbounded">
63
70
  <xs:element name="kw" type="Keyword" minOccurs="0" maxOccurs="unbounded" />
@@ -65,6 +72,7 @@
65
72
  <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
66
73
  <xs:element name="try" type="Try" minOccurs="0" maxOccurs="unbounded" />
67
74
  <xs:element name="while" type="While" minOccurs="0" maxOccurs="unbounded" />
75
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
68
76
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
69
77
  <xs:element name="doc" type="xs:string" minOccurs="0" />
70
78
  <xs:element name="tag" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
@@ -84,6 +92,7 @@
84
92
  <xs:element name="if" type="If" minOccurs="0" maxOccurs="unbounded" />
85
93
  <xs:element name="try" type="Try" minOccurs="0" maxOccurs="unbounded" />
86
94
  <xs:element name="while" type="While" minOccurs="0" maxOccurs="unbounded" />
95
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
87
96
  <xs:element name="return" type="Return" minOccurs="0" maxOccurs="unbounded" />
88
97
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
89
98
  <xs:element name="var" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> <!-- Assignment -->
@@ -115,6 +124,9 @@
115
124
  <xs:element name="status" type="BodyItemStatus" />
116
125
  </xs:choice>
117
126
  <xs:attribute name="flavor" type="ForFlavor" />
127
+ <xs:attribute name="start" type="xs:string" /> <!-- Used if IN ENUMERATE has `start`. -->
128
+ <xs:attribute name="mode" type="xs:string" /> <!-- Used if IN ZIP has `mode`. -->
129
+ <xs:attribute name="fill" type="xs:string" /> <!-- Used if IN ZIP has `fill`. -->
118
130
  </xs:complexType>
119
131
  <xs:simpleType name="ForFlavor">
120
132
  <xs:restriction base="xs:string">
@@ -136,6 +148,7 @@
136
148
  <xs:element name="return" type="Return" minOccurs="0" maxOccurs="unbounded" />
137
149
  <xs:element name="break" type="Break" minOccurs="0" maxOccurs="unbounded" />
138
150
  <xs:element name="continue" type="Continue" minOccurs="0" maxOccurs="unbounded" />
151
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
139
152
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
140
153
  <xs:element name="doc" type="xs:string" minOccurs="0" />
141
154
  <xs:element name="status" type="BodyItemStatus" />
@@ -166,6 +179,7 @@
166
179
  <xs:element name="return" type="Return" minOccurs="0" maxOccurs="unbounded" />
167
180
  <xs:element name="break" type="Break" minOccurs="0" maxOccurs="unbounded" />
168
181
  <xs:element name="continue" type="Continue" minOccurs="0" maxOccurs="unbounded" />
182
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
169
183
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
170
184
  <xs:element name="doc" type="xs:string" minOccurs="0" />
171
185
  <xs:element name="status" type="BodyItemStatus" />
@@ -199,6 +213,7 @@
199
213
  <xs:element name="return" type="Return" minOccurs="0" maxOccurs="unbounded" />
200
214
  <xs:element name="break" type="Break" minOccurs="0" maxOccurs="unbounded" />
201
215
  <xs:element name="continue" type="Continue" minOccurs="0" maxOccurs="unbounded" />
216
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
202
217
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
203
218
  <xs:element name="doc" type="xs:string" minOccurs="0" />
204
219
  <xs:element name="status" type="BodyItemStatus" />
@@ -224,6 +239,9 @@
224
239
  <xs:element name="status" type="BodyItemStatus" />
225
240
  </xs:choice>
226
241
  <xs:attribute name="condition" type="xs:string" />
242
+ <xs:attribute name="limit" type="xs:string" />
243
+ <xs:attribute name="on_limit" type="xs:string" />
244
+ <xs:attribute name="on_limit_message" type="xs:string" />
227
245
  </xs:complexType>
228
246
  <xs:complexType name="WhileIteration">
229
247
  <xs:choice maxOccurs="unbounded">
@@ -235,6 +253,7 @@
235
253
  <xs:element name="return" type="Return" minOccurs="0" maxOccurs="unbounded" />
236
254
  <xs:element name="break" type="Break" minOccurs="0" maxOccurs="unbounded" />
237
255
  <xs:element name="continue" type="Continue" minOccurs="0" maxOccurs="unbounded" />
256
+ <xs:element name="error" type="Error" minOccurs="0" maxOccurs="unbounded" />
238
257
  <xs:element name="msg" type="Message" minOccurs="0" maxOccurs="unbounded" />
239
258
  <xs:element name="doc" type="xs:string" minOccurs="0" />
240
259
  <xs:element name="status" type="BodyItemStatus" />
@@ -299,6 +318,7 @@
299
318
  <xs:enumeration value="PASS" />
300
319
  <xs:enumeration value="FAIL" />
301
320
  <xs:enumeration value="SKIP" />
321
+ <xs:enumeration value="NOT RUN" />
302
322
  <xs:enumeration value="UNKNOWN" />
303
323
  </xs:restriction>
304
324
  </xs:simpleType>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-robotlog2db
3
- Version: 1.3.8
3
+ Version: 1.4.0
4
4
  Summary: Imports robot result(s) to TestResultWebApp database
5
5
  Home-page: https://github.com/test-fullautomation/robotframework-robotlog2db
6
6
  Author: Tran Duy Ngoan