PyTestLog2DB 0.3.1__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
Binary file
PyTestLog2DB/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2023 Robert Bosch GmbH
1
+ # Copyright 2020-2026 Robert Bosch GmbH
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
PyTestLog2DB/__main__.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2023 Robert Bosch GmbH
1
+ # Copyright 2020-2026 Robert Bosch GmbH
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2023 Robert Bosch GmbH
1
+ # Copyright 2020-2026 Robert Bosch GmbH
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -37,13 +37,13 @@ import colorama as col
37
37
  import json
38
38
  from lxml import etree
39
39
  from datetime import datetime, timedelta
40
+ from dateutil import parser
40
41
  import platform
41
42
  from pkg_resources import get_distribution
42
43
 
43
44
  from TestResultDBAccess import DBAccessFactory
44
45
  from PyTestLog2DB.version import VERSION, VERSION_DATE
45
46
 
46
- PYTEST_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
47
47
  DB_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
48
48
 
49
49
  def __current_user():
@@ -305,6 +305,7 @@ Avalable arguments in command line:
305
305
  - `--versions` : metadata: Versions (Software;Hardware;Test) to be set for this import.
306
306
  - `--config` : configuration json file for component mapping information.
307
307
  - `--interface` : database access interface.
308
+ - `--testrunurl`: link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
308
309
 
309
310
  **Arguments:**
310
311
 
@@ -337,6 +338,7 @@ Avalable arguments in command line:
337
338
  cmdlineparser.add_argument('--versions', type=str, help='metadata: Versions (Software;Hardware;Test) to be set for this import (semicolon separated).')
338
339
  cmdlineparser.add_argument('--config', type=str, help='configuration json file for component mapping information.')
339
340
  cmdlineparser.add_argument('--interface', choices=['db', 'rest'], default='db', help='database access interface.')
341
+ cmdlineparser.add_argument('--testrunurl', type=str, default="", help='link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...')
340
342
 
341
343
  return cmdlineparser.parse_args()
342
344
 
@@ -583,13 +585,13 @@ Besides, `starttime` and `endtime` are also calculated and added in the merged r
583
585
  if oMergedTree == None:
584
586
  oMergedTree = oTree
585
587
  sStartTime = oMergedTree.getchildren()[0].get("timestamp")
586
- dtStartTime = datetime.strptime(sStartTime, PYTEST_DATETIME_FORMAT)
588
+ dtStartTime = parser.parse(sStartTime)
587
589
  dtEndTime = dtStartTime + timedelta(seconds=float(oMergedTree.getchildren()[0].get("time")))
588
590
  else:
589
591
  oAdditionalTree = etree.parse(item)
590
592
  for oSuite in oAdditionalTree.getroot().iterchildren("testsuite"):
591
593
  oMergedTree.append(oSuite)
592
- dtTimestamp = datetime.strptime(oSuite.get("timestamp"), PYTEST_DATETIME_FORMAT)
594
+ dtTimestamp = parser.parse(oSuite.get("timestamp"))
593
595
 
594
596
  # check starttime and endtime for the execution result
595
597
  if dtTimestamp < dtStartTime:
@@ -939,8 +941,8 @@ Process to the lowest suite level (test file):
939
941
  _tbl_file_id = None
940
942
  _tbl_file_tester_account = dConfig["tester"]
941
943
  _tbl_file_tester_machine = suite.get("hostname")
942
- _tbl_file_time_start = suite.get("timestamp")
943
- test_start_time = datetime.strptime(_tbl_file_time_start, PYTEST_DATETIME_FORMAT)
944
+ test_start_time = parser.parse(suite.get("timestamp"))
945
+ _tbl_file_time_start = datetime.strftime(test_start_time, DB_DATETIME_FORMAT)
944
946
  _tbl_file_time_end = datetime.strftime(test_start_time + timedelta(seconds=float(suite.get("time"))), DB_DATETIME_FORMAT)
945
947
 
946
948
  test_number = 1
@@ -1076,6 +1078,7 @@ Flow to import PyTest results to database:
1076
1078
  * `variant` : variant name to be set for this import.
1077
1079
  * `versions` : metadata: Versions (Software;Hardware;Test) to be set for this import.
1078
1080
  * `config` : configuration json file for component mapping information.
1081
+ * `testrunurl`: link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
1079
1082
 
1080
1083
  **Returns:**
1081
1084
 
@@ -1176,7 +1179,7 @@ Flow to import PyTest results to database:
1176
1179
  # Set version as start time of the execution if not provided in metadata
