robotframework-testdoc 0.2.6__py3-none-any.whl → 0.2.7__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.
- {robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/METADATA +55 -4
- robotframework_testdoc-0.2.7.dist-info/RECORD +28 -0
- testdoc/cli.py +34 -33
- testdoc/default.toml +1 -1
- testdoc/helper/cliargs.py +91 -74
- testdoc/helper/pathconverter.py +3 -35
- testdoc/helper/toml_reader.py +40 -1
- testdoc/html/rendering/render.py +1 -1
- testdoc/html/themes/theme_config.py +6 -2
- testdoc/html/themes/themes.py +24 -2
- testdoc/parser/modifier/sourceprefixmodifier.py +1 -1
- testdoc/parser/modifier/suitefilemodifier.py +1 -1
- testdoc/parser/testcaseparser.py +1 -1
- testdoc/parser/testsuiteparser.py +1 -8
- testdoc/testdoc.py +2 -5
- robotframework_testdoc-0.2.6.dist-info/RECORD +0 -28
- {robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/WHEEL +0 -0
- {robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/entry_points.txt +0 -0
- {robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/licenses/LICENSE +0 -0
- {robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-testdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts.
|
|
5
5
|
Author-email: Marvin Klerx <marvinklerx20@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -118,6 +118,51 @@ For using this config file, just call the following command:
|
|
|
118
118
|
testdoc -c path/to/config.toml tests/ TestDocumentation.html
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### pyproject.toml vs. custom toml file
|
|
122
|
+
|
|
123
|
+
Using the ``pyproject`` requires to define the ``testdoc`` sections with the prefix ``tool.``
|
|
124
|
+
Example section start: ``[tool.testdoc]``
|
|
125
|
+
|
|
126
|
+
Using your own custom toml-file, does not require you to use the prefix. Here, you can just use ``[testdoc]`` as section header.
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Example Configuration File
|
|
130
|
+
```toml
|
|
131
|
+
[tool.testdoc]
|
|
132
|
+
title = "New title of HTML document"
|
|
133
|
+
name = "New name of root suite element"
|
|
134
|
+
doc = "New doc text of root suite element"
|
|
135
|
+
sourceprefix = "gitlab::https://gitlab.com/myrepo/repo_path"
|
|
136
|
+
include = ["TagA", "TagB"]
|
|
137
|
+
exclude = ["TagC"]
|
|
138
|
+
hide_tags = true
|
|
139
|
+
hide_test_doc = true
|
|
140
|
+
hide_suite_doc = true
|
|
141
|
+
hide_source = true
|
|
142
|
+
hide_keywords = true
|
|
143
|
+
style = "blue"
|
|
144
|
+
verbose_mode = false
|
|
145
|
+
|
|
146
|
+
[tool.testdoc.metadata]
|
|
147
|
+
Author = "Your-Name"
|
|
148
|
+
Version = "1.0.0"
|
|
149
|
+
Source = "AnySourceAsMetaData"
|
|
150
|
+
|
|
151
|
+
[tool.testdoc.colors]
|
|
152
|
+
# Use predefined theme:
|
|
153
|
+
default = "blue"
|
|
154
|
+
# OR
|
|
155
|
+
# Use custom colors:
|
|
156
|
+
background = "#000028"
|
|
157
|
+
inner_color = "#000028"
|
|
158
|
+
button_active_color = "#193966"
|
|
159
|
+
button_hover_color = "#193966"
|
|
160
|
+
border_color = "#CCCCCC"
|
|
161
|
+
text_color = "#CCCCCC"
|
|
162
|
+
title_color = "#00ffb9"
|
|
163
|
+
robot_icon = "#00ffb9"
|
|
164
|
+
```
|
|
165
|
+
|
|
121
166
|
## HTML Template Selection
|
|
122
167
|
|
|
123
168
|
You can choose between multiple HTML template for the design of your test documentation.
|
|
@@ -165,15 +210,21 @@ Therefore, please use the following syntax: for the toml file
|
|
|
165
210
|
# Use the default theme
|
|
166
211
|
default = "default"
|
|
167
212
|
default = 0
|
|
168
|
-
# Use the
|
|
213
|
+
# Use the dark theme
|
|
169
214
|
default = "dark"
|
|
170
215
|
default = 1
|
|
171
|
-
# Use the
|
|
216
|
+
# Use the blue theme
|
|
172
217
|
default = "blue"
|
|
173
218
|
default = 2
|
|
174
|
-
# Use the
|
|
219
|
+
# Use the robot theme
|
|
175
220
|
default = "robot"
|
|
176
221
|
default = 3
|
|
222
|
+
# Use the dark robot theme
|
|
223
|
+
default = "robot_dark"
|
|
224
|
+
default = 4
|
|
225
|
+
# Use the green theme
|
|
226
|
+
default = "green"
|
|
227
|
+
default = 5
|
|
177
228
|
```
|
|
178
229
|
|
|
179
230
|
For setting it via CLI, please use the following:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
robotframework_testdoc-0.2.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
2
|
+
testdoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
testdoc/__main__.py,sha256=09c4nsw4Vnp1LaK0CnlofJQFbKmeFexOXyTBDY9NrFk,67
|
|
4
|
+
testdoc/cli.py,sha256=p2Ne3Fm9CwSk2YpfQnsj_xKM_UDw2wql_GR32tn3myM,4898
|
|
5
|
+
testdoc/default.toml,sha256=LDSW-RFTKhx4ZOmUkNswITUy_R4F9tiLjwhJWZ8R9R0,93
|
|
6
|
+
testdoc/testdoc.py,sha256=XC91wnOqeXZ_wLC8NczMbyuUWkFsBB6fX2Tbo2dzh0I,666
|
|
7
|
+
testdoc/helper/cliargs.py,sha256=UIaKhnX_goS-hRotYUl2dR1BDTU_5HLETkWvFw5J3h8,2526
|
|
8
|
+
testdoc/helper/datetimeconverter.py,sha256=1IuJ_rZlKKut3pallS9WSdlQ00YNQX2Nhf2oYWt7QDc,159
|
|
9
|
+
testdoc/helper/logger.py,sha256=STPEEdMIGpK004xHDskj8zzW3knBWP05GllYajQMaSY,272
|
|
10
|
+
testdoc/helper/pathconverter.py,sha256=yVxNE5-8dQQqhwEvA35whnhBSe_xPQxK8MwDKEmJfNk,840
|
|
11
|
+
testdoc/helper/toml_reader.py,sha256=z1Og6HG_g-wC8m3ael7FwQGayIxnobnl2GOYkQl8kHI,1543
|
|
12
|
+
testdoc/html/images/robotframework.svg,sha256=w1yNL6XtuHOCCwzjGX3pZQG7ZcJghzllvc7cQ9MKKbQ,1426
|
|
13
|
+
testdoc/html/rendering/render.py,sha256=KjHuymhFQETQmX6vLgUTWXH4QuH0zif6UGuNAJsagGM,1952
|
|
14
|
+
testdoc/html/templates/v1/jinja_template_01.html,sha256=H0CVKV3HljrdQeT_4hWJq3xNw6kc5vqiJtzCXoWBtdY,18389
|
|
15
|
+
testdoc/html/templates/v1/jinja_template_02.html,sha256=0CFAqCHQ035hsHgxZsirHgsdZO5-jdUH9SUQmy3EHkg,5152
|
|
16
|
+
testdoc/html/templates/v2/jinja_template_03.html,sha256=r0PJIgDp8oATZBp2hHD30djGZRMpSJA9GKuXa0HkCFc,15886
|
|
17
|
+
testdoc/html/themes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
testdoc/html/themes/theme_config.py,sha256=_DkCfP_ibr4vh8ppfEMNTEJGH8NrDDy9_lBKYbSuKAo,1679
|
|
19
|
+
testdoc/html/themes/themes.py,sha256=GuOOvUeczm5UiLLEdrigr0-ODcJ4Q2nZneW_9XleSxk,1640
|
|
20
|
+
testdoc/parser/testcaseparser.py,sha256=KVUOEd3E01B5dYQuV0vdpuVxwOvCRbMyhY1CtwFjAFQ,6830
|
|
21
|
+
testdoc/parser/testsuiteparser.py,sha256=ANbyfgaHdzjPpioTX2SDwq3F7qBnUda1MUCM5f1SOUs,5760
|
|
22
|
+
testdoc/parser/modifier/sourceprefixmodifier.py,sha256=Hg0fmpK9bnQB0uIm33VIkSh0RyayZfbLoI6ZwPnpfpk,3959
|
|
23
|
+
testdoc/parser/modifier/suitefilemodifier.py,sha256=bKTry7StKhT_foOWQKE_oApUA6f8kBEmT7D8zWXFHPI,4860
|
|
24
|
+
robotframework_testdoc-0.2.7.dist-info/METADATA,sha256=VmJKDtc4p0Ht1SeBbCjhryTu0dxlUJgG_vvMUgnxZd8,8177
|
|
25
|
+
robotframework_testdoc-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
robotframework_testdoc-0.2.7.dist-info/entry_points.txt,sha256=BUHy23mdlGCqYOWpsvRhSb1c0tPMzIwyTwr-sHI6xUs,45
|
|
27
|
+
robotframework_testdoc-0.2.7.dist-info/top_level.txt,sha256=p1axpYooAmdwwXQOzFsSXF3u_-88QFKCDxPf67siv3Y,8
|
|
28
|
+
robotframework_testdoc-0.2.7.dist-info/RECORD,,
|
testdoc/cli.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import click
|
|
2
|
-
import os
|
|
3
2
|
|
|
4
3
|
from .testdoc import TestDoc
|
|
5
4
|
from .helper.cliargs import CommandLineArguments
|
|
@@ -47,8 +46,12 @@ def main(
|
|
|
47
46
|
path,
|
|
48
47
|
output,
|
|
49
48
|
):
|
|
50
|
-
"""
|
|
51
|
-
|
|
49
|
+
"""Welcome to robotframework-testdoc - the new test documentation generator for your Robot Framework tests!
|
|
50
|
+
|
|
51
|
+
# Basic Usage:
|
|
52
|
+
$ testdoc tests/ TestDocumentation.html
|
|
53
|
+
|
|
54
|
+
See more in the README.md of the GitHub Project: https://github.com/MarvKler/robotframework-testdoc/blob/main/README.md
|
|
52
55
|
"""
|
|
53
56
|
color = "green"
|
|
54
57
|
entrypoint_msg = """
|
|
@@ -62,38 +65,36 @@ def main(
|
|
|
62
65
|
click.echo(click.style(entrypoint_msg, fg=color)
|
|
63
66
|
)
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
|
|
68
|
+
args_to_set = dict(
|
|
69
|
+
title=title,
|
|
70
|
+
name=name,
|
|
71
|
+
doc=doc,
|
|
72
|
+
metadata=dict(item.split("=", 1) for item in metadata) if metadata else None,
|
|
73
|
+
sourceprefix=sourceprefix,
|
|
74
|
+
include=list(include),
|
|
75
|
+
exclude=list(exclude),
|
|
76
|
+
hide_tags=hide_tags,
|
|
77
|
+
hide_test_doc=hide_test_doc,
|
|
78
|
+
hide_suite_doc=hide_suite_doc,
|
|
79
|
+
hide_source=hide_source,
|
|
80
|
+
hide_keywords=hide_keywords,
|
|
81
|
+
style=style,
|
|
82
|
+
html_template=html_template,
|
|
83
|
+
config_file=configfile,
|
|
84
|
+
verbose_mode=verbose,
|
|
85
|
+
suite_file=list(path),
|
|
86
|
+
output_file=output,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Expose CLI args
|
|
90
|
+
args_to_set = {k: v for k, v in args_to_set.items() if v is not None}
|
|
91
|
+
CommandLineArguments().set_args(**args_to_set)
|
|
71
92
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"doc": doc or None,
|
|
77
|
-
"metadata": dict(item.split("=", 1) for item in metadata) if metadata else None,
|
|
78
|
-
"sourceprefix": sourceprefix,
|
|
79
|
-
"include": list(include) if include else None,
|
|
80
|
-
"exclude": list(exclude) if exclude else None,
|
|
81
|
-
"hide_tags": hide_tags or None,
|
|
82
|
-
"hide_test_doc": hide_test_doc or None,
|
|
83
|
-
"hide_suite_doc": hide_suite_doc or None,
|
|
84
|
-
"hide_source": hide_source or None,
|
|
85
|
-
"hide_keywords": hide_keywords or None,
|
|
86
|
-
"verbose_mode": verbose or None,
|
|
87
|
-
"style": style or None,
|
|
88
|
-
"html_template": html_template or None,
|
|
89
|
-
"config_file": configfile or None,
|
|
90
|
-
}
|
|
91
|
-
args.suite_file = path
|
|
92
|
-
args.output_file = output
|
|
93
|
+
# Read & expose TOML args
|
|
94
|
+
if configfile:
|
|
95
|
+
from .helper.toml_reader import TOMLReader
|
|
96
|
+
TOMLReader().load_from_config_file(configfile)
|
|
93
97
|
|
|
94
|
-
for key, value in cli_params.items():
|
|
95
|
-
if value is not None:
|
|
96
|
-
setattr(args, key, value)
|
|
97
98
|
TestDoc().main()
|
|
98
99
|
|
|
99
100
|
if __name__ == "__main__":
|
testdoc/default.toml
CHANGED
testdoc/helper/cliargs.py
CHANGED
|
@@ -1,83 +1,100 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
from typing import Any, List
|
|
3
|
-
from .toml_reader import TOMLReader
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class CommandLineArgumentsData:
|
|
8
|
-
title: str = "Robot Framework - Test Documentation"
|
|
9
|
-
name: str = None
|
|
10
|
-
doc: str = None
|
|
11
|
-
metadata: dict = None
|
|
12
|
-
sourceprefix: str = None
|
|
13
|
-
include: List[str] = field(default_factory=list)
|
|
14
|
-
exclude: List[str] = field(default_factory=list)
|
|
15
|
-
hide_tags: bool = False
|
|
16
|
-
hide_test_doc: bool = False
|
|
17
|
-
hide_suite_doc: bool = False
|
|
18
|
-
hide_source: bool = False
|
|
19
|
-
hide_keywords: bool = False
|
|
20
|
-
config_file: str = None
|
|
21
|
-
verbose_mode: bool = False
|
|
22
|
-
suite_file: str = None
|
|
23
|
-
style: str = None
|
|
24
|
-
html_template: str = "v2"
|
|
25
|
-
output_file: str = None
|
|
26
|
-
colors: dict = None
|
|
27
|
-
|
|
28
1
|
class CommandLineArguments:
|
|
29
2
|
_instance = None
|
|
30
3
|
def __new__(cls):
|
|
31
4
|
if cls._instance is None:
|
|
32
5
|
cls._instance = super().__new__(cls)
|
|
33
|
-
|
|
34
|
-
cls.data = CommandLineArgumentsData()
|
|
6
|
+
cls._instance._args = {}
|
|
35
7
|
return cls._instance
|
|
36
|
-
|
|
37
|
-
###
|
|
38
|
-
### Load configuration file
|
|
39
|
-
###
|
|
40
|
-
def load_from_config_file(self, file_path: str):
|
|
41
|
-
config = TOMLReader()._read_toml(file_path)
|
|
42
|
-
_is_pyproject = self._is_pyproject_config(file_path)
|
|
43
|
-
if _is_pyproject:
|
|
44
|
-
self._handle_pyproject_config(config)
|
|
45
|
-
else:
|
|
46
|
-
self._handle_custom_config(config)
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
### Read pyproject.toml
|
|
50
|
-
###
|
|
51
|
-
def _handle_pyproject_config(self, config: dict[str, Any]):
|
|
52
|
-
testdoc_config = config.get("tool", {}).get("testdoc", {})
|
|
53
|
-
|
|
54
|
-
if "colors" in testdoc_config:
|
|
55
|
-
self.data.colors = testdoc_config["colors"]
|
|
56
|
-
|
|
57
|
-
if "metadata" in testdoc_config:
|
|
58
|
-
if hasattr(self.data, "metadata"):
|
|
59
|
-
setattr(self.data, "metadata", testdoc_config["metadata"])
|
|
60
|
-
|
|
61
|
-
for key, value in testdoc_config.items():
|
|
62
|
-
if key in ("colors", "metadata"):
|
|
63
|
-
continue
|
|
64
|
-
if hasattr(self.data, key):
|
|
65
|
-
setattr(self.data, key, value)
|
|
66
|
-
|
|
67
|
-
###
|
|
68
|
-
### Read custom.toml
|
|
69
|
-
###
|
|
70
|
-
def _handle_custom_config(self, config: dict[str, Any]):
|
|
71
|
-
if "colors" in config:
|
|
72
|
-
self.data.colors = config["colors"]
|
|
73
8
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
9
|
+
def update_args_if_not_set(self, **kwargs):
|
|
10
|
+
for key, value in kwargs.items():
|
|
11
|
+
if key not in self._args:
|
|
12
|
+
self._args[key] = value
|
|
13
|
+
|
|
14
|
+
def set_args(self, **kwargs):
|
|
15
|
+
self._args = kwargs
|
|
79
16
|
|
|
80
|
-
def
|
|
81
|
-
|
|
17
|
+
def __getattr__(self, name):
|
|
18
|
+
if name in self._args:
|
|
19
|
+
return self._args[name]
|
|
20
|
+
raise AttributeError(f"'CommandLineArguments' object has no attribute '{name}'")
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def title(self):
|
|
24
|
+
return self._args.get("title", "Robot Framework - Test Documentation")
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def name(self):
|
|
28
|
+
return self._args.get("name", None)
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def doc(self):
|
|
32
|
+
return self._args.get("doc", None)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def metadata(self):
|
|
36
|
+
return self._args.get("metadata", None)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def sourceprefix(self):
|
|
40
|
+
return self._args.get("sourceprefix", None)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def include(self):
|
|
44
|
+
return self._args.get("include", [])
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def exclude(self):
|
|
48
|
+
return self._args.get("exclude", [])
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def hide_tags(self):
|
|
52
|
+
return self._args.get("hide_tags", False)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def hide_test_doc(self):
|
|
56
|
+
return self._args.get("hide_test_doc", False)
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def hide_suite_doc(self):
|
|
60
|
+
return self._args.get("hide_suite_doc", False)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def hide_source(self):
|
|
64
|
+
return self._args.get("hide_source", False)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def hide_keywords(self):
|
|
68
|
+
return self._args.get("hide_keywords", False)
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def config_file(self):
|
|
72
|
+
return self._args.get("config_file", None)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def verbose_mode(self):
|
|
76
|
+
return self._args.get("verbose_mode", False)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def suite_file(self):
|
|
80
|
+
return self._args.get("suite_file", None)
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def style(self):
|
|
84
|
+
return self._args.get("style", None)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def html_template(self):
|
|
88
|
+
return self._args.get("html_template", "v2")
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def output_file(self):
|
|
92
|
+
return self._args.get("output_file", None)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def colors(self):
|
|
96
|
+
return self._args.get("colors", None)
|
|
82
97
|
|
|
83
|
-
|
|
98
|
+
@property
|
|
99
|
+
def all_as_dict(self):
|
|
100
|
+
return self._args
|
testdoc/helper/pathconverter.py
CHANGED
|
@@ -6,48 +6,16 @@ from .logger import Logger
|
|
|
6
6
|
class PathConverter():
|
|
7
7
|
|
|
8
8
|
def __init__(self):
|
|
9
|
-
self.args = CommandLineArguments()
|
|
9
|
+
self.args = CommandLineArguments()
|
|
10
10
|
|
|
11
11
|
def path_convertion(self) -> str:
|
|
12
|
-
|
|
13
|
-
suite_path = self.args.suite_file
|
|
14
12
|
output_path = self.args.output_file
|
|
15
|
-
config_path = self.args.config_file
|
|
16
|
-
|
|
17
|
-
# Convert path to suite file / directory
|
|
18
|
-
if type(suite_path) is tuple:
|
|
19
|
-
suite_path = list(suite_path)
|
|
20
|
-
for idx, item in enumerate(suite_path):
|
|
21
|
-
_mod = PathConverter().conv_generic_path(item)
|
|
22
|
-
suite_path[idx] = _mod
|
|
23
|
-
else:
|
|
24
|
-
suite_path = PathConverter().conv_generic_path(path=suite_path)
|
|
25
|
-
|
|
26
|
-
# Convert path to output file
|
|
27
13
|
output_path = PathConverter().conv_generic_path(path=output_path)
|
|
28
|
-
|
|
29
|
-
# Convert path to config file
|
|
30
|
-
if self.args.config_file:
|
|
31
|
-
config_path = PathConverter().conv_generic_path(path=config_path)
|
|
32
|
-
|
|
14
|
+
|
|
33
15
|
# Print to console
|
|
34
16
|
if self.args.verbose_mode:
|
|
35
|
-
msg = ""
|
|
36
|
-
if type(suite_path) is not list:
|
|
37
|
-
suite_path = list(suite_path)
|
|
38
|
-
|
|
39
|
-
for item in suite_path:
|
|
40
|
-
if ".robot" in suite_path:
|
|
41
|
-
msg += f'Suite File: "{str(suite_path).split("/")[-1]}"\n'
|
|
42
|
-
else:
|
|
43
|
-
msg += f"Suite Directory: '{suite_path}'\n"
|
|
44
|
-
|
|
45
|
-
Logger().Log("=== TestDoc ===")
|
|
46
|
-
Logger().LogKeyValue("Generating Test Documentation for: ", msg)
|
|
47
17
|
Logger().LogKeyValue("Saving to output file: ", output_path)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return suite_path, output_path, config_path
|
|
18
|
+
return output_path
|
|
51
19
|
|
|
52
20
|
def conv_generic_path(self,
|
|
53
21
|
path: str
|
testdoc/helper/toml_reader.py
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
|
+
from .cliargs import CommandLineArguments
|
|
2
|
+
|
|
1
3
|
import tomli
|
|
4
|
+
import os
|
|
2
5
|
|
|
3
6
|
class TOMLReader():
|
|
4
7
|
|
|
8
|
+
###
|
|
9
|
+
### Generic function to read toml files
|
|
10
|
+
###
|
|
5
11
|
def _read_toml(self, file_path:str):
|
|
6
12
|
try:
|
|
7
13
|
with open(file_path, "rb") as f:
|
|
8
14
|
config = tomli.load(f)
|
|
9
15
|
return config
|
|
10
16
|
except Exception as e:
|
|
11
|
-
raise ImportError(f"Cannot read toml file in: {file_path} with error: \n{e}")
|
|
17
|
+
raise ImportError(f"Cannot read toml file in: {file_path} with error: \n{e}")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
###
|
|
21
|
+
### Functions to handle TOML files with configuration for testdoc tool
|
|
22
|
+
###
|
|
23
|
+
def load_from_config_file(self, file_path: str):
|
|
24
|
+
config = TOMLReader()._read_toml(file_path)
|
|
25
|
+
is_pyproject = self._is_pyproject_config(file_path)
|
|
26
|
+
|
|
27
|
+
if is_pyproject:
|
|
28
|
+
self._handle_pyproject_config(config)
|
|
29
|
+
else:
|
|
30
|
+
self._handle_custom_config(config)
|
|
31
|
+
|
|
32
|
+
def _handle_pyproject_config(self, config: dict):
|
|
33
|
+
testdoc_config = config.get("tool", {}).get("testdoc", {})
|
|
34
|
+
self._apply_config_to_cliargs(testdoc_config)
|
|
35
|
+
|
|
36
|
+
def _handle_custom_config(self, config: dict):
|
|
37
|
+
self._apply_config_to_cliargs(config)
|
|
38
|
+
|
|
39
|
+
def _apply_config_to_cliargs(self, config: dict):
|
|
40
|
+
args_to_set = {}
|
|
41
|
+
|
|
42
|
+
for key, value in config.items():
|
|
43
|
+
if isinstance(value, tuple):
|
|
44
|
+
value = list(value)
|
|
45
|
+
args_to_set[key] = value
|
|
46
|
+
|
|
47
|
+
CommandLineArguments().update_args_if_not_set(**args_to_set)
|
|
48
|
+
|
|
49
|
+
def _is_pyproject_config(self, file_path) -> bool:
|
|
50
|
+
return os.path.basename(file_path) == "pyproject.toml"
|
testdoc/html/rendering/render.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from ...helper.cliargs import CommandLineArguments
|
|
2
|
-
from .themes import DEFAULT_THEME, ROBOT_THEME, DARK_THEME, BLUE_THEME
|
|
2
|
+
from .themes import DEFAULT_THEME, ROBOT_THEME, DARK_THEME, BLUE_THEME, ROBOT_THEME_DARK, GREEN_THEME
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
5
|
import tomli
|
|
@@ -9,7 +9,7 @@ class ThemeConfig():
|
|
|
9
9
|
default_config = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "default.toml")
|
|
10
10
|
|
|
11
11
|
def __init__(self):
|
|
12
|
-
self.args = CommandLineArguments()
|
|
12
|
+
self.args = CommandLineArguments()
|
|
13
13
|
with open(self.default_config, "rb") as file:
|
|
14
14
|
self.config = tomli.load(file)
|
|
15
15
|
|
|
@@ -38,4 +38,8 @@ class ThemeConfig():
|
|
|
38
38
|
return ROBOT_THEME
|
|
39
39
|
if theme == "blue" or theme == 3:
|
|
40
40
|
return BLUE_THEME
|
|
41
|
+
if theme == "robot_dark" or theme == 4:
|
|
42
|
+
return ROBOT_THEME_DARK
|
|
43
|
+
if theme == "green" or theme == 5:
|
|
44
|
+
return GREEN_THEME
|
|
41
45
|
|
testdoc/html/themes/themes.py
CHANGED
|
@@ -13,14 +13,36 @@ DEFAULT_THEME = {
|
|
|
13
13
|
ROBOT_THEME = {
|
|
14
14
|
"background": "#f8f9fa",
|
|
15
15
|
"inner_color": "#f8f9fa",
|
|
16
|
-
"button_active_color": "#
|
|
17
|
-
"button_hover_color": "#
|
|
16
|
+
"button_active_color": "#dcdcdc",
|
|
17
|
+
"button_hover_color": "#dcdcdc",
|
|
18
18
|
"border_color": "black",
|
|
19
19
|
"text_color": "black",
|
|
20
20
|
"title_color": "black",
|
|
21
21
|
"robot_icon": "#00c0b5",
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
ROBOT_THEME_DARK = {
|
|
25
|
+
"background": "#1b1b1d",
|
|
26
|
+
"inner_color": "#1b1b1d",
|
|
27
|
+
"button_active_color": "#272729",
|
|
28
|
+
"button_hover_color": "#5F5F5F",
|
|
29
|
+
"border_color": "#e3e3e3",
|
|
30
|
+
"text_color": "#e3e3e3",
|
|
31
|
+
"title_color": "#e3e3e3",
|
|
32
|
+
"robot_icon": "#00c0b5",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
GREEN_THEME = {
|
|
36
|
+
"background": "#1e1e1e",
|
|
37
|
+
"inner_color": "#1e1e1e",
|
|
38
|
+
"button_active_color": "#272729",
|
|
39
|
+
"button_hover_color": "#5F5F5F",
|
|
40
|
+
"border_color": "#e3e3e3",
|
|
41
|
+
"text_color": "#009770",
|
|
42
|
+
"title_color": "#009770",
|
|
43
|
+
"robot_icon": "#009770",
|
|
44
|
+
}
|
|
45
|
+
|
|
24
46
|
DARK_THEME = {
|
|
25
47
|
"background": "#303030",
|
|
26
48
|
"inner_color": "#303030",
|
|
@@ -7,7 +7,7 @@ from .sourceprefixmodifier import SourcePrefixModifier
|
|
|
7
7
|
class SuiteFileModifier():
|
|
8
8
|
|
|
9
9
|
def __init__(self):
|
|
10
|
-
self.args = CommandLineArguments()
|
|
10
|
+
self.args = CommandLineArguments()
|
|
11
11
|
self.suite = None
|
|
12
12
|
|
|
13
13
|
#############################################################################################################################
|
testdoc/parser/testcaseparser.py
CHANGED
|
@@ -21,7 +21,7 @@ class RobotSuiteParser(SuiteVisitor):
|
|
|
21
21
|
self.suite_counter = 0
|
|
22
22
|
self.suites = []
|
|
23
23
|
self.tests = []
|
|
24
|
-
self.args = CommandLineArguments()
|
|
24
|
+
self.args = CommandLineArguments()
|
|
25
25
|
|
|
26
26
|
def visit_suite(self, suite):
|
|
27
27
|
|
|
@@ -95,13 +95,6 @@ class RobotSuiteParser(SuiteVisitor):
|
|
|
95
95
|
_include = self.args.include
|
|
96
96
|
_exclude = self.args.exclude
|
|
97
97
|
_source = self.args.suite_file
|
|
98
|
-
# Type Conversions
|
|
99
|
-
if type(_include) is not list:
|
|
100
|
-
_include = list(_include)
|
|
101
|
-
if type(_exclude) is not list:
|
|
102
|
-
_exclude = list(_exclude)
|
|
103
|
-
if type(_source) is not list:
|
|
104
|
-
_source = list(_source)
|
|
105
98
|
|
|
106
99
|
# Format / Syntax Conversions
|
|
107
100
|
robot_options = []
|
testdoc/testdoc.py
CHANGED
|
@@ -5,10 +5,7 @@ from .parser.modifier.suitefilemodifier import SuiteFileModifier
|
|
|
5
5
|
|
|
6
6
|
class TestDoc():
|
|
7
7
|
|
|
8
|
-
def main(self):
|
|
9
|
-
# Convert to correct pathes
|
|
10
|
-
suite_path, output_path, config_path = PathConverter().path_convertion()
|
|
11
|
-
|
|
8
|
+
def main(self):
|
|
12
9
|
# Parse suite object & return complete suite object with all information
|
|
13
10
|
suite_object = RobotSuiteParser().parse_suite()
|
|
14
11
|
|
|
@@ -16,4 +13,4 @@ class TestDoc():
|
|
|
16
13
|
suite_object = SuiteFileModifier().run(suite_object)
|
|
17
14
|
|
|
18
15
|
# Render HTML file
|
|
19
|
-
TestDocHtmlRendering().render_testdoc(suite_object,
|
|
16
|
+
TestDocHtmlRendering().render_testdoc(suite_object, PathConverter().path_convertion())
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
robotframework_testdoc-0.2.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
2
|
-
testdoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
testdoc/__main__.py,sha256=09c4nsw4Vnp1LaK0CnlofJQFbKmeFexOXyTBDY9NrFk,67
|
|
4
|
-
testdoc/cli.py,sha256=el9eqTr4MjxF91XancigF6U7nJ5ffSXw7Wnhna3OkW0,5027
|
|
5
|
-
testdoc/default.toml,sha256=PK7O2gat8326ZYOXBC1mt6-5ceBhdbgs0BL1uo4XLjQ,87
|
|
6
|
-
testdoc/testdoc.py,sha256=WpghXZ_frebqJ0BkP_5EM34bVfyLTaCr1z-lYbitS08,762
|
|
7
|
-
testdoc/helper/cliargs.py,sha256=nsgxXho8QAtcxF5B0OCriLuUEByGQwagDkvR7ISAGWA,2627
|
|
8
|
-
testdoc/helper/datetimeconverter.py,sha256=1IuJ_rZlKKut3pallS9WSdlQ00YNQX2Nhf2oYWt7QDc,159
|
|
9
|
-
testdoc/helper/logger.py,sha256=STPEEdMIGpK004xHDskj8zzW3knBWP05GllYajQMaSY,272
|
|
10
|
-
testdoc/helper/pathconverter.py,sha256=iY7VBofJxiQHevlLO_kek80mwmaB9gdnHWmUzHowCqk,2096
|
|
11
|
-
testdoc/helper/toml_reader.py,sha256=JUpCdUQAwS-zImH0fU9leziM8Mc9CXAAHFUs6E0eQRA,323
|
|
12
|
-
testdoc/html/images/robotframework.svg,sha256=w1yNL6XtuHOCCwzjGX3pZQG7ZcJghzllvc7cQ9MKKbQ,1426
|
|
13
|
-
testdoc/html/rendering/render.py,sha256=Q_zDQHPrr00tHlzEGdDuHV66jljbSFBIn3XuLgJKdPw,1957
|
|
14
|
-
testdoc/html/templates/v1/jinja_template_01.html,sha256=H0CVKV3HljrdQeT_4hWJq3xNw6kc5vqiJtzCXoWBtdY,18389
|
|
15
|
-
testdoc/html/templates/v1/jinja_template_02.html,sha256=0CFAqCHQ035hsHgxZsirHgsdZO5-jdUH9SUQmy3EHkg,5152
|
|
16
|
-
testdoc/html/templates/v2/jinja_template_03.html,sha256=r0PJIgDp8oATZBp2hHD30djGZRMpSJA9GKuXa0HkCFc,15886
|
|
17
|
-
testdoc/html/themes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
testdoc/html/themes/theme_config.py,sha256=3AFUSoddhAZswcEsshbvqcnmbLOFaBYUFy-lrfNBV3Q,1495
|
|
19
|
-
testdoc/html/themes/themes.py,sha256=6xlHW7O-XO9Z1B33_aRwzffkuWR65jM7CYXsZWUjdmY,1091
|
|
20
|
-
testdoc/parser/testcaseparser.py,sha256=tfaBfcz2t8Iiu558oDNCGQjQuWphbJTJlsInCTTTgFU,6835
|
|
21
|
-
testdoc/parser/testsuiteparser.py,sha256=7-t_Kdw6527x_bQ_IWJgrvUnGC2umK9mjjJToWVWC_k,6020
|
|
22
|
-
testdoc/parser/modifier/sourceprefixmodifier.py,sha256=uJTuF3KxtDt4m4nqJ9yF6NzdsjXUZGhRYsP9y9hqQ5k,3964
|
|
23
|
-
testdoc/parser/modifier/suitefilemodifier.py,sha256=OuDuleQj4dRjUcu0AROEPZ-2vR3lWJfWmQVuoWLkXuY,4865
|
|
24
|
-
robotframework_testdoc-0.2.6.dist-info/METADATA,sha256=HJPzhuHpUoO2EWXPhaxBnU1aKlyz_xXOffhZXcgj14A,6947
|
|
25
|
-
robotframework_testdoc-0.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
-
robotframework_testdoc-0.2.6.dist-info/entry_points.txt,sha256=BUHy23mdlGCqYOWpsvRhSb1c0tPMzIwyTwr-sHI6xUs,45
|
|
27
|
-
robotframework_testdoc-0.2.6.dist-info/top_level.txt,sha256=p1axpYooAmdwwXQOzFsSXF3u_-88QFKCDxPf67siv3Y,8
|
|
28
|
-
robotframework_testdoc-0.2.6.dist-info/RECORD,,
|
|
File without changes
|
{robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{robotframework_testdoc-0.2.6.dist-info → robotframework_testdoc-0.2.7.dist-info}/top_level.txt
RENAMED
|
File without changes
|