robotframework-testdoc 0.1.2__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.

Potentially problematic release.


This version of robotframework-testdoc might be problematic. Click here for more details.

@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: robotframework-testdoc
3
+ Version: 0.1.2
4
+ Summary: A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts.
5
+ Author-email: Marvin Klerx <marvinklerx1@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.7
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: click
11
+ Requires-Dist: robotframework
12
+ Requires-Dist: jinja2
13
+ Requires-Dist: tomli
14
+ Dynamic: license-file
15
+
16
+ # Robot Framework TestDoc
17
+
18
+ ## Installation
19
+
20
+ Install the tool using the following command:
21
+ ```shell
22
+ pip install robotframework-testdoc
23
+ ```
24
+
25
+ > [!IMPORTANT]
26
+ > Preconditions: Python & Pip Installation.
27
+
28
+ ## Usage
29
+
30
+ ### Basic Usage
31
+ ```shell
32
+ testdoc suite_directory output.html
33
+ # or
34
+ testdoc suite_file output.html
35
+ ```
36
+
37
+ ### Extended Usage
38
+ ```shell
39
+ testdoc [OPTIONS] suite_directory output.html
40
+ ```
41
+
42
+ > [!TIP]
43
+ > **Included Help:** Please execute ``testdoc --help`` for further details about the commandline arguments or see the examples below.
44
+
45
+ ## Examples
46
+
47
+ Below you can find some example of using the testdoc library.
48
+
49
+ > [!TIP]
50
+ > Of course, you can combine all of them!
51
+
52
+ ```shell
53
+ # Generating docu without option
54
+ testdoc tests/ TestDocumentation.html
55
+
56
+ # Generating docu with new title, new root suite name, new root suite documentation text & new metadata
57
+ testdoc -t "Robot Framework Test Automation" -n "System Tests" -d "Root Suite Documentation" -m "Root Suite Metadata" tests/ TestDocumentation.html
58
+
59
+ # Generating docu with source prefix to navigate directly to its gitlab file path
60
+ testdoc -s "https://gitlab.com/myrepository" tests/ TestDocumentation.html
61
+
62
+ # Generating docu only with specific mentioned tags to include & exclude
63
+ testdoc -i ManagementUI -e LongTime tests/ TestDocumentation.html
64
+
65
+ # Generating docu only with multiple specific mentioned tags to include
66
+ testdoc -i ManagementUI -i MQTT tests/ TestDocumentation.html
67
+
68
+ # Generating docu only with new metadata for root suite object
69
+ testdoc -m Version=0.1.1-dev -m Tester=RobotExpert tests/ TestDocumentation.html
70
+
71
+ # Generating docu - hide tags information
72
+ testdoc --hide-tags tests/ TestDocumentation.html
73
+
74
+ # Generating docu - hide test case documentation texts
75
+ testdoc --hide-test-doc tests/ TestDocumentation.html
76
+
77
+ # Generating docu - hide test suite documentation texts
78
+ testdoc --hide-suite-doc tests/ TestDocumentation.html
79
+
80
+ # Generating docu - hide source information
81
+ testdoc --hide-source tests/ TestDocumentation.html
82
+
83
+ # Generating docu - hide keyword information (keyword calls in tests)
84
+ testdoc --hide-keywords tests/ TestDocumentation.html
85
+ ```
86
+
87
+ ## Robot Framework Tags
88
+ The commandline arguments ``include`` & ``exclude`` have more or less the same functionality like in the known ``robot ...`` command.
89
+ You can decide to weither include and / or exclude specific test cases into the test documentation.
90
+
91
+ ## External Configuration File
92
+ The idea of the external configuration file is, having a central place for passing the known CMD arguments via file instead of CMD parameters.
93
+ This will keep your CMD line call simple & clean.
94
+
95
+ For using this config file, just call the following command:
96
+ ```shell
97
+ # Generate docu with options defined in TOML file
98
+ testdoc -c path/to/config.toml tests/ TestDocumentation.html
99
+ ```
100
+
101
+ ## Theme Selection / Color Configuration
102
+
103
+ You can select between several themes (color configurations) for your HTML document to create!
104
+
105
+ > [!CAUTION]
106
+ > This is only possible via toml-configuration file, but not via cmd args directly!
107
+
108
+ ### Default Themes
109
+
110
+ There are a few predefined default themes available that you can choose via the toml-configuration file.
111
+ Therefore, please use the following syntax:
112
+ ```toml
113
+ [colors]
114
+ # Use the default theme
115
+ default = "default"
116
+ default = 0
117
+ # Use the default theme
118
+ default = "dark"
119
+ default = 1
120
+ # Use the default theme
121
+ default = "blue"
122
+ default = 2
123
+ # Use the default theme
124
+ default = "robot"
125
+ default = 3
126
+ ```
127
+
128
+ > [!TIP]
129
+ > You can select the default theme using either a string value or an integer value.
130
+
131
+ ### Custom Themes
132
+
133
+ You can apply your own custom theme to modify the colors of the created HTML document.
134
+ Use the following syntax & parameters in your toml-configuration file, to overwrite the predefined themes:
135
+ ```toml
136
+ [colors]
137
+ background = "#000028"
138
+ inner_color = "#000028"
139
+ button_active_color = "#193966"
140
+ button_hover_color = "#193966"
141
+ border_color = "#CCCCCC"
142
+ text_color = "#CCCCCC"
143
+ title_color = "#00ffb9"
144
+ robot_icon = "#00ffb9"
145
+ ```
146
+
147
+ > [!TIP]
148
+ > Please make sure to configure all available color values from this example — missing values may cause layout or rendering issues in the generated HTML document!
@@ -0,0 +1,24 @@
1
+ robotframework_testdoc-0.1.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
+ testdoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ testdoc/__main__.py,sha256=FXuSYwSHojtkWAz8l6xeETxklc3cVdUBqo1GiBGt2Rg,66
4
+ testdoc/cli.py,sha256=VOpy3jPHQVNgwGBQgQmXcgYAeQRsjhgrnzOsJKwSsyM,4441
5
+ testdoc/testdoc.py,sha256=cVJguXoFhkCM2nkUlZGB8m-6rBhKwthFFtdtz0T2l4Q,772
6
+ testdoc/helper/cliargs.py,sha256=PYz6hcKTo-MLzmXWum4foszuHhYrMubAG7nP9xKZ5b8,1263
7
+ testdoc/helper/datetimeconverter.py,sha256=1IuJ_rZlKKut3pallS9WSdlQ00YNQX2Nhf2oYWt7QDc,159
8
+ testdoc/helper/logger.py,sha256=STPEEdMIGpK004xHDskj8zzW3knBWP05GllYajQMaSY,272
9
+ testdoc/helper/pathconverter.py,sha256=Il4SX8EdpKPjOiZt97zC4TBLxp2tKUhfyyS2J1qWpyg,1656
10
+ testdoc/html/images/robotframework.svg,sha256=w1yNL6XtuHOCCwzjGX3pZQG7ZcJghzllvc7cQ9MKKbQ,1426
11
+ testdoc/html/templates/jinja_template_01.html,sha256=gw2hEx2P7zLsQP5-4fA2hErWJuhkUTZkEakXxRzWKtU,18213
12
+ testdoc/html/themes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ testdoc/html/themes/theme_config.py,sha256=UHqNlkff5Q_68uRAsCIODflxJxmLSyH8LMbdJXkHSdw,849
14
+ testdoc/html/themes/themes.py,sha256=6xlHW7O-XO9Z1B33_aRwzffkuWR65jM7CYXsZWUjdmY,1091
15
+ testdoc/html_rendering/render.py,sha256=BzPGyePwjCFZAXRHDF-ccM2xRKY-6Cnym1-uDb9i1AQ,1083
16
+ testdoc/parser/testcaseparser.py,sha256=4EyUFOuo6AtobKN7jveWAXTTs-KlvhzqXQuXnseTGj0,1189
17
+ testdoc/parser/testsuiteparser.py,sha256=F4zWTw4_ccipoOnRHl3LDLn6qPO-AhkSx7cZ7DLKC8U,2381
18
+ testdoc/parser/modifier/sourceprefixmodifier.py,sha256=UUZ0Gp5hZIYv4dvZV6XUOE5UkIFONLFj_mZczC40mzI,3013
19
+ testdoc/parser/modifier/suitefilemodifier.py,sha256=VA-4rAniQugXefWfXSaZoDzOafqXTqGDKLk2BZd6_hE,5785
20
+ robotframework_testdoc-0.1.2.dist-info/METADATA,sha256=9ulen0HLpVJahfcjKaC3k4WVDUvHsu8Kl4D4N2Clm4I,4577
21
+ robotframework_testdoc-0.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
22
+ robotframework_testdoc-0.1.2.dist-info/entry_points.txt,sha256=BUHy23mdlGCqYOWpsvRhSb1c0tPMzIwyTwr-sHI6xUs,45
23
+ robotframework_testdoc-0.1.2.dist-info/top_level.txt,sha256=p1axpYooAmdwwXQOzFsSXF3u_-88QFKCDxPf67siv3Y,8
24
+ robotframework_testdoc-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (78.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ testdoc = testdoc.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ testdoc
testdoc/__init__.py ADDED
File without changes
testdoc/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from testdoc.cli import main
2
+ if __name__ == "__main__":
3
+ main()
testdoc/cli.py ADDED
@@ -0,0 +1,91 @@
1
+ import click
2
+ import os
3
+
4
+ from .testdoc import TestDoc
5
+ from .helper.cliargs import CommandLineArguments
6
+
7
+ @click.command()
8
+ @click.option("-t","--title", required=False, help="Modify the title of the test documentation page")
9
+ @click.option("-n","--name", required=False, help="Modify the name of the root suite element")
10
+ @click.option("-d","--doc", required=False, help="Modify the documentation of the root suite element")
11
+ @click.option("-m","--metadata", multiple=True, required=False, help="Modify the metadata of the root suite element")
12
+ @click.option("-s","--sourceprefix",required=False, help=(
13
+ "Set a prefix used for Test Suite / Test Suite Source Information, e.g. GitLab Prefix Path to navigate directly to your repository!"
14
+ ))
15
+ @click.option("-i","--include", multiple=True, required=False, help="Include test cases with given tags")
16
+ @click.option("-e","--exclude", multiple=True, required=False, help="Exclude test cases with given tags")
17
+ @click.option("--hide-tags", is_flag=True, required=False, help="If given, test case tags are hidden")
18
+ @click.option("--hide-test-doc", is_flag=True,required=False, help="If given, test documentation is hidden")
19
+ @click.option("--hide-suite-doc", is_flag=True, required=False, help="If given, suite documentation is hidden")
20
+ @click.option("--hide-source", is_flag=True, required=False, help="If given, test suite/ test case source is hidden")
21
+ @click.option("--hide-keywords", is_flag=True, required=False, help="If given, keyword calls in test cases are hidden")
22
+ @click.option("-c", "--configfile", required=False, help="Optional .toml configuration file (includes all cmd-args)")
23
+ @click.option("-v", "--verbose", is_flag=True, required=False, help="More precise debugging into shell")
24
+ @click.argument("PATH")
25
+ @click.argument("OUTPUT")
26
+ def main(
27
+ title,
28
+ name,
29
+ doc,
30
+ metadata,
31
+ sourceprefix,
32
+ include,
33
+ exclude,
34
+ hide_tags,
35
+ hide_test_doc,
36
+ hide_suite_doc,
37
+ hide_source,
38
+ hide_keywords,
39
+ configfile,
40
+ verbose,
41
+ path,
42
+ output,
43
+ ):
44
+ """
45
+ Welcome to robotframework-testdoc - the new test documentation generator for your Robot Framework tests!
46
+ """
47
+ color = "green"
48
+ click.echo(click.style("""
49
+ ████████╗███████╗███████╗████████╗██████╗ ███████╗███████╗
50
+ ╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██ ██╗██ ██║██╔════╝
51
+ ██║ █████╗ ███████╗ ██║ ██ ██║██ ██║██║
52
+ ██║ ██╔══╝ ╚════██║ ██║ ██ ██║██ ██║██║
53
+ ██║ ███████╗███████║ ██║ ██████╔╝███████║███████╗
54
+ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝
55
+ """, fg=color)
56
+ )
57
+
58
+ args_instance = CommandLineArguments()
59
+ if configfile:
60
+ if os.path.exists(configfile):
61
+ args_instance.load_from_config_file(configfile)
62
+ else:
63
+ click.echo(click.style(f"⚠️ Config File not found: {configfile}", fg="yellow"))
64
+
65
+ args = args_instance.data
66
+ cli_params = {
67
+ "title": title or None,
68
+ "name": name or None,
69
+ "doc": doc or None,
70
+ "metadata": dict(item.split("=", 1) for item in metadata) if metadata else None,
71
+ "sourceprefix": sourceprefix,
72
+ "include": list(include) if include else None,
73
+ "exclude": list(exclude) if exclude else None,
74
+ "hide_tags": hide_tags or None,
75
+ "hide_test_doc": hide_test_doc or None,
76
+ "hide_suite_doc": hide_suite_doc or None,
77
+ "hide_source": hide_source or None,
78
+ "hide_keywords": hide_keywords or None,
79
+ "verbose_mode": verbose or None,
80
+ "config_file": configfile or None,
81
+ }
82
+ args.suite_file = path
83
+ args.output_file = output
84
+
85
+ for key, value in cli_params.items():
86
+ if value is not None:
87
+ setattr(args, key, value)
88
+ TestDoc().main()
89
+
90
+ if __name__ == "__main__":
91
+ main()
@@ -0,0 +1,43 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import List
3
+ import tomli
4
+
5
+ @dataclass
6
+ class CommandLineArgumentsData:
7
+ title: str = "Robot Framework - Test Documentation"
8
+ name: str = None
9
+ doc: str = None
10
+ metadata: dict = None
11
+ sourceprefix: str = None
12
+ include: List[str] = field(default_factory=list)
13
+ exclude: List[str] = field(default_factory=list)
14
+ hide_tags: bool = False
15
+ hide_test_doc: bool = False
16
+ hide_suite_doc: bool = False
17
+ hide_source: bool = False
18
+ hide_keywords: bool = False
19
+ config_file: str = None
20
+ verbose_mode: bool = False
21
+ suite_file: str = None
22
+ output_file: str = None
23
+ colors: dict = None
24
+
25
+ class CommandLineArguments:
26
+ _instance = None
27
+ def __new__(cls):
28
+ if cls._instance is None:
29
+ cls._instance = super().__new__(cls)
30
+
31
+ cls.data = CommandLineArgumentsData()
32
+ return cls._instance
33
+
34
+ def load_from_config_file(self, file_path: str):
35
+ with open(file_path, "rb") as f:
36
+ config = tomli.load(f)
37
+
38
+ if "colors" in config:
39
+ self.data.colors = config["colors"]
40
+
41
+ for key, value in config.items():
42
+ if hasattr(self.data, key):
43
+ setattr(self.data, key, value)
@@ -0,0 +1,5 @@
1
+ import datetime
2
+
3
+ class DateTimeConverter():
4
+ def get_generated_datetime(self) -> str:
5
+ return(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
@@ -0,0 +1,9 @@
1
+ import click
2
+
3
+ class Logger():
4
+ def LogKeyValue(self, key, value, color = "green"):
5
+ click.echo(key, nl=False)
6
+ click.echo(click.style(f"'{value}'", fg=color))
7
+
8
+ def Log(self, msg, color = "white"):
9
+ click.echo(click.style(msg, fg=color))
@@ -0,0 +1,50 @@
1
+ import os
2
+
3
+ from .cliargs import CommandLineArguments
4
+ from .logger import Logger
5
+
6
+ class PathConverter():
7
+
8
+ def __init__(self):
9
+ self.args = CommandLineArguments().data
10
+
11
+ def path_convertion(self) -> str:
12
+
13
+ suite_path = self.args.suite_file
14
+ output_path = self.args.output_file
15
+ config_path = self.args.config_file
16
+
17
+ # Convert path to suite file / directory
18
+ suite_path = PathConverter().conv_generic_path(path=suite_path)
19
+ if ".robot" in suite_path:
20
+ msg = f"Suite File: '{str(suite_path).split("/")[-1]}'"
21
+ else:
22
+ msg = f"Suite Directory: '{suite_path}'"
23
+
24
+ # Convert path to output file
25
+ output_path = PathConverter().conv_generic_path(path=output_path)
26
+
27
+ # Convert path to config file
28
+ if self.args.config_file:
29
+ config_path = PathConverter().conv_generic_path(path=config_path)
30
+
31
+ # Print to console
32
+ if self.args.verbose_mode:
33
+ Logger().Log("=== TestDoc ===")
34
+ Logger().LogKeyValue("Generating Test Documentation for: ", msg)
35
+ Logger().LogKeyValue("Saving to output file: ", output_path)
36
+ Logger().LogKeyValue("Using config file: ", config_path) if config_path else None
37
+
38
+ return suite_path, output_path, config_path
39
+
40
+ def conv_generic_path(self,
41
+ path: str
42
+ ) -> str:
43
+ """
44
+ Generate OS independent path.
45
+ """
46
+ abs_path = os.path.abspath(path)
47
+ generic_path = os.path.normpath(abs_path)
48
+ if os.name == "nt":
49
+ generic_path = generic_path.replace("\\", "/")
50
+ return generic_path
@@ -0,0 +1 @@
1
+ <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Robot Framework</title><path d="M4.9565 10.2246c0-1.8766 1.5257-3.4023 3.4-3.4023 1.8766 0 3.4024 1.5257 3.4024 3.4023 0 .6838-.5526 1.2364-1.2341 1.2364-.6818 0-1.2344-.5526-1.2344-1.2364 0-.513-.4185-.9296-.9338-.9296-.5129 0-.9317.4165-.9317.9296 0 .6838-.5523 1.2364-1.234 1.2364-.6818 0-1.2344-.5526-1.2344-1.2364m14.0868 5.717c0 .6842-.5524 1.2363-1.2341 1.2363H6.3575c-.6818 0-1.2344-.552-1.2344-1.2363 0-.6837.5526-1.2363 1.2344-1.2363h11.4517c.6817 0 1.234.5526 1.234 1.2363m-5.351-5.0244c-.3814-.5657-.2323-1.3328.3334-1.7143l2.8628-1.9334c.5613-.3902 1.3329-.2324 1.7144.3289.3815.5654.2323 1.3329-.3334 1.7144l-2.8628 1.9333c-.5442.3831-1.3348.2379-1.7144-.3289zm7.8393 7.6018a.8815.8815 0 0 1-.258.6227l-2.1277 2.1277a.8822.8822 0 0 1-.623.258H5.4772a.8822.8822 0 0 1-.623-.258l-2.1277-2.1277a.8815.8815 0 0 1-.258-.6227V5.4818a.8797.8797 0 0 1 .258-.6228l2.1277-2.1282a.8816.8816 0 0 1 .623-.2578h13.0456a.8816.8816 0 0 1 .623.2578l2.1277 2.1282a.8797.8797 0 0 1 .258.6228V18.519zm1.811-15.0835L20.5644.6577A2.2454 2.2454 0 0 0 18.9775 0H5.0207A2.2445 2.2445 0 0 0 3.433.658L.657 3.4359A2.2449 2.2449 0 0 0 0 5.0228v13.9547c0 .5953.2366 1.1667.6575 1.5872l2.778 2.7779c.421.421.9918.6573 1.5871.6573h13.9548a2.2448 2.2448 0 0 0 1.5872-.6573l2.7779-2.7779A2.2436 2.2436 0 0 0 24 18.9775V5.023a2.2451 2.2451 0 0 0-.6575-1.5875z"/></svg>