1177
1180
  # Format: %Y%m%d_%H%M%S from %Y-%m-%d %H:%M:%S
1178
1181
  if _tbl_result_version_sw_target=="":
1179
- _tbl_result_version_sw_target = datetime.strftime(datetime.strptime(pytest_result.get("starttime"), DB_DATETIME_FORMAT), "%Y%m%d_%H%M%S")
1182
+ _tbl_result_version_sw_target = datetime.strftime(parser.parse(pytest_result.get("starttime")), "%Y%m%d_%H%M%S")
1180
1183
 
1181
1184
  if not args.append:
1182
1185
  Logger.log(f"Set project/variant to '{sVariant}' ({sMsgVarirantSetBy})")
@@ -1199,7 +1202,7 @@ Flow to import PyTest results to database:
1199
1202
 
1200
1203
  # Process other info
1201
1204
  _tbl_result_interpretation = ""
1202
- _tbl_result_jenkinsurl = ""
1205
+ _tbl_result_jenkinsurl = args.testrunurl
1203
1206
  _tbl_result_reporting_qualitygate = ""
1204
1207
 
1205
1208
  # Check the UUID is existing or not
PyTestLog2DB/version.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # **************************************************************************************************************
2
2
  #
3
- # Copyright 2020-2023 Robert Bosch GmbH
3
+ # Copyright 2020-2026 Robert Bosch GmbH
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -18,6 +18,5 @@
18
18
  #
19
19
  # Version and date of PyTestLog2DB
20
20
  #
