robotframework-robotlog2rqm 1.4.2__tar.gz → 1.5.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.
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/PKG-INFO +79 -17
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/README.rst +65 -11
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/CRQM.py +77 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RobotLog2RQM.pdf +0 -0
- robotframework_robotlog2rqm-1.5.0/RobotLog2RQM/logger.py +180 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/robotlog2rqm.py +2 -157
- robotframework_robotlog2rqm-1.5.0/RobotLog2RQM/rqmtool.py +316 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/version.py +2 -2
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/PKG-INFO +79 -17
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/SOURCES.txt +2 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/entry_points.txt +1 -1
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/LICENSE +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/buildrecord.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/configuration.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/executionresult.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/executionworkitem.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/suiteexecutionrecord.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/testcase.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/testsuite.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/RQM_templates/testsuitelog.xml +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/__init__.py +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/__main__.py +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/dependency_links.txt +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/requires.txt +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/robotframework_robotlog2rqm.egg-info/top_level.txt +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/setup.cfg +0 -0
- {robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/setup.py +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-robotlog2rqm
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Imports robot result(s) to IBM Rational Quality Manager (RQM)
|
|
5
5
|
Home-page: https://github.com/test-fullautomation/robotframework-robotlog2rqm
|
|
6
6
|
Author: Tran Duy Ngoan
|
|
7
7
|
Author-email: Ngoan.TranDuy@vn.bosch.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Classifier: Programming Language :: Python :: 3
|
|
11
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
10
|
Classifier: Operating System :: OS Independent
|
|
@@ -16,6 +14,20 @@ Classifier: Topic :: Software Development
|
|
|
16
14
|
Requires-Python: >=3.0
|
|
17
15
|
Description-Content-Type: text/markdown
|
|
18
16
|
License-File: LICENSE
|
|
17
|
+
Requires-Dist: lxml
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: colorama
|
|
20
|
+
Requires-Dist: robotframework
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: description
|
|
25
|
+
Dynamic: description-content-type
|
|
26
|
+
Dynamic: home-page
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
Dynamic: requires-dist
|
|
29
|
+
Dynamic: requires-python
|
|
30
|
+
Dynamic: summary
|
|
19
31
|
|
|
20
32
|
# RobotLog2RQM Description
|
|
21
33
|
|
|
@@ -125,15 +137,15 @@ Use below command to get tools\'s usage:
|
|
|
125
137
|
|
|
126
138
|
The usage should be showed as below:
|
|
127
139
|
|
|
128
|
-
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
129
|
-
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
140
|
+
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
141
|
+
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
130
142
|
resultxmlfile host project user password testplan
|
|
131
143
|
|
|
132
|
-
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
144
|
+
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
133
145
|
Robot Framework into an IBM Rational Quality Manager.
|
|
134
146
|
|
|
135
147
|
positional arguments:
|
|
136
|
-
resultxmlfile absolute or relative path to the xml result file
|
|
148
|
+
resultxmlfile absolute or relative path to the xml result file
|
|
137
149
|
or directory of result files to be imported.
|
|
138
150
|
host RQM host url.
|
|
139
151
|
project project on RQM.
|
|
@@ -145,19 +157,19 @@ The usage should be showed as below:
|
|
|
145
157
|
-h, --help show this help message and exit
|
|
146
158
|
-v, --version Version of the RobotLog2RQM importer.
|
|
147
159
|
--testsuite TESTSUITE
|
|
148
|
-
testsuite ID for this execution. If 'new', then create a new
|
|
160
|
+
testsuite ID for this execution. If 'new', then create a new
|
|
149
161
|
testsuite for this execution.
|
|
150
|
-
--recursive if set, then the path is searched recursively for
|
|
162
|
+
--recursive if set, then the path is searched recursively for
|
|
151
163
|
log files to be imported.
|
|
152
|
-
--createmissing if set, then all testcases without tcid are created
|
|
164
|
+
--createmissing if set, then all testcases without tcid are created
|
|
153
165
|
when importing.
|
|
154
|
-
--updatetestcase if set, then testcase information on RQM will be updated
|
|
166
|
+
--updatetestcase if set, then testcase information on RQM will be updated
|
|
155
167
|
bases on robot testfile.
|
|
156
|
-
--dryrun if set, then verify all input arguments
|
|
168
|
+
--dryrun if set, then verify all input arguments
|
|
157
169
|
(includes RQM authentication) and show what would be done.
|
|
158
|
-
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
170
|
+
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
159
171
|
to be enabled for the project area.
|
|
160
|
-
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
172
|
+
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
161
173
|
or Baselines Only to be enabled for the project area.
|
|
162
174
|
|
|
163
175
|
The below command is simple usage witth all required arguments to import
|
|
@@ -209,6 +221,58 @@ Then, open RQM with your favourite browser and you will see that the
|
|
|
209
221
|
test case execution records and their results are imported in the given
|
|
210
222
|
testplan ID.
|
|
211
223
|
|
|
224
|
+
# RQMTool Submodule
|
|
225
|
+
|
|
226
|
+
The package now includes a submodule **RQMTool** which provides a
|
|
227
|
+
standalone CLI to fetch test cases and test suites from IBM RQM test
|
|
228
|
+
plans.
|
|
229
|
+
|
|
230
|
+
RQMTool is accessible as a Python module:
|
|
231
|
+
|
|
232
|
+
python -m RobotLog2RQM.rqmtool --host <RQM_SERVER_URL> --project <PROJECT_AREA> \
|
|
233
|
+
--user <USERNAME> --password <PASSWORD> \
|
|
234
|
+
--testplan <TESTPLAN_ID> [--types <artifact_types>] \
|
|
235
|
+
[--format <csv|json>] [--output-dir <DIR>] \
|
|
236
|
+
[--basename <BASENAME>] [--dryrun]
|
|
237
|
+
|
|
238
|
+
Main features:
|
|
239
|
+
|
|
240
|
+
- Fetches selected artifact types ([testcase]{.title-ref} or
|
|
241
|
+
[testsuite]{.title-ref}) from a given test plan.
|
|
242
|
+
- Supports CSV or JSON export, with automatic filenames including the
|
|
243
|
+
test plan ID.
|
|
244
|
+
|
|
245
|
+
## How to use RQMTool
|
|
246
|
+
|
|
247
|
+
RQMTool requires RQM information (host URL, project, credentials) and a
|
|
248
|
+
test plan ID. Use the [-h]{.title-ref} argument to see full usage:
|
|
249
|
+
|
|
250
|
+
python -m RobotLog2RQM.rqmtool -h
|
|
251
|
+
|
|
252
|
+
This will display all available command line options for RQMTool, such
|
|
253
|
+
as:
|
|
254
|
+
|
|
255
|
+
- [\--types]{.title-ref} : artifact types to fetch
|
|
256
|
+
([testcase]{.title-ref}, [testsuite]{.title-ref}). Default: both.
|
|
257
|
+
- \`\--format\`: output format, either [csv]{.title-ref} or
|
|
258
|
+
[json]{.title-ref}.
|
|
259
|
+
- \`\--output-dir\`: directory to save exported files.
|
|
260
|
+
- \`\--basename\`: base name for output files.
|
|
261
|
+
- \`\--dryrun\`: validate inputs and RQM login without fetching data.
|
|
262
|
+
|
|
263
|
+
## Example
|
|
264
|
+
|
|
265
|
+
Fetch all test cases and test suites from test plan ID 720 and export to
|
|
266
|
+
CSV:
|
|
267
|
+
|
|
268
|
+
python -m RobotLog2RQM.rqmtool --host https://sample-rqm-host.com \
|
|
269
|
+
--project ROBFW-AIO \
|
|
270
|
+
--user test_user \
|
|
271
|
+
--password test_pw \
|
|
272
|
+
--testplan 720 \
|
|
273
|
+
--types testcase,testsuite \
|
|
274
|
+
--format csv
|
|
275
|
+
|
|
212
276
|
### Sourcecode Documentation
|
|
213
277
|
|
|
214
278
|
To understand more detail about the tool\'s features and how Robot test
|
|
@@ -256,5 +320,3 @@ distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
|
256
320
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
257
321
|
See the License for the specific language governing permissions and
|
|
258
322
|
limitations under the License.
|
|
259
|
-
|
|
260
|
-
|
|
@@ -112,15 +112,15 @@ The usage should be showed as below:
|
|
|
112
112
|
|
|
113
113
|
::
|
|
114
114
|
|
|
115
|
-
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
116
|
-
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
115
|
+
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
116
|
+
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
117
117
|
resultxmlfile host project user password testplan
|
|
118
118
|
|
|
119
|
-
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
119
|
+
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
120
120
|
Robot Framework into an IBM Rational Quality Manager.
|
|
121
121
|
|
|
122
122
|
positional arguments:
|
|
123
|
-
resultxmlfile absolute or relative path to the xml result file
|
|
123
|
+
resultxmlfile absolute or relative path to the xml result file
|
|
124
124
|
or directory of result files to be imported.
|
|
125
125
|
host RQM host url.
|
|
126
126
|
project project on RQM.
|
|
@@ -132,19 +132,19 @@ The usage should be showed as below:
|
|
|
132
132
|
-h, --help show this help message and exit
|
|
133
133
|
-v, --version Version of the RobotLog2RQM importer.
|
|
134
134
|
--testsuite TESTSUITE
|
|
135
|
-
testsuite ID for this execution. If 'new', then create a new
|
|
135
|
+
testsuite ID for this execution. If 'new', then create a new
|
|
136
136
|
testsuite for this execution.
|
|
137
|
-
--recursive if set, then the path is searched recursively for
|
|
137
|
+
--recursive if set, then the path is searched recursively for
|
|
138
138
|
log files to be imported.
|
|
139
|
-
--createmissing if set, then all testcases without tcid are created
|
|
139
|
+
--createmissing if set, then all testcases without tcid are created
|
|
140
140
|
when importing.
|
|
141
|
-
--updatetestcase if set, then testcase information on RQM will be updated
|
|
141
|
+
--updatetestcase if set, then testcase information on RQM will be updated
|
|
142
142
|
bases on robot testfile.
|
|
143
|
-
--dryrun if set, then verify all input arguments
|
|
143
|
+
--dryrun if set, then verify all input arguments
|
|
144
144
|
(includes RQM authentication) and show what would be done.
|
|
145
|
-
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
145
|
+
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
146
146
|
to be enabled for the project area.
|
|
147
|
-
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
147
|
+
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
148
148
|
or Baselines Only to be enabled for the project area.
|
|
149
149
|
|
|
150
150
|
|
|
@@ -203,6 +203,60 @@ at ``https://sample-rqm-host.com``
|
|
|
203
203
|
Then, open RQM with your favourite browser and you will see that the test case
|
|
204
204
|
execution records and their results are imported in the given testplan ID.
|
|
205
205
|
|
|
206
|
+
RQMTool Submodule
|
|
207
|
+
=================
|
|
208
|
+
|
|
209
|
+
The package now includes a submodule **RQMTool** which provides a standalone CLI to fetch test cases
|
|
210
|
+
and test suites from IBM RQM test plans.
|
|
211
|
+
|
|
212
|
+
RQMTool is accessible as a Python module:
|
|
213
|
+
|
|
214
|
+
::
|
|
215
|
+
|
|
216
|
+
python -m RobotLog2RQM.rqmtool --host <RQM_SERVER_URL> --project <PROJECT_AREA> \
|
|
217
|
+
--user <USERNAME> --password <PASSWORD> \
|
|
218
|
+
--testplan <TESTPLAN_ID> [--types <artifact_types>] \
|
|
219
|
+
[--format <csv|json>] [--output-dir <DIR>] \
|
|
220
|
+
[--basename <BASENAME>] [--dryrun]
|
|
221
|
+
|
|
222
|
+
Main features:
|
|
223
|
+
|
|
224
|
+
* Fetches selected artifact types (`testcase` or `testsuite`) from a given test plan.
|
|
225
|
+
* Supports CSV or JSON export, with automatic filenames including the test plan ID.
|
|
226
|
+
|
|
227
|
+
How to use RQMTool
|
|
228
|
+
------------------
|
|
229
|
+
|
|
230
|
+
RQMTool requires RQM information (host URL, project, credentials) and a test plan ID.
|
|
231
|
+
Use the `-h` argument to see full usage:
|
|
232
|
+
|
|
233
|
+
::
|
|
234
|
+
|
|
235
|
+
python -m RobotLog2RQM.rqmtool -h
|
|
236
|
+
|
|
237
|
+
This will display all available command line options for RQMTool, such as:
|
|
238
|
+
|
|
239
|
+
* `--types` : artifact types to fetch (`testcase`, `testsuite`). Default: both.
|
|
240
|
+
* `--format`: output format, either `csv` or `json`.
|
|
241
|
+
* `--output-dir`: directory to save exported files.
|
|
242
|
+
* `--basename`: base name for output files.
|
|
243
|
+
* `--dryrun`: validate inputs and RQM login without fetching data.
|
|
244
|
+
|
|
245
|
+
Example
|
|
246
|
+
-------
|
|
247
|
+
|
|
248
|
+
Fetch all test cases and test suites from test plan ID 720 and export to CSV:
|
|
249
|
+
|
|
250
|
+
::
|
|
251
|
+
|
|
252
|
+
python -m RobotLog2RQM.rqmtool --host https://sample-rqm-host.com \
|
|
253
|
+
--project ROBFW-AIO \
|
|
254
|
+
--user test_user \
|
|
255
|
+
--password test_pw \
|
|
256
|
+
--testplan 720 \
|
|
257
|
+
--types testcase,testsuite \
|
|
258
|
+
--format csv
|
|
259
|
+
|
|
206
260
|
Sourcecode Documentation
|
|
207
261
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
208
262
|
|
{robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/CRQM.py
RENAMED
|
@@ -849,6 +849,83 @@ Example:
|
|
|
849
849
|
else:
|
|
850
850
|
raise Exception(f"Could not get 'team-areas' of project '{self.projectname}'.")
|
|
851
851
|
|
|
852
|
+
def getTestsFromTestplan(self, testplan_id, artifact_types):
|
|
853
|
+
"""
|
|
854
|
+
Get all test cases and test suites associated with a given test plan.
|
|
855
|
+
|
|
856
|
+
**Arguments:**
|
|
857
|
+
|
|
858
|
+
* ``testplan_id``
|
|
859
|
+
|
|
860
|
+
/ *Condition*: required / *Type*: str /
|
|
861
|
+
|
|
862
|
+
The RQM test plan to get test artifact(s).
|
|
863
|
+
|
|
864
|
+
* ``artifact_types``
|
|
865
|
+
|
|
866
|
+
/ *Condition*: required / *Type*: list /
|
|
867
|
+
|
|
868
|
+
List of artifact types (`testcase`, `testsuite`) for fetching.
|
|
869
|
+
|
|
870
|
+
**Returns:**
|
|
871
|
+
|
|
872
|
+
* / *Type*: dict /
|
|
873
|
+
|
|
874
|
+
A dictionary containing fetched artifacts:
|
|
875
|
+
|
|
876
|
+
.. code:: python
|
|
877
|
+
|
|
878
|
+
{
|
|
879
|
+
'testcase': [{'id': ..., 'name': ..., 'url': ...}, ...],
|
|
880
|
+
'testsuite': [{'id': ..., 'name': ..., 'url': ...}, ...]
|
|
881
|
+
}
|
|
882
|
+
"""
|
|
883
|
+
ALLOW_ARTIFACT_TYPES = ['testcase', 'testsuite']
|
|
884
|
+
result = {}
|
|
885
|
+
|
|
886
|
+
if isinstance(artifact_types, str):
|
|
887
|
+
artifact_types = [artifact_types]
|
|
888
|
+
elif not isinstance(artifact_types, (list, tuple)):
|
|
889
|
+
raise TypeError(
|
|
890
|
+
f"Invalid type for 'artifact_types': expected str or list, got {type(artifact_types).__name__}."
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
for item in artifact_types:
|
|
894
|
+
artifact_type = item.lower()
|
|
895
|
+
if artifact_type not in ALLOW_ARTIFACT_TYPES:
|
|
896
|
+
raise ValueError(
|
|
897
|
+
f"Unsupported artifact type '{artifact_type}'. "
|
|
898
|
+
f"Please use one of the following: {', '.join(ALLOW_ARTIFACT_TYPES)}."
|
|
899
|
+
)
|
|
900
|
+
result[artifact_type] = []
|
|
901
|
+
|
|
902
|
+
res = self.getResourceByID('testplan', testplan_id)
|
|
903
|
+
if res.status_code != 200:
|
|
904
|
+
raise Exception(f"Failed to get testplan {testplan_id}: {res.reason}")
|
|
905
|
+
|
|
906
|
+
oTree = get_xml_tree(BytesIO(str(res.text).encode()), bdtd_validation=False)
|
|
907
|
+
root = oTree.getroot()
|
|
908
|
+
nsmap = root.nsmap
|
|
909
|
+
|
|
910
|
+
for item in artifact_types:
|
|
911
|
+
artifact_type = item.lower()
|
|
912
|
+
# Find all linked test artifact
|
|
913
|
+
for oTest in root.findall(f'.//ns2:{artifact_type}', nsmap):
|
|
914
|
+
href = oTest.attrib.get('href')
|
|
915
|
+
if href:
|
|
916
|
+
test_id = href.split('/')[-1]
|
|
917
|
+
# Get testcase name
|
|
918
|
+
test_res = self.getResourceByID(artifact_type, test_id)
|
|
919
|
+
if test_res.status_code == 200:
|
|
920
|
+
test_tree = get_xml_tree(BytesIO(str(test_res.text).encode()), bdtd_validation=False)
|
|
921
|
+
test_name = test_tree.find('ns4:title', test_tree.getroot().nsmap)
|
|
922
|
+
test_web_id = test_tree.find('ns2:webId', test_tree.getroot().nsmap)
|
|
923
|
+
test_url = test_tree.find('ns4:identifier', test_tree.getroot().nsmap)
|
|
924
|
+
result[artifact_type].append({'id': test_web_id.text,
|
|
925
|
+
'name': test_name.text if test_name is not None else '',
|
|
926
|
+
'url': test_url.text})
|
|
927
|
+
|
|
928
|
+
return result
|
|
852
929
|
|
|
853
930
|
#
|
|
854
931
|
# Methods to create XML template for resources
|
|
Binary file
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Copyright 2020-2023 Robert Bosch GmbH
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ******************************************************************************
|
|
15
|
+
#
|
|
16
|
+
# File: logging.py
|
|
17
|
+
#
|
|
18
|
+
# Initially created by Tran Duy Ngoan(RBVH/EMC51) / October 2025
|
|
19
|
+
#
|
|
20
|
+
# Logging class
|
|
21
|
+
#
|
|
22
|
+
# History:
|
|
23
|
+
#
|
|
24
|
+
# 2025-10-20:
|
|
25
|
+
# - initial version
|
|
26
|
+
#
|
|
27
|
+
# ******************************************************************************
|
|
28
|
+
import sys
|
|
29
|
+
import colorama as col
|
|
30
|
+
import os
|
|
31
|
+
|
|
32
|
+
class Logger():
|
|
33
|
+
"""
|
|
34
|
+
Logger class for logging message.
|
|
35
|
+
"""
|
|
36
|
+
output_logfile = None
|
|
37
|
+
output_console = True
|
|
38
|
+
color_normal = col.Fore.WHITE + col.Style.NORMAL
|
|
39
|
+
color_error = col.Fore.RED + col.Style.BRIGHT
|
|
40
|
+
color_warn = col.Fore.YELLOW + col.Style.BRIGHT
|
|
41
|
+
color_reset = col.Style.RESET_ALL + col.Fore.RESET + col.Back.RESET
|
|
42
|
+
prefix_warn = "WARN: "
|
|
43
|
+
prefix_error = "ERROR: "
|
|
44
|
+
prefix_fatalerror = "FATAL ERROR: "
|
|
45
|
+
prefix_all = ""
|
|
46
|
+
dryrun = False
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def config(cls, output_console=True, output_logfile=None, dryrun=False):
|
|
50
|
+
"""
|
|
51
|
+
Configure Logger class.
|
|
52
|
+
|
|
53
|
+
**Arguments:**
|
|
54
|
+
|
|
55
|
+
* ``output_console``
|
|
56
|
+
|
|
57
|
+
/ *Condition*: optional / *Type*: bool / *Default*: True /
|
|
58
|
+
|
|
59
|
+
Write message to console output.
|
|
60
|
+
|
|
61
|
+
* ``output_logfile``
|
|
62
|
+
|
|
63
|
+
/ *Condition*: optional / *Type*: str / *Default*: None /
|
|
64
|
+
|
|
65
|
+
Path to log file output.
|
|
66
|
+
|
|
67
|
+
* ``dryrun``
|
|
68
|
+
|
|
69
|
+
/ *Condition*: optional / *Type*: bool / *Default*: True /
|
|
70
|
+
|
|
71
|
+
If set, a prefix as 'dryrun' is added for all messages.
|
|
72
|
+
|
|
73
|
+
**Returns:**
|
|
74
|
+
|
|
75
|
+
(*no returns*)
|
|
76
|
+
"""
|
|
77
|
+
cls.output_console = output_console
|
|
78
|
+
cls.output_logfile = output_logfile
|
|
79
|
+
cls.dryrun = dryrun
|
|
80
|
+
if cls.dryrun:
|
|
81
|
+
cls.prefix_all = cls.color_warn + "DRYRUN " + cls.color_reset
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def log(cls, msg='', color=None, indent=0):
|
|
85
|
+
"""
|
|
86
|
+
Write log message to console/file output.
|
|
87
|
+
|
|
88
|
+
**Arguments:**
|
|
89
|
+
|
|
90
|
+
* ``msg``
|
|
91
|
+
|
|
92
|
+
/ *Condition*: optional / *Type*: str / *Default*: '' /
|
|
93
|
+
|
|
94
|
+
Message which is written to output.
|
|
95
|
+
|
|
96
|
+
* ``color``
|
|
97
|
+
|
|
98
|
+
/ *Condition*: optional / *Type*: str / *Default*: None /
|
|
99
|
+
|
|
100
|
+
Color style for the message.
|
|
101
|
+
|
|
102
|
+
* ``indent``
|
|
103
|
+
|
|
104
|
+
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
105
|
+
|
|
106
|
+
Offset indent.
|
|
107
|
+
|
|
108
|
+
**Returns:**
|
|
109
|
+
|
|
110
|
+
(*no returns*)
|
|
111
|
+
"""
|
|
112
|
+
if color is None:
|
|
113
|
+
color = cls.color_normal
|
|
114
|
+
if cls.output_console:
|
|
115
|
+
print(cls.prefix_all + cls.color_reset + color + " "*indent + msg + cls.color_reset)
|
|
116
|
+
if cls.output_logfile is not None and os.path.isfile(cls.output_logfile):
|
|
117
|
+
with open(cls.output_logfile, 'a') as f:
|
|
118
|
+
f.write(" "*indent + msg)
|
|
119
|
+
return
|
|
120
|
+
|
|
121
|
+
@classmethod
|
|
122
|
+
def log_warning(cls, msg, indent=0):
|
|
123
|
+
"""
|
|
124
|
+
Write warning message to console/file output.
|
|
125
|
+
|
|
126
|
+
**Arguments:**
|
|
127
|
+
|
|
128
|
+
* ``msg``
|
|
129
|
+
|
|
130
|
+
/ *Condition*: required / *Type*: str /
|
|
131
|
+
|
|
132
|
+
Warning message which is written to output.
|
|
133
|
+
|
|
134
|
+
* ``indent``
|
|
135
|
+
|
|
136
|
+
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
137
|
+
|
|
138
|
+
Offset indent.
|
|
139
|
+
|
|
140
|
+
**Returns:**
|
|
141
|
+
|
|
142
|
+
(*no returns*)
|
|
143
|
+
"""
|
|
144
|
+
cls.log(cls.prefix_warn+str(msg), cls.color_warn, indent)
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def log_error(cls, msg, fatal_error=False, indent=0):
|
|
148
|
+
"""
|
|
149
|
+
Write error message to console/file output.
|
|
150
|
+
|
|
151
|
+
* ``msg``
|
|
152
|
+
|
|
153
|
+
/ *Condition*: required / *Type*: str /
|
|
154
|
+
|
|
155
|
+
Error message which is written to output.
|
|
156
|
+
|
|
157
|
+
* ``fatal_error``
|
|
158
|
+
|
|
159
|
+
/ *Condition*: optional / *Type*: bool / *Default*: False /
|
|
160
|
+
|
|
161
|
+
If set, tool will terminate after logging error message.
|
|
162
|
+
|
|
163
|
+
* ``indent``
|
|
164
|
+
|
|
165
|
+
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
166
|
+
|
|
167
|
+
Offset indent.
|
|
168
|
+
|
|
169
|
+
**Returns:**
|
|
170
|
+
|
|
171
|
+
(*no returns*)
|
|
172
|
+
"""
|
|
173
|
+
prefix = cls.prefix_error
|
|
174
|
+
if fatal_error:
|
|
175
|
+
prefix = cls.prefix_fatalerror
|
|
176
|
+
|
|
177
|
+
cls.log(prefix+str(msg), cls.color_error, indent)
|
|
178
|
+
if fatal_error:
|
|
179
|
+
cls.log(f"{sys.argv[0]} has been stopped!", cls.color_error)
|
|
180
|
+
exit(1)
|
{robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/robotlog2rqm.py
RENAMED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#
|
|
16
16
|
# File: robotlog2rqm.py
|
|
17
17
|
#
|
|
18
|
-
#
|
|
18
|
+
# Initially created by Tran Duy Ngoan(RBVH/ECM11) / January 2021
|
|
19
19
|
#
|
|
20
20
|
# This tool is used to parse the robot framework results output.xml
|
|
21
21
|
# then import them into RQM - IBM Rational Quality Manager
|
|
@@ -31,13 +31,12 @@ import json
|
|
|
31
31
|
import re
|
|
32
32
|
import argparse
|
|
33
33
|
import os
|
|
34
|
-
import sys
|
|
35
34
|
import datetime
|
|
36
|
-
import colorama as col
|
|
37
35
|
|
|
38
36
|
from robot.api import ExecutionResult
|
|
39
37
|
from RobotLog2RQM.CRQM import CRQMClient
|
|
40
38
|
from RobotLog2RQM.version import VERSION, VERSION_DATE
|
|
39
|
+
from RobotLog2RQM.logger import Logger
|
|
41
40
|
|
|
42
41
|
DRESULT_MAPPING = {
|
|
43
42
|
"PASS": "Passed",
|
|
@@ -74,160 +73,6 @@ NAMING_CONVENTION_SCHEMA = {
|
|
|
74
73
|
"suiteresult" : str
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
#
|
|
78
|
-
# Logger class
|
|
79
|
-
#
|
|
80
|
-
########################################################################
|
|
81
|
-
class Logger():
|
|
82
|
-
"""
|
|
83
|
-
Logger class for logging message.
|
|
84
|
-
"""
|
|
85
|
-
output_logfile = None
|
|
86
|
-
output_console = True
|
|
87
|
-
color_normal = col.Fore.WHITE + col.Style.NORMAL
|
|
88
|
-
color_error = col.Fore.RED + col.Style.BRIGHT
|
|
89
|
-
color_warn = col.Fore.YELLOW + col.Style.BRIGHT
|
|
90
|
-
color_reset = col.Style.RESET_ALL + col.Fore.RESET + col.Back.RESET
|
|
91
|
-
prefix_warn = "WARN: "
|
|
92
|
-
prefix_error = "ERROR: "
|
|
93
|
-
prefix_fatalerror = "FATAL ERROR: "
|
|
94
|
-
prefix_all = ""
|
|
95
|
-
dryrun = False
|
|
96
|
-
|
|
97
|
-
@classmethod
|
|
98
|
-
def config(cls, output_console=True, output_logfile=None, dryrun=False):
|
|
99
|
-
"""
|
|
100
|
-
Configure Logger class.
|
|
101
|
-
|
|
102
|
-
**Arguments:**
|
|
103
|
-
|
|
104
|
-
* ``output_console``
|
|
105
|
-
|
|
106
|
-
/ *Condition*: optional / *Type*: bool / *Default*: True /
|
|
107
|
-
|
|
108
|
-
Write message to console output.
|
|
109
|
-
|
|
110
|
-
* ``output_logfile``
|
|
111
|
-
|
|
112
|
-
/ *Condition*: optional / *Type*: str / *Default*: None /
|
|
113
|
-
|
|
114
|
-
Path to log file output.
|
|
115
|
-
|
|
116
|
-
* ``dryrun``
|
|
117
|
-
|
|
118
|
-
/ *Condition*: optional / *Type*: bool / *Default*: True /
|
|
119
|
-
|
|
120
|
-
If set, a prefix as 'dryrun' is added for all messages.
|
|
121
|
-
|
|
122
|
-
**Returns:**
|
|
123
|
-
|
|
124
|
-
(*no returns*)
|
|
125
|
-
"""
|
|
126
|
-
cls.output_console = output_console
|
|
127
|
-
cls.output_logfile = output_logfile
|
|
128
|
-
cls.dryrun = dryrun
|
|
129
|
-
if cls.dryrun:
|
|
130
|
-
cls.prefix_all = cls.color_warn + "DRYRUN " + cls.color_reset
|
|
131
|
-
|
|
132
|
-
@classmethod
|
|
133
|
-
def log(cls, msg='', color=None, indent=0):
|
|
134
|
-
"""
|
|
135
|
-
Write log message to console/file output.
|
|
136
|
-
|
|
137
|
-
**Arguments:**
|
|
138
|
-
|
|
139
|
-
* ``msg``
|
|
140
|
-
|
|
141
|
-
/ *Condition*: optional / *Type*: str / *Default*: '' /
|
|
142
|
-
|
|
143
|
-
Message which is written to output.
|
|
144
|
-
|
|
145
|
-
* ``color``
|
|
146
|
-
|
|
147
|
-
/ *Condition*: optional / *Type*: str / *Default*: None /
|
|
148
|
-
|
|
149
|
-
Color style for the message.
|
|
150
|
-
|
|
151
|
-
* ``indent``
|
|
152
|
-
|
|
153
|
-
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
154
|
-
|
|
155
|
-
Offset indent.
|
|
156
|
-
|
|
157
|
-
**Returns:**
|
|
158
|
-
|
|
159
|
-
(*no returns*)
|
|
160
|
-
"""
|
|
161
|
-
if color==None:
|
|
162
|
-
color = cls.color_normal
|
|
163
|
-
if cls.output_console:
|
|
164
|
-
print(cls.prefix_all + cls.color_reset + color + " "*indent + msg + cls.color_reset)
|
|
165
|
-
if cls.output_logfile!=None and os.path.isfile(cls.output_logfile):
|
|
166
|
-
with open(cls.output_logfile, 'a') as f:
|
|
167
|
-
f.write(" "*indent + msg)
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
@classmethod
|
|
171
|
-
def log_warning(cls, msg, indent=0):
|
|
172
|
-
"""
|
|
173
|
-
Write warning message to console/file output.
|
|
174
|
-
|
|
175
|
-
**Arguments:**
|
|
176
|
-
|
|
177
|
-
* ``msg``
|
|
178
|
-
|
|
179
|
-
/ *Condition*: required / *Type*: str /
|
|
180
|
-
|
|
181
|
-
Warning message which is written to output.
|
|
182
|
-
|
|
183
|
-
* ``indent``
|
|
184
|
-
|
|
185
|
-
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
186
|
-
|
|
187
|
-
Offset indent.
|
|
188
|
-
|
|
189
|
-
**Returns:**
|
|
190
|
-
|
|
191
|
-
(*no returns*)
|
|
192
|
-
"""
|
|
193
|
-
cls.log(cls.prefix_warn+str(msg), cls.color_warn, indent)
|
|
194
|
-
|
|
195
|
-
@classmethod
|
|
196
|
-
def log_error(cls, msg, fatal_error=False, indent=0):
|
|
197
|
-
"""
|
|
198
|
-
Write error message to console/file output.
|
|
199
|
-
|
|
200
|
-
* ``msg``
|
|
201
|
-
|
|
202
|
-
/ *Condition*: required / *Type*: str /
|
|
203
|
-
|
|
204
|
-
Error message which is written to output.
|
|
205
|
-
|
|
206
|
-
* ``fatal_error``
|
|
207
|
-
|
|
208
|
-
/ *Condition*: optional / *Type*: bool / *Default*: False /
|
|
209
|
-
|
|
210
|
-
If set, tool will terminate after logging error message.
|
|
211
|
-
|
|
212
|
-
* ``indent``
|
|
213
|
-
|
|
214
|
-
/ *Condition*: optional / *Type*: int / *Default*: 0 /
|
|
215
|
-
|
|
216
|
-
Offset indent.
|
|
217
|
-
|
|
218
|
-
**Returns:**
|
|
219
|
-
|
|
220
|
-
(*no returns*)
|
|
221
|
-
"""
|
|
222
|
-
prefix = cls.prefix_error
|
|
223
|
-
if fatal_error:
|
|
224
|
-
prefix = cls.prefix_fatalerror
|
|
225
|
-
|
|
226
|
-
cls.log(prefix+str(msg), cls.color_error, indent)
|
|
227
|
-
if fatal_error:
|
|
228
|
-
cls.log(f"{sys.argv[0]} has been stopped!", cls.color_error)
|
|
229
|
-
exit(1)
|
|
230
|
-
|
|
231
76
|
|
|
232
77
|
def get_from_tags(lTags, reInfo):
|
|
233
78
|
"""
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Copyright 2020-2023 Robert Bosch GmbH
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ******************************************************************************
|
|
15
|
+
#
|
|
16
|
+
# File: rqmtool.py
|
|
17
|
+
#
|
|
18
|
+
# Initially created by Tran Duy Ngoan(RBVH/EMC51) / October 2025
|
|
19
|
+
#
|
|
20
|
+
# This tool is used to fetch RQM resources
|
|
21
|
+
#
|
|
22
|
+
# History:
|
|
23
|
+
#
|
|
24
|
+
# 2025-10-20:
|
|
25
|
+
# - initial version
|
|
26
|
+
#
|
|
27
|
+
# ******************************************************************************
|
|
28
|
+
|
|
29
|
+
import argparse
|
|
30
|
+
import os
|
|
31
|
+
import csv
|
|
32
|
+
import json
|
|
33
|
+
|
|
34
|
+
from RobotLog2RQM.CRQM import CRQMClient
|
|
35
|
+
from RobotLog2RQM.logger import Logger
|
|
36
|
+
from RobotLog2RQM.version import VERSION, VERSION_DATE
|
|
37
|
+
|
|
38
|
+
OUTPUT_FORMATS = ['json', 'csv']
|
|
39
|
+
ARTIFACT_TYPES = ['testcase', 'testsuite']
|
|
40
|
+
|
|
41
|
+
def __process_commandline():
|
|
42
|
+
"""
|
|
43
|
+
Process provided argument(s) from command line.
|
|
44
|
+
|
|
45
|
+
**Arguments:**
|
|
46
|
+
|
|
47
|
+
(*no arguments*)
|
|
48
|
+
|
|
49
|
+
**Returns:**
|
|
50
|
+
|
|
51
|
+
/ *Type*: `ArgumentParser` object /
|
|
52
|
+
|
|
53
|
+
ArgumentParser object.
|
|
54
|
+
"""
|
|
55
|
+
parser = argparse.ArgumentParser(
|
|
56
|
+
prog="RQMTool",
|
|
57
|
+
description="Fetch RQM resources."
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
'-v', '--version',
|
|
62
|
+
action='version',
|
|
63
|
+
version=f'v{VERSION} ({VERSION_DATE})',
|
|
64
|
+
help='Version of the RQMTool.'
|
|
65
|
+
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"--host",
|
|
68
|
+
required=True,
|
|
69
|
+
help="RQM server URL."
|
|
70
|
+
)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--project",
|
|
73
|
+
required=True,
|
|
74
|
+
help="RQM project."
|
|
75
|
+
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"--user",
|
|
78
|
+
required=True,
|
|
79
|
+
help="RQM username."
|
|
80
|
+
)
|
|
81
|
+
parser.add_argument(
|
|
82
|
+
"--password",
|
|
83
|
+
required=True,
|
|
84
|
+
help="RQM password."
|
|
85
|
+
)
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
"--testplan",
|
|
88
|
+
required=True,
|
|
89
|
+
help="RQM testplan ID."
|
|
90
|
+
)
|
|
91
|
+
parser.add_argument(
|
|
92
|
+
"--dryrun",
|
|
93
|
+
action="store_true",
|
|
94
|
+
help='if set, then verify all input arguments (includes RQM authentication) and show what would be done.')
|
|
95
|
+
parser.add_argument(
|
|
96
|
+
"--format",
|
|
97
|
+
default="csv",
|
|
98
|
+
choices=OUTPUT_FORMATS,
|
|
99
|
+
help="Output format (csv or json). Default is csv.")
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
"--types",
|
|
102
|
+
default="testcase,testsuite",
|
|
103
|
+
help="Comma-separated list of artifact types to fetch. Allowed: testcase, testsuite.")
|
|
104
|
+
parser.add_argument(
|
|
105
|
+
"--output-dir",
|
|
106
|
+
default=".",
|
|
107
|
+
help="Directory to save output files.")
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
"--basename",
|
|
110
|
+
default="testplan_export",
|
|
111
|
+
help="Base name for output files.")
|
|
112
|
+
return parser.parse_args()
|
|
113
|
+
|
|
114
|
+
def __validate_arguments(arguments):
|
|
115
|
+
"""
|
|
116
|
+
Validate and normalize command line arguments.
|
|
117
|
+
|
|
118
|
+
**Arguments:**
|
|
119
|
+
|
|
120
|
+
* ``arguments``
|
|
121
|
+
|
|
122
|
+
/ *Condition*: required / *Type*: `ArgumentParser` object /
|
|
123
|
+
|
|
124
|
+
Parsed arguments from __process_commandline().
|
|
125
|
+
|
|
126
|
+
**Returns:**
|
|
127
|
+
|
|
128
|
+
* ``arguments``
|
|
129
|
+
|
|
130
|
+
/ *Type*: `ArgumentParser` object /
|
|
131
|
+
|
|
132
|
+
ArgumentParser object.
|
|
133
|
+
"""
|
|
134
|
+
artifact_types = arguments.types
|
|
135
|
+
if isinstance(artifact_types, str):
|
|
136
|
+
artifact_types = [x.strip().lower() for x in artifact_types.split(',')]
|
|
137
|
+
elif isinstance(artifact_types, (list, tuple)):
|
|
138
|
+
artifact_types = [x.lower() for x in artifact_types]
|
|
139
|
+
else:
|
|
140
|
+
raise TypeError(f"Invalid type for '--types': {type(artifact_types).__name__}, expected str or list.")
|
|
141
|
+
|
|
142
|
+
for t in artifact_types:
|
|
143
|
+
if t not in ARTIFACT_TYPES:
|
|
144
|
+
raise ValueError(
|
|
145
|
+
f"Invalid artifact type '{t}'. Allowed: {', '.join(ARTIFACT_TYPES)}."
|
|
146
|
+
)
|
|
147
|
+
arguments.types = artifact_types
|
|
148
|
+
|
|
149
|
+
return arguments
|
|
150
|
+
|
|
151
|
+
def write_json_file(file_name, data):
|
|
152
|
+
"""
|
|
153
|
+
Write data to a JSON file.
|
|
154
|
+
|
|
155
|
+
**Arguments:**
|
|
156
|
+
|
|
157
|
+
* ``file_name``
|
|
158
|
+
|
|
159
|
+
/ *Condition*: required / *Type*: str /
|
|
160
|
+
|
|
161
|
+
Path of the JSON file to write.
|
|
162
|
+
|
|
163
|
+
* ``data``
|
|
164
|
+
|
|
165
|
+
/ *Condition*: required / *Type*: dict /
|
|
166
|
+
|
|
167
|
+
Data to export.
|
|
168
|
+
|
|
169
|
+
**Returns:**
|
|
170
|
+
|
|
171
|
+
(*no returns*)
|
|
172
|
+
"""
|
|
173
|
+
with open(file_name, 'w', encoding='utf-8') as f:
|
|
174
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
|
175
|
+
Logger.log(f"Exported data to: {file_name}")
|
|
176
|
+
|
|
177
|
+
def write_csv_file(file_name, data, artifact_type):
|
|
178
|
+
"""
|
|
179
|
+
Write data to a CSV file for a specific artifact type.
|
|
180
|
+
|
|
181
|
+
**Arguments:**
|
|
182
|
+
|
|
183
|
+
* ``file_name``
|
|
184
|
+
|
|
185
|
+
/ *Condition*: required / *Type*: str /
|
|
186
|
+
|
|
187
|
+
Path of the CSV file to write.
|
|
188
|
+
|
|
189
|
+
* ``data``
|
|
190
|
+
|
|
191
|
+
/ *Condition*: required / *Type*: dict /
|
|
192
|
+
|
|
193
|
+
Data dictionary containing artifacts.
|
|
194
|
+
|
|
195
|
+
* ``artifact_type``
|
|
196
|
+
|
|
197
|
+
/ *Condition*: required / *Type*: str /
|
|
198
|
+
|
|
199
|
+
Artifact type (`testcase` or `testsuite`) to export.
|
|
200
|
+
|
|
201
|
+
**Returns:**
|
|
202
|
+
|
|
203
|
+
(*no returns*)
|
|
204
|
+
"""
|
|
205
|
+
artifact_data = data.get(artifact_type, [])
|
|
206
|
+
if not artifact_data:
|
|
207
|
+
Logger.log_warning(f"No data for '{artifact_type}', skipping CSV export.")
|
|
208
|
+
return
|
|
209
|
+
|
|
210
|
+
fieldnames = list(data[artifact_type][0].keys()) if data[artifact_type] else ["id", "name"]
|
|
211
|
+
with open(file_name, mode="w", newline='', encoding="utf-8") as f:
|
|
212
|
+
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
|
213
|
+
writer.writeheader()
|
|
214
|
+
for row in data[artifact_type]:
|
|
215
|
+
writer.writerow(row)
|
|
216
|
+
Logger.log(f"Exported {artifact_type} to: {file_name}")
|
|
217
|
+
|
|
218
|
+
def write_output_file(data, output_dir=".", basename="testplan_export", extension="csv", artifact_types=None):
|
|
219
|
+
"""
|
|
220
|
+
Write data to output files (JSON or CSV) according to specified options.
|
|
221
|
+
|
|
222
|
+
**Arguments:**
|
|
223
|
+
|
|
224
|
+
* ``data``
|
|
225
|
+
|
|
226
|
+
/ *Condition*: required / *Type*: dict /
|
|
227
|
+
|
|
228
|
+
Data dictionary containing artifacts.
|
|
229
|
+
|
|
230
|
+
* ``output_dir``
|
|
231
|
+
|
|
232
|
+
/ *Condition*: optional / *Type*: str /
|
|
233
|
+
|
|
234
|
+
Directory to save output files. Default is current directory.
|
|
235
|
+
|
|
236
|
+
* ``basename``
|
|
237
|
+
|
|
238
|
+
/ *Condition*: optional / *Type*: str /
|
|
239
|
+
|
|
240
|
+
Base name for output files. Default is "testplan_export".
|
|
241
|
+
|
|
242
|
+
* ``extension``
|
|
243
|
+
|
|
244
|
+
/ *Condition*: optional / *Type*: str /
|
|
245
|
+
|
|
246
|
+
Output format: `json` or `csv`. Default is `csv`.
|
|
247
|
+
|
|
248
|
+
* ``artifact_types``
|
|
249
|
+
|
|
250
|
+
/ *Condition*: optional / *Type*: list /
|
|
251
|
+
|
|
252
|
+
Artifact types to export. Default is all supported types.
|
|
253
|
+
|
|
254
|
+
**Returns:**
|
|
255
|
+
|
|
256
|
+
(*no returns*)
|
|
257
|
+
"""
|
|
258
|
+
if extension == 'json':
|
|
259
|
+
file_name = os.path.join(output_dir, f"{basename}.json")
|
|
260
|
+
write_json_file(file_name, data)
|
|
261
|
+
else:
|
|
262
|
+
# CSV export: one file per artifact_type
|
|
263
|
+
for artifact_type in (artifact_types or ARTIFACT_TYPES):
|
|
264
|
+
file_name = os.path.join(output_dir, f"{basename}_{artifact_type}s.csv")
|
|
265
|
+
write_csv_file(file_name, data, artifact_type)
|
|
266
|
+
|
|
267
|
+
def RQMTool():
|
|
268
|
+
"""
|
|
269
|
+
Main entry point for RQMTool CLI.
|
|
270
|
+
|
|
271
|
+
**Arguments:**
|
|
272
|
+
|
|
273
|
+
(*no arguments*)
|
|
274
|
+
|
|
275
|
+
**Returns:**
|
|
276
|
+
|
|
277
|
+
(*no returns*)
|
|
278
|
+
"""
|
|
279
|
+
args = __process_commandline()
|
|
280
|
+
__validate_arguments(args)
|
|
281
|
+
Logger.config(dryrun=args.dryrun)
|
|
282
|
+
|
|
283
|
+
RQMClient = CRQMClient(args.user, args.password, args.project, args.host)
|
|
284
|
+
try:
|
|
285
|
+
bSuccess = RQMClient.login()
|
|
286
|
+
if bSuccess:
|
|
287
|
+
Logger.log()
|
|
288
|
+
Logger.log(f"Login RQM as user '{args.user}' successfully!")
|
|
289
|
+
else:
|
|
290
|
+
Logger.log_error("Could not login to RQM: 'Unknown reason'.")
|
|
291
|
+
except Exception as reason:
|
|
292
|
+
Logger.log_error(f"Could not login to RQM: '{str(reason)}'.")
|
|
293
|
+
|
|
294
|
+
if not args.dryrun:
|
|
295
|
+
testplan_data = RQMClient.getTestsFromTestplan(args.testplan, args.types)
|
|
296
|
+
|
|
297
|
+
basename_with_id = f"{args.basename}_{args.testplan}"
|
|
298
|
+
|
|
299
|
+
write_output_file(
|
|
300
|
+
testplan_data,
|
|
301
|
+
output_dir=args.output_dir,
|
|
302
|
+
basename=basename_with_id,
|
|
303
|
+
extension=args.format,
|
|
304
|
+
artifact_types=args.types
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
for artifact_type in args.types:
|
|
308
|
+
items = testplan_data.get(artifact_type, [])
|
|
309
|
+
Logger.log(f"Found {len(items)} {artifact_type}(s)")
|
|
310
|
+
cnt = 1
|
|
311
|
+
for item in items:
|
|
312
|
+
Logger.log(f"{cnt:>3}. {item['id']} - {item['name']}", indent=2)
|
|
313
|
+
cnt += 1
|
|
314
|
+
|
|
315
|
+
if __name__ == "__main__":
|
|
316
|
+
RQMTool()
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-robotlog2rqm
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Imports robot result(s) to IBM Rational Quality Manager (RQM)
|
|
5
5
|
Home-page: https://github.com/test-fullautomation/robotframework-robotlog2rqm
|
|
6
6
|
Author: Tran Duy Ngoan
|
|
7
7
|
Author-email: Ngoan.TranDuy@vn.bosch.com
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Classifier: Programming Language :: Python :: 3
|
|
11
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
10
|
Classifier: Operating System :: OS Independent
|
|
@@ -16,6 +14,20 @@ Classifier: Topic :: Software Development
|
|
|
16
14
|
Requires-Python: >=3.0
|
|
17
15
|
Description-Content-Type: text/markdown
|
|
18
16
|
License-File: LICENSE
|
|
17
|
+
Requires-Dist: lxml
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: colorama
|
|
20
|
+
Requires-Dist: robotframework
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: description
|
|
25
|
+
Dynamic: description-content-type
|
|
26
|
+
Dynamic: home-page
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
Dynamic: requires-dist
|
|
29
|
+
Dynamic: requires-python
|
|
30
|
+
Dynamic: summary
|
|
19
31
|
|
|
20
32
|
# RobotLog2RQM Description
|
|
21
33
|
|
|
@@ -125,15 +137,15 @@ Use below command to get tools\'s usage:
|
|
|
125
137
|
|
|
126
138
|
The usage should be showed as below:
|
|
127
139
|
|
|
128
|
-
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
129
|
-
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
140
|
+
usage: RobotLog2RQM (RobotXMLResult to RQM importer) [-h] [-v] [--testsuite TESTSUITE] [--recursive]
|
|
141
|
+
[--createmissing] [--updatetestcase] [--dryrun] [--stream STREAM] [--baseline BASELINE]
|
|
130
142
|
resultxmlfile host project user password testplan
|
|
131
143
|
|
|
132
|
-
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
144
|
+
RobotLog2RQM imports XML result files (default: output.xml) generated by the
|
|
133
145
|
Robot Framework into an IBM Rational Quality Manager.
|
|
134
146
|
|
|
135
147
|
positional arguments:
|
|
136
|
-
resultxmlfile absolute or relative path to the xml result file
|
|
148
|
+
resultxmlfile absolute or relative path to the xml result file
|
|
137
149
|
or directory of result files to be imported.
|
|
138
150
|
host RQM host url.
|
|
139
151
|
project project on RQM.
|
|
@@ -145,19 +157,19 @@ The usage should be showed as below:
|
|
|
145
157
|
-h, --help show this help message and exit
|
|
146
158
|
-v, --version Version of the RobotLog2RQM importer.
|
|
147
159
|
--testsuite TESTSUITE
|
|
148
|
-
testsuite ID for this execution. If 'new', then create a new
|
|
160
|
+
testsuite ID for this execution. If 'new', then create a new
|
|
149
161
|
testsuite for this execution.
|
|
150
|
-
--recursive if set, then the path is searched recursively for
|
|
162
|
+
--recursive if set, then the path is searched recursively for
|
|
151
163
|
log files to be imported.
|
|
152
|
-
--createmissing if set, then all testcases without tcid are created
|
|
164
|
+
--createmissing if set, then all testcases without tcid are created
|
|
153
165
|
when importing.
|
|
154
|
-
--updatetestcase if set, then testcase information on RQM will be updated
|
|
166
|
+
--updatetestcase if set, then testcase information on RQM will be updated
|
|
155
167
|
bases on robot testfile.
|
|
156
|
-
--dryrun if set, then verify all input arguments
|
|
168
|
+
--dryrun if set, then verify all input arguments
|
|
157
169
|
(includes RQM authentication) and show what would be done.
|
|
158
|
-
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
170
|
+
--stream STREAM project stream. Note, requires Configuration Management (CM)
|
|
159
171
|
to be enabled for the project area.
|
|
160
|
-
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
172
|
+
--baseline BASELINE project baseline. Note, requires Configuration Management (CM),
|
|
161
173
|
or Baselines Only to be enabled for the project area.
|
|
162
174
|
|
|
163
175
|
The below command is simple usage witth all required arguments to import
|
|
@@ -209,6 +221,58 @@ Then, open RQM with your favourite browser and you will see that the
|
|
|
209
221
|
test case execution records and their results are imported in the given
|
|
210
222
|
testplan ID.
|
|
211
223
|
|
|
224
|
+
# RQMTool Submodule
|
|
225
|
+
|
|
226
|
+
The package now includes a submodule **RQMTool** which provides a
|
|
227
|
+
standalone CLI to fetch test cases and test suites from IBM RQM test
|
|
228
|
+
plans.
|
|
229
|
+
|
|
230
|
+
RQMTool is accessible as a Python module:
|
|
231
|
+
|
|
232
|
+
python -m RobotLog2RQM.rqmtool --host <RQM_SERVER_URL> --project <PROJECT_AREA> \
|
|
233
|
+
--user <USERNAME> --password <PASSWORD> \
|
|
234
|
+
--testplan <TESTPLAN_ID> [--types <artifact_types>] \
|
|
235
|
+
[--format <csv|json>] [--output-dir <DIR>] \
|
|
236
|
+
[--basename <BASENAME>] [--dryrun]
|
|
237
|
+
|
|
238
|
+
Main features:
|
|
239
|
+
|
|
240
|
+
- Fetches selected artifact types ([testcase]{.title-ref} or
|
|
241
|
+
[testsuite]{.title-ref}) from a given test plan.
|
|
242
|
+
- Supports CSV or JSON export, with automatic filenames including the
|
|
243
|
+
test plan ID.
|
|
244
|
+
|
|
245
|
+
## How to use RQMTool
|
|
246
|
+
|
|
247
|
+
RQMTool requires RQM information (host URL, project, credentials) and a
|
|
248
|
+
test plan ID. Use the [-h]{.title-ref} argument to see full usage:
|
|
249
|
+
|
|
250
|
+
python -m RobotLog2RQM.rqmtool -h
|
|
251
|
+
|
|
252
|
+
This will display all available command line options for RQMTool, such
|
|
253
|
+
as:
|
|
254
|
+
|
|
255
|
+
- [\--types]{.title-ref} : artifact types to fetch
|
|
256
|
+
([testcase]{.title-ref}, [testsuite]{.title-ref}). Default: both.
|
|
257
|
+
- \`\--format\`: output format, either [csv]{.title-ref} or
|
|
258
|
+
[json]{.title-ref}.
|
|
259
|
+
- \`\--output-dir\`: directory to save exported files.
|
|
260
|
+
- \`\--basename\`: base name for output files.
|
|
261
|
+
- \`\--dryrun\`: validate inputs and RQM login without fetching data.
|
|
262
|
+
|
|
263
|
+
## Example
|
|
264
|
+
|
|
265
|
+
Fetch all test cases and test suites from test plan ID 720 and export to
|
|
266
|
+
CSV:
|
|
267
|
+
|
|
268
|
+
python -m RobotLog2RQM.rqmtool --host https://sample-rqm-host.com \
|
|
269
|
+
--project ROBFW-AIO \
|
|
270
|
+
--user test_user \
|
|
271
|
+
--password test_pw \
|
|
272
|
+
--testplan 720 \
|
|
273
|
+
--types testcase,testsuite \
|
|
274
|
+
--format csv
|
|
275
|
+
|
|
212
276
|
### Sourcecode Documentation
|
|
213
277
|
|
|
214
278
|
To understand more detail about the tool\'s features and how Robot test
|
|
@@ -256,5 +320,3 @@ distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
|
256
320
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
257
321
|
See the License for the specific language governing permissions and
|
|
258
322
|
limitations under the License.
|
|
259
|
-
|
|
260
|
-
|
|
@@ -5,7 +5,9 @@ RobotLog2RQM/CRQM.py
|
|
|
5
5
|
RobotLog2RQM/RobotLog2RQM.pdf
|
|
6
6
|
RobotLog2RQM/__init__.py
|
|
7
7
|
RobotLog2RQM/__main__.py
|
|
8
|
+
RobotLog2RQM/logger.py
|
|
8
9
|
RobotLog2RQM/robotlog2rqm.py
|
|
10
|
+
RobotLog2RQM/rqmtool.py
|
|
9
11
|
RobotLog2RQM/version.py
|
|
10
12
|
RobotLog2RQM/RQM_templates/buildrecord.xml
|
|
11
13
|
RobotLog2RQM/RQM_templates/configuration.xml
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/__init__.py
RENAMED
|
File without changes
|
{robotframework-robotlog2rqm-1.4.2 → robotframework_robotlog2rqm-1.5.0}/RobotLog2RQM/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|