21
- VERSION = "0.3.1"
22
- VERSION_DATE = "20.05.2024"
23
-
21
+ VERSION = "0.4.0"
22
+ VERSION_DATE = "23.03.2026"
@@ -0,0 +1,346 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyTestLog2DB
3
+ Version: 0.4.0
4
+ Summary: Imports pytest result(s) to TestResultWebApp database
5
+ Author-email: Tran Duy Ngoan <Ngoan.TranDuy@vn.bosch.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://pypi.org/project/PyTestLog2DB/
8
+ Project-URL: Documentation, https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/PyTestLog2DB/PyTestLog2DB.pdf
9
+ Project-URL: Readme, https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/README.rst
10
+ Project-URL: Repository, https://github.com/test-fullautomation/python-pytestlog2db
11
+ Project-URL: Issues, https://github.com/test-fullautomation/python-pytestlog2db/issues
12
+ Keywords: pytest,testresults,database
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/x-rst
18
+ License-File: LICENSE
19
+ Requires-Dist: docutils>=0.22.4
20
+ Requires-Dist: colorama
21
+ Requires-Dist: TestResultDBAccess
22
+ Requires-Dist: lxml
23
+ Requires-Dist: PythonExtensionsCollection
24
+ Requires-Dist: GenPackageDoc
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=6.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=3.0; extra == "dev"
28
+ Provides-Extra: docs
29
+ Requires-Dist: docutils>=0.22.4; extra == "docs"
30
+ Dynamic: license-file
31
+
32
+ PyTestLog2DB
33
+ ============
34
+
35
+ Table of Contents
36
+ -----------------
37
+
38
+ - `Getting Started <#getting-started>`__
39
+
40
+ - `How to install <#how-to-install>`__
41
+ - `Usage <#usage>`__
42
+ - `Example <#example>`__
43
+ - `Contribution <#contribution>`__
44
+ - `Sourcecode Documentation <#sourcecode-documentation>`__
45
+ - `Feedback <#feedback>`__
46
+ - `About <#about>`__
47
+
48
+ - `Maintainers <#maintainers>`__
49
+ - `Contributors <#contributors>`__
50
+ - `License <#license>`__
51
+
52
+ Getting Started
53
+ ---------------
54
+
55
+ **PyTestLog2DB** is a command-line tool that enables you to import pytest_ XML
56
+ result files into TestResultWebApp_'s database for presenting an overview about
57
+ the whole test execution and detail of each test result.
58
+
59
+ **PyTestLog2DB** tool is operating system independent and only works with
60
+ Python 3.
61
+
62
+ How to install
63
+ ~~~~~~~~~~~~~~
64
+
65
+ **PyTestLog2DB** can be installed in two different ways.
66
+
67
+ The **PyTestLog2DB** can be installed in two different ways.
68
+
69
+ 1. Installation via PyPi (recommended for users)
70
+
71
+ .. code::
72
+
73
+ pip install PyTestLog2DB
74
+
75
+ `PyTestLog2DB in PyPi <https://pypi.org/project/PyTestLog2DB/>`_
76
+
77
+ 2. Installation via GitHub (recommended for developers)
78
+
79
+ * Clone the **python-pytestlog2db** repository to your machine.
80
+
81
+ .. code::
82
+
83
+ git clone https://github.com/test-fullautomation/python-pytestlog2db.git
84
+
85
+ `PyTestLog2DB in GitHub <https://github.com/test-fullautomation/python-PyTestLog2DB>`_
86
+
87
+ * Use the following command to install **PyTestLog2DB** (executed in repository main folder):
88
+
89
+ .. code::
90
+
91
+ python -m pip install .
92
+
93
+ Or:
94
+
95
+ .. code::
96
+
97
+ python -m pip install --proxy <proxy> .
98
+
99
+ This command will also download and install all dependencies that are required to work with the source files in the current repository.
100
+ After the initial installation of **PyTestLog2DB** is done, you have the following two possibilities:
101
+
102
+ 1. *Clean the previous installation*:
103
+
104
+ .. code::
105
+
106
+ python "./cleanup_installation.py"
107
+
108
+ ``cleanup_installation.py`` explicitly deletes all files and folders within the component installation folder under
109
+ ``site-packages`` and also deletes local build artefacts.
110
+
111
+ 2. *Render the component documentation*:
112
+
113
+ .. code::
114
+
115
+ python "./genpackagedoc.py"
116
+
117
+ This would e.g. be required in case of changes in the interface of **PyTestLog2DB**.
118
+
119
+ The documentation is rendered by a separate application called **GenPackageDoc**, that is part
120
+ of the build dependencies and runtime dependencies of **PyTestLog2DB**.
121
+
122
+ **GenPackageDoc** needs to be configured. Details about how to do this, can be found in the
123
+ `README.rst <https://github.com/test-fullautomation/python-genpackagedoc/blob/develop/README.rst>`_
124
+ (sections *Install dependencies* and *Configure dependencies*).
125
+
126
+ * Use the following command to build **PyTestLog2DB** (executed in repository main folder):
127
+
128
+ .. code::
129
+
130
+ python -m build .
131
+
132
+ Or:
133
+
134
+ .. code::
135
+
136
+ python -m pip config set global.proxy <proxy>
137
+ python -m build .
138
+
139
+ After succesful installation, the executable file **PyTestLog2DB** will be
140
+ available (under *Scripts* folder of Python on Windows and *~/.local/bin/*
141
+ folder on Linux).
142
+
143
+ In case above location is added to **PATH** environment variable then you can
144
+ run it directly as operation system's command.
145
+
146
+ Usage
147
+ -----
148
+
149
+ **PyTestLog2DB** requires the pytest_ result file(s) which contains the test
150
+ result in *JUnit XML* format and TestResultWebApp_'s database information for
151
+ importing.
152
+
153
+ Use below command to get tools's usage
154
+
155
+ ::
156
+
157
+ PyTestLog2DB -h
158
+
159
+
160
+ The usage should be showed as below:
161
+
162
+ ::
163
+
164
+ usage: PyTestLog2DB (PyTestXMLReport to TestResultWebApp importer) [-h] [-v] [--recursive] [--dryrun] [--append] [--UUID UUID] [--variant VARIANT] [--versions VERSIONS] [--config CONFIG]
165
+ resultxmlfile server user password database
166
+
167
+ PyTestLog2DB imports pytest JUnit XML report file(s)generated by pytest into a WebApp database.
168
+
169
+ positional arguments:
170
+ resultxmlfile absolute or relative path to the pytest JUnit XML report file or directory of report files to be imported.
171
+ server server which hosts the database (IP or URL).
172
+ user user for database login.
173
+ password password for database login.
174
+ database database schema for database login.
175
+
176
+ optional arguments:
177
+ -h, --help show this help message and exit
178
+ -v, --version version of the PyTestLog2DB importer.
179
+ --recursive if set, then the path is searched recursively for output files to be imported.
180
+ --dryrun if set, then verify all input arguments (includes DB connection) and show what would be done.
181
+ --append is used in combination with --UUID <UUID>. If set, allow to append new result(s) to existing execution result UUID in --UUID argument.
182
+ --UUID UUID UUID used to identify the import and version ID on webapp. If not provided PyTestLog2DB will generate an UUID for the whole import.
183
+ --variant VARIANT variant name to be set for this import.
184
+ --versions VERSIONS metadata: Versions (Software;Hardware;Test) to be set for this import (semicolon separated).
185
+ --config CONFIG configuration json file for component mapping information.
186
+ --interface {db,rest}
187
+ database access interface.
188
+ --testrunurl TESTRUNURL
189
+ link to test execution job: Jenkins job, Gitlab CI/CD pipeline, ...
190
+
191
+ The below command is simple usage with all required arguments to import
192
+ pytest_ results into TestResultWebApp's database:
193
+
194
+ ::
195
+
196
+ PyTestLog2DB <resultxmlfile> <server> <user> <password> <database>
197
+
198
+ Besides the executable file, you can also run tool as a Python module
199
+
200
+ ::
201
+
202
+ python -m PyTestLog2DB <resultxmlfile> <server> <user> <password> <database>
203
+
204
+ Example
205
+ -------
206
+
207
+ In order the import the robot result(s) to TestResultWebApp's database,
208
+ we need the pytest_ result file in *JUnit XML* format.
209
+
210
+ So, firstly execute the pytest_ testcase(s) to get the result file(s). But the
211
+ ***.xml** result file is not generated by default.
212
+
213
+ We need to specify the argument *--junit-xml=<path>* when executing pytest_
214
+ to get the generated *JUnit XML* report file at given path.
215
+
216
+ E.g:
217
+ ::
218
+
219
+ pytest --junit-xml=path/to/result.xml pytest/folder
220
+
221
+ After that, the ***.xml** result file will be available at **path/to/result.xml**
222
+ and can be used for importing to TestResultWebApp_ with command:
223
+
224
+ ::
225
+
226
+ PyTestLog2DB path/to/result.xml localhost test_user test_pw test_db
227
+
228
+ Then, open TestResultWebApp with your favourite browser and you will see how
229
+ wonderful the execution result is displayed as below figures:
230
+
231
+ Dashboard view:
232
+
233
+ .. image:: https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/packagedoc/additional_docs/pictures/Dashboard.png?raw=true
234
+ :alt: Dashboard view
235
+
236
+ Datatable view:
237
+
238
+ .. image:: https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/packagedoc/additional_docs/pictures/Datatable.png?raw=true
239
+ :alt: Datatable view
240
+
241
+ Notes:
242
+ ~~~~~~
243
+
244
+ The ***.xml** report file generated by pytest contains only the testcase
245
+ result(s) and less metadata information about the test execution such as
246
+ *project/variant*, *software version*, *tester* , *component*, ...
247
+ which are required by TestResultWebApp_.
248
+
249
+ So that, **PyTestLog2DB** will handle those information with the default values.
250
+
251
+ But you can use the optional argument *--config CONFIG* to specify those
252
+ information when importing to TestResultWebApp_'s database.
253
+
254
+ Sample configuration file:
255
+
256
+ ::
257
+
258
+ {
259
+ "variant" : "MyProject",
260
+ "version_sw": "0.1.1",
261
+ "components": {
262
+ "Testsuite1" : "test-data.test_tsclass.TestSuite1",
263
+ "Testsuite2" : "test-data.test_tsclass.TestSuite2",
264
+ "Others" : [
265
+ "test-data.test_ts1",
266
+ "test-data.test_ts2"
267
+ ]
268
+ },
269
+ "tester" : "Tran Duy Ngoan"
270
+ }
271
+
272
+ Please refer `PyTestLog2DB tool’s Documentation`_ for more detail about default
273
+ values and the configuration json file.
274
+
275
+ Contribution
276
+ ------------
277
+ We are always searching support and you are cordially invited to help to improve
278
+ **PyTestLog2DB** tool.
279
+
280
+ Sourcecode Documentation
281
+ ------------------------
282
+ To understand more detail about the tool's features, parameters and how pytest
283
+ result(s) will be displayed on TestResultWebApp, please refer to
284
+ `PyTestLog2DB tool’s Documentation`_.
285
+
286
+ Feedback
287
+ --------
288
+ Please feel free to give any feedback to us via
289
+
290
+ Email to: `Thomas Pollerspöck`_
291
+
292
+ Issue tracking: `PyTestLog2DB Issues`_
293
+
294
+ About
295
+ -----
296
+
297
+ Maintainers
298
+ ~~~~~~~~~~~
299
+ `Thomas Pollerspöck`_
300
+
301
+ `Holger Queckenstedt`_
302
+
303
+ `Tran Duy Ngoan`_
304
+
305
+ Contributors
306
+ ~~~~~~~~~~~~
307
+
308
+ `Nguyen Huynh Tri Cuong`_
309
+
310
+ `Mai Dinh Nam Son`_
311
+
312
+ `Tran Hoang Nguyen`_
313
+
314
+ License
315
+ ~~~~~~~
316
+
317
+ Copyright 2020-2023 Robert Bosch GmbH
318
+
319
+ Licensed under the Apache License, Version 2.0 (the "License");
320
+ you may not use this file except in compliance with the License.
321
+ You may obtain a copy of the License at
322
+
323
+ |License: Apache v2|
324
+
325
+ Unless required by applicable law or agreed to in writing, software
326
+ distributed under the License is distributed on an "AS IS" BASIS,
327
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
328
+ See the License for the specific language governing permissions and
329
+ limitations under the License.
330
+
331
+
332
+ .. |License: Apache v2| image:: https://img.shields.io/pypi/l/robotframework.svg
333
+ :target: http://www.apache.org/licenses/LICENSE-2.0.html
334
+ .. _pytest: https://docs.pytest.org
335
+ .. _JUnit XML: https://llg.cubic.org/docs/junit
336
+ .. _PyTestLog2DB: https://github.com/test-fullautomation/python-pytestlog2db
337
+ .. _TestResultWebApp: https://github.com/test-fullautomation/TestResultWebApp
338
+ .. _PyPI: https://pypi.org/
339
+ .. _Thomas Pollerspöck: mailto:Thomas.Pollerspoeck@de.bosch.com
340
+ .. _Tran Duy Ngoan: mailto:Ngoan.TranDuy@vn.bosch.com
341
+ .. _Nguyen Huynh Tri Cuong: mailto:Cuong.NguyenHuynhTri@vn.bosch.com
342
+ .. _Mai Dinh Nam Son: mailto:Son.MaiDinhNam@vn.bosch.com
343
+ .. _Tran Hoang Nguyen: mailto:Nguyen.TranHoang@vn.bosch.com
344
+ .. _Holger Queckenstedt: mailto:Holger.Queckenstedt@de.bosch.com
345
+ .. _PyTestLog2DB tool’s Documentation: https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/PyTestLog2DB/PyTestLog2DB.pdf
346
+ .. _PyTestLog2DB Issues: https://github.com/test-fullautomation/python-pytestlog2db/issues
@@ -0,0 +1,12 @@
1
+ PyTestLog2DB/PyTestLog2DB.pdf,sha256=xNHY2lBGVklJkxaHwe1mIHUtNH8nkUGtKXBSpkS2XZs,517552
2
+ PyTestLog2DB/__init__.py,sha256=QGox2k2vxlv4xBA8Q82Elqn9X8gf47khen7co4L3fVI,596
3
+ PyTestLog2DB/__main__.py,sha256=r7Rk90uYaxB5ML9NTpYXdXcxL-3Sw7g2m4lCU8xRS08,693
4
+ PyTestLog2DB/pytestlog2db.py,sha256=vZb6IzbywP839B0cCFSsO8w1D2R9KQglJB0-NjNLDMY,43947
5
+ PyTestLog2DB/version.py,sha256=tiaaaicbE4AgDXG4lN0vWS-JNHFapl3ciGZYNbCUG2U,916
6
+ PyTestLog2DB/xsd/junit.xsd,sha256=16vVXGy8p1afl2YbgX61g528x4x8Vy3Lf0qqKY9IAZs,6847
7
+ pytestlog2db-0.4.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ pytestlog2db-0.4.0.dist-info/METADATA,sha256=KfGqdTBp4BlnetRY-EEC6DGYLuJHeVWbMAcz3CuC008,11863
9
+ pytestlog2db-0.4.0.dist-info/WHEEL,sha256=kIt4MnNJDJ26dPfzNiSjgFHPBc-JaVd9TwMdICBRasQ,90
10
+ pytestlog2db-0.4.0.dist-info/entry_points.txt,sha256=loulU5_oxKt-J6om9TPOGuk_riltUcIvUNG0XKpHtis,72
11
+ pytestlog2db-0.4.0.dist-info/top_level.txt,sha256=WN8NnXKE7lkjhVq7yi3WQwIh54rVKUQdecci-Yy4pog,13
12
+ pytestlog2db-0.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (0.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ PyTestLog2DB = PyTestLog2DB.pytestlog2db:PyTestLog2DB
@@ -1,308 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: PyTestLog2DB
3
- Version: 0.3.1
4
- Summary: Imports pytest result(s) to TestResultWebApp database
5
- Home-page: https://github.com/test-fullautomation/python-pytestlog2db
6
- Author: Tran Duy Ngoan
7
- Author-email: Ngoan.TranDuy@vn.bosch.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Development Status :: 4 - Beta
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Software Development
16
- Requires-Python: >=3.0
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: colorama
20
- Requires-Dist: TestResultDBAccess
21
- Requires-Dist: lxml
22
-
23
- PyTestLog2DB
24
- ============
25
-
26
- Table of Contents
27
- -----------------
28
-
29
- - [Getting Started](#getting-started)
30
- - [How to install](#how-to-install)
31
- - [Usage](#usage)
32
- - [Example](#example)
33
- - [Contribution](#contribution)
34
- - [Sourcecode Documentation](#sourcecode-documentation)
35
- - [Feedback](#feedback)
36
- - [About](#about)
37
- - [Maintainers](#maintainers)
38
- - [Contributors](#contributors)
39
- - [License](#license)
40
-
41
- Getting Started
42
- ---------------
43
-
44
- **PyTestLog2DB** is a command-line tool that enables you to import
45
- [pytest](https://docs.pytest.org) XML result files into
46
- [TestResultWebApp](https://github.com/test-fullautomation/TestResultWebApp)\'s
47
- database for presenting an overview about the whole test execution and
48
- detail of each test result.
49
-
50
- **PyTestLog2DB** tool is operating system independent and only works
51
- with Python 3.
52
-
53
- ### How to install
54
-
55
- **PyTestLog2DB** can be installed in two different ways.
56
-
57
- 1. Installation via PyPi (recommended for users)
58
-
59
- ``` {.}
60
- pip install PyTestLog2DB
61
- ```
62
-
63
- [PyTestLog2DB in PyPi](https://pypi.org/project/PyTestLog2DB/)
64
-
65
- 2. Installation via GitHub (recommended for developers)
66
-
67
- - Clone the **python-pytestlog2db** repository to your machine.
68
-
69
- ``` {.}
70
- git clone https://github.com/test-fullautomation/python-pytestlog2db.git
71
- ```
72
-
73
- [PyTestLog2DB in
74
- GitHub](https://github.com/test-fullautomation/python-pytestlog2db)
75
-
76
- - Install dependencies
77
-
78
- **PyTestLog2DB** requires some additional Python libraries.
79
- Before you install the cloned repository sources you have to
80
- install the dependencies manually. The names of all related
81
- packages you can find in the file `requirements.txt` in the
82
- repository root folder. Use pip to install them:
83
-
84
- ``` {.}
85
- pip install -r ./requirements.txt
86
- ```
87
-
88
- Additionally install **LaTeX** (recommended: TeX Live). This is
89
- used to render the documentation.
90
-
91
- - Configure dependencies
92
-
93
- The installation of **PyTestLog2DB** includes to generate the
94
- documentation in PDF format. This is done by an application
95
- called **GenPackageDoc**, that is part of the installation
96
- dependencies (see `requirements.txt`).
97
-
98
- **GenPackageDoc** uses **LaTeX** to generate the documentation
99
- in PDF format. Therefore **GenPackageDoc** needs to know where
100
- to find **LaTeX**. This is defined in the **GenPackageDoc**
101
- configuration file
102
-
103
- ``` {.}
104
- packagedoc\packagedoc_config.json
105
- ```
106
-
107
- Before you start the installation you have to introduce the
108
- following environment variable, that is used in
109
- `packagedoc_config.json`:
110
-
111
- - `GENDOC_LATEXPATH` : path to `pdflatex` executable
112
-
113
- - Use the following command to install **PyTestLog2DB**:
114
-
115
- ``` {.}
116
- python setup.py install
117
- ```
118
-
119
- After succesful installation, the executable file **PyTestLog2DB** will
120
- be available (under *Scripts* folder of Python on Windows and
121
- *\~/.local/bin/* folder on Linux).
122
-
123
- In case above location is added to **PATH** environment variable then
124
- you can run it directly as operation system\'s command.
125
-
126
- Usage
127
- -----
128
-
129
- **PyTestLog2DB** requires the [pytest](https://docs.pytest.org) result
130
- file(s) which contains the test result in *JUnit XML* format and
131
- [TestResultWebApp](https://github.com/test-fullautomation/TestResultWebApp)\'s
132
- database information for importing.
133
-
134
- Use below command to get tools\'s usage
135
-
136
- PyTestLog2DB -h
137
-
138
- The usage should be showed as below:
139
-
140
- usage: PyTestLog2DB (PyTestXMLReport to TestResultWebApp importer) [-h] [-v] [--recursive] [--dryrun] [--append] [--UUID UUID] [--variant VARIANT] [--versions VERSIONS] [--config CONFIG]
141
- resultxmlfile server user password database
142
-
143
- PyTestLog2DB imports pytest JUnit XML report file(s)generated by pytest into a WebApp database.
144
-
145
- positional arguments:
146
- resultxmlfile absolute or relative path to the pytest JUnit XML report file or directory of report files to be imported.
147
- server server which hosts the database (IP or URL).
148
- user user for database login.
149
- password password for database login.
150
- database database schema for database login.
151
-
152
- optional arguments:
153
- -h, --help show this help message and exit
154
- -v, --version version of the PyTestLog2DB importer.
155
- --recursive if set, then the path is searched recursively for output files to be imported.
156
- --dryrun if set, then verify all input arguments (includes DB connection) and show what would be done.
157
- --append is used in combination with --UUID <UUID>. If set, allow to append new result(s) to existing execution result UUID in --UUID argument.
158
- --UUID UUID UUID used to identify the import and version ID on webapp. If not provided PyTestLog2DB will generate an UUID for the whole import.
159
- --variant VARIANT variant name to be set for this import.
160
- --versions VERSIONS metadata: Versions (Software;Hardware;Test) to be set for this import (semicolon separated).
161
- --config CONFIG configuration json file for component mapping information.
162
- --interface {db,rest}
163
- database access interface.
164
-
165
- The below command is simple usage with all required arguments to import
166
- [pytest](https://docs.pytest.org) results into TestResultWebApp\'s
167
- database:
168
-
169
- PyTestLog2DB <resultxmlfile> <server> <user> <password> <database>
170
-
171
- Besides the executable file, you can also run tool as a Python module
172
-
173
- python -m PyTestLog2DB <resultxmlfile> <server> <user> <password> <database>
174
-
175
- Example
176
- -------
177
-
178
- In order the import the robot result(s) to TestResultWebApp\'s database,
179
- we need the [pytest](https://docs.pytest.org) result file in *JUnit XML*
180
- format.
181
-
182
- So, firstly execute the [pytest](https://docs.pytest.org) testcase(s) to
183
- get the result file(s). But the **\*.xml** result file is not generated
184
- by default.
185
-
186
- We need to specify the argument *\--junit-xml=\<path\>* when executing
187
- [pytest](https://docs.pytest.org) to get the generated *JUnit XML*
188
- report file at given path.
189
-
190
- E.g: :
191
-
192
- pytest --junit-xml=path/to/result.xml pytest/folder
193
-
194
- After that, the **\*.xml** result file will be available at
195
- **path/to/result.xml** and can be used for importing to
196
- [TestResultWebApp](https://github.com/test-fullautomation/TestResultWebApp)
197
- with command:
198
-
199
- PyTestLog2DB path/to/result.xml localhost test_user test_pw test_db
200
-
201
- Then, open TestResultWebApp with your favourite browser and you will see
202
- how wonderful the execution result is displayed as below figures:
203
-
204
- Dashboard view:
205
-
206
- ![Dashboard view](https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/packagedoc/additional_docs/pictures/Dashboard.png?raw=true)
207
-
208
- Datatable view:
209
-
210
- ![Datatable view](https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/packagedoc/additional_docs/pictures/Datatable.png?raw=true)
211
-
212
- ### Notes:
213
-
214
- > The **\*.xml** report file generated by pytest contains only the
215
- > testcase result(s) and less metadata information about the test
216
- > execution such as *project/variant*, *software version*, *tester* ,
217
- > *component*, \... which are required by
218
- > [TestResultWebApp](https://github.com/test-fullautomation/TestResultWebApp).
219
- >
220
- > So that, **PyTestLog2DB** will handle those information with the
221
- > default values.
222
- >
223
- > But you can use the optional argument *\--config CONFIG* to specify
224
- > those information when importing to
225
- > [TestResultWebApp](https://github.com/test-fullautomation/TestResultWebApp)\'s
226
- > database.
227
- >
228
- > Sample configuration file:
229
- >
230
- > {
231
- > "variant" : "MyProject",
232
- > "version_sw": "0.1.1",
233
- > "components": {
234
- > "Testsuite1" : "test-data.test_tsclass.TestSuite1",
235
- > "Testsuite2" : "test-data.test_tsclass.TestSuite2",
236
- > "Others" : [
237
- > "test-data.test_ts1",
238
- > "test-data.test_ts2"
239
- > ]
240
- > },
241
- > "tester" : "Tran Duy Ngoan"
242
- > }
243
- >
244
- > Please refer [PyTestLog2DB tool's
245
- > Documentation](https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/PyTestLog2DB/PyTestLog2DB.pdf)
246
- > for more detail about default values and the configuration json file.
247
-
248
- Contribution
249
- ------------
250
-
251
- We are always searching support and you are cordially invited to help to
252
- improve **PyTestLog2DB** tool.
253
-
254
- Sourcecode Documentation
255
- ------------------------
256
-
257
- To understand more detail about the tool\'s features, parameters and how
258
- pytest result(s) will be displayed on TestResultWebApp, please refer to
259
- [PyTestLog2DB tool's
260
- Documentation](https://github.com/test-fullautomation/python-pytestlog2db/blob/develop/PyTestLog2DB/PyTestLog2DB.pdf).
261
-
262
- Feedback
263
- --------
264
-
265
- Please feel free to give any feedback to us via
266
-
267
- Email to: [Thomas Pollerspöck](mailto:Thomas.Pollerspoeck@de.bosch.com)
268
-
269
- Issue tracking: [PyTestLog2DB
270
- Issues](https://github.com/test-fullautomation/python-pytestlog2db/issues)
271
-
272
- About
273
- -----
274
-
275
- ### Maintainers
276
-
277
- [Thomas Pollerspöck](mailto:Thomas.Pollerspoeck@de.bosch.com)
278
-
279
- [Holger Queckenstedt](mailto:Holger.Queckenstedt@de.bosch.com)
280
-
281
- [Tran Duy Ngoan](mailto:Ngoan.TranDuy@vn.bosch.com)
282
-
283
- ### Contributors
284
-
285
- [Nguyen Huynh Tri Cuong](mailto:Cuong.NguyenHuynhTri@vn.bosch.com)
286
-
287
- [Mai Dinh Nam Son](mailto:Son.MaiDinhNam@vn.bosch.com)
288
-
289
- [Tran Hoang Nguyen](mailto:Nguyen.TranHoang@vn.bosch.com)
290
-
291
- ### License
292
-
293
- Copyright 2020-2023 Robert Bosch GmbH
294
-
295
- Licensed under the Apache License, Version 2.0 (the \"License\"); you
296
- may not use this file except in compliance with the License. You may
297
- obtain a copy of the License at
298
-
299
- > [![License: Apache
300
- > v2](https://img.shields.io/pypi/l/robotframework.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
301
-
302
- Unless required by applicable law or agreed to in writing, software
303
- distributed under the License is distributed on an \"AS IS\" BASIS,
304
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
305
- See the License for the specific language governing permissions and
306
- limitations under the License.
307
-
308
-
@@ -1,11 +0,0 @@
1
- PyTestLog2DB/PyTestLog2DB.pdf,sha256=_SWxi7NpwGw5B5ST_PYTRlG3ThL9ZgDnogMXqeS1caw,520598
2
- PyTestLog2DB/__init__.py,sha256=YKDTJjDsnQkr5X-gjjO8opwKUVKm6kc8sIUpURYMk48,596
3
- PyTestLog2DB/__main__.py,sha256=YCrS2paaKQlHRlq2d_HKHnsQHs9uVudKN51L84mKd74,693
4
- PyTestLog2DB/pytestlog2db.py,sha256=uy8brtKt54b2SeDylFrcPL5HvbOKZ0Ip0GVUsZcBe80,43712
5
- PyTestLog2DB/version.py,sha256=CTc-wU56FDKToufjb5eraZi_hMlI64EDwByvf6UVPZE,917
6
- PyTestLog2DB/xsd/junit.xsd,sha256=16vVXGy8p1afl2YbgX61g528x4x8Vy3Lf0qqKY9IAZs,6847
7
- PyTestLog2DB-0.3.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
- PyTestLog2DB-0.3.1.dist-info/METADATA,sha256=23IYCfYo0G4XywE-RkoF33A4lcTr35Ev9YO_Hgy8r5s,10956
9
- PyTestLog2DB-0.3.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
10
- PyTestLog2DB-0.3.1.dist-info/top_level.txt,sha256=WN8NnXKE7lkjhVq7yi3WQwIh54rVKUQdecci-Yy4pog,13
11
- PyTestLog2DB-0.3.1.dist-info/RECORD,,