robotframework-testdoc 0.2.3__tar.gz → 0.2.6__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.
Potentially problematic release.
This version of robotframework-testdoc might be problematic. Click here for more details.
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/PKG-INFO +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/pyproject.toml +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/PKG-INFO +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/SOURCES.txt +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/cli.py +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/pathconverter.py +16 -4
- {robotframework_testdoc-0.2.3/src/testdoc/html_rendering → robotframework_testdoc-0.2.6/src/testdoc/html/rendering}/render.py +6 -6
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/templates/v2/jinja_template_03.html +1 -5
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/parser/modifier/sourceprefixmodifier.py +1 -1
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/parser/testcaseparser.py +16 -7
- robotframework_testdoc-0.2.6/src/testdoc/parser/testsuiteparser.py +148 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/testdoc.py +2 -2
- robotframework_testdoc-0.2.3/src/testdoc/parser/testsuiteparser.py +0 -74
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/.github/workflows/build.yml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/.github/workflows/release.yml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/.gitignore +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/LICENSE +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/README.md +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/config/config_with_colors.toml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/config/testdoc.toml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/config_pyproject/example_pyproject.toml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/test_cli.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/test_cli.robot +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/html_v1_common.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/html_v2_root.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/html_v2_suitefile.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/style_blue.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/style_dark.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/docs/style_robot.png +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/setup.cfg +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/dependency_links.txt +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/entry_points.txt +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/requires.txt +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/robotframework_testdoc.egg-info/top_level.txt +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/__init__.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/__main__.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/default.toml +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/cliargs.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/datetimeconverter.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/logger.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/toml_reader.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/images/robotframework.svg +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/templates/v1/jinja_template_01.html +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/templates/v1/jinja_template_02.html +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/themes/__init__.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/themes/theme_config.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/themes/themes.py +0 -0
- {robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/parser/modifier/suitefilemodifier.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robotframework-testdoc"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.6"
|
|
8
8
|
description = "A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -32,13 +32,13 @@ src/testdoc/helper/logger.py
|
|
|
32
32
|
src/testdoc/helper/pathconverter.py
|
|
33
33
|
src/testdoc/helper/toml_reader.py
|
|
34
34
|
src/testdoc/html/images/robotframework.svg
|
|
35
|
+
src/testdoc/html/rendering/render.py
|
|
35
36
|
src/testdoc/html/templates/v1/jinja_template_01.html
|
|
36
37
|
src/testdoc/html/templates/v1/jinja_template_02.html
|
|
37
38
|
src/testdoc/html/templates/v2/jinja_template_03.html
|
|
38
39
|
src/testdoc/html/themes/__init__.py
|
|
39
40
|
src/testdoc/html/themes/theme_config.py
|
|
40
41
|
src/testdoc/html/themes/themes.py
|
|
41
|
-
src/testdoc/html_rendering/render.py
|
|
42
42
|
src/testdoc/parser/testcaseparser.py
|
|
43
43
|
src/testdoc/parser/testsuiteparser.py
|
|
44
44
|
src/testdoc/parser/modifier/sourceprefixmodifier.py
|
|
@@ -25,7 +25,7 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
|
|
|
25
25
|
@click.option("-c", "--configfile", required=False, help="Optional .toml configuration file (includes all cmd-args)")
|
|
26
26
|
@click.option("-v", "--verbose", is_flag=True, required=False, help="More precise debugging into shell")
|
|
27
27
|
@click.version_option(package_name='robotframework-testdoc')
|
|
28
|
-
@click.argument("PATH")
|
|
28
|
+
@click.argument("PATH", nargs=-1, required=True)
|
|
29
29
|
@click.argument("OUTPUT")
|
|
30
30
|
def main(
|
|
31
31
|
title,
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/pathconverter.py
RENAMED
|
@@ -15,11 +15,13 @@ class PathConverter():
|
|
|
15
15
|
config_path = self.args.config_file
|
|
16
16
|
|
|
17
17
|
# Convert path to suite file / directory
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
21
23
|
else:
|
|
22
|
-
|
|
24
|
+
suite_path = PathConverter().conv_generic_path(path=suite_path)
|
|
23
25
|
|
|
24
26
|
# Convert path to output file
|
|
25
27
|
output_path = PathConverter().conv_generic_path(path=output_path)
|
|
@@ -30,6 +32,16 @@ class PathConverter():
|
|
|
30
32
|
|
|
31
33
|
# Print to console
|
|
32
34
|
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
|
+
|
|
33
45
|
Logger().Log("=== TestDoc ===")
|
|
34
46
|
Logger().LogKeyValue("Generating Test Documentation for: ", msg)
|
|
35
47
|
Logger().LogKeyValue("Saving to output file: ", output_path)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from jinja2 import Environment, FileSystemLoader
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
4
|
+
from ...html.themes.theme_config import ThemeConfig
|
|
5
|
+
from ...helper.cliargs import CommandLineArguments
|
|
6
|
+
from ...helper.datetimeconverter import DateTimeConverter
|
|
7
|
+
from ...helper.logger import Logger
|
|
8
8
|
|
|
9
9
|
class TestDocHtmlRendering():
|
|
10
10
|
|
|
@@ -17,11 +17,11 @@ class TestDocHtmlRendering():
|
|
|
17
17
|
if self.args.html_template == "v1":
|
|
18
18
|
self.HTML_TEMPLATE_VERSION = self.args.html_template
|
|
19
19
|
self.HTML_TEMPLATE_NAME = "jinja_template_01.html"
|
|
20
|
-
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "
|
|
20
|
+
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates", self.HTML_TEMPLATE_VERSION)
|
|
21
21
|
elif self.args.html_template == "v2":
|
|
22
22
|
self.HTML_TEMPLATE_VERSION = self.args.html_template
|
|
23
23
|
self.HTML_TEMPLATE_NAME = "jinja_template_03.html"
|
|
24
|
-
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "
|
|
24
|
+
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates", self.HTML_TEMPLATE_VERSION)
|
|
25
25
|
else:
|
|
26
26
|
raise ValueError(f"CLI Argument 'html_template' got value '{self.args.html_template}' - value not known!")
|
|
27
27
|
|
|
@@ -77,11 +77,7 @@
|
|
|
77
77
|
<tr>
|
|
78
78
|
<td style="width: 10%; font-weight: bold;">🏷 Tags:</td>
|
|
79
79
|
<td style="text-align: left;">
|
|
80
|
-
{
|
|
81
|
-
{{ test.tags }}
|
|
82
|
-
{% else %}
|
|
83
|
-
{{ test.tags | join(', ') }}
|
|
84
|
-
{% endif %}
|
|
80
|
+
{{ test.tags | join(', ') }}
|
|
85
81
|
</td>
|
|
86
82
|
</tr>
|
|
87
83
|
{% endif %}
|
|
@@ -85,7 +85,7 @@ class GitLabModifier():
|
|
|
85
85
|
git_root = self._get_git_root(file_path)
|
|
86
86
|
git_branch = self._get_git_branch(git_root)
|
|
87
87
|
if not git_root:
|
|
88
|
-
return "
|
|
88
|
+
return "Unable to fetch GitLab URL!"
|
|
89
89
|
rel_path = os.path.relpath(file_path, git_root).replace(os.sep, "/")
|
|
90
90
|
return prefix.rstrip("/") + "/-/blob/" + git_branch + "/" + rel_path
|
|
91
91
|
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/parser/testcaseparser.py
RENAMED
|
@@ -19,7 +19,7 @@ class TestCaseParser():
|
|
|
19
19
|
"name": test.name,
|
|
20
20
|
"doc": "<br>".join(line.replace("\\n","") for line in test.doc.splitlines()
|
|
21
21
|
if line.strip()) if test.doc else "No Test Case Documentation Available",
|
|
22
|
-
"tags": test.tags if test.tags else "No Tags Configured",
|
|
22
|
+
"tags": test.tags if test.tags else ["No Tags Configured"],
|
|
23
23
|
"source": str(test.source),
|
|
24
24
|
"keywords": self._keyword_parser(test.body)
|
|
25
25
|
}
|
|
@@ -47,7 +47,7 @@ class TestCaseParser():
|
|
|
47
47
|
|
|
48
48
|
# Fallback in case of no keywords
|
|
49
49
|
if len(_keyword_object) == 0:
|
|
50
|
-
return "No Keyword Calls in Test"
|
|
50
|
+
return ["No Keyword Calls in Test"]
|
|
51
51
|
return _keyword_object
|
|
52
52
|
|
|
53
53
|
def _handle_keyword_types(self, kw: Keyword, indent: int = 0):
|
|
@@ -105,6 +105,19 @@ class TestCaseParser():
|
|
|
105
105
|
result.extend(self._handle_keyword_types(subkw, indent=indent+1))
|
|
106
106
|
result.append(f"{_indent}END")
|
|
107
107
|
|
|
108
|
+
# GROUP loop
|
|
109
|
+
elif kw_type == "GROUP":
|
|
110
|
+
header = f"{_indent}GROUP"
|
|
111
|
+
if not kw.name == "":
|
|
112
|
+
header += f"{_sd}{kw.name}"
|
|
113
|
+
if hasattr(kw, 'condition') and kw.condition:
|
|
114
|
+
header += f" {kw.condition}"
|
|
115
|
+
result.append(header)
|
|
116
|
+
if hasattr(kw, 'body'):
|
|
117
|
+
for subkw in kw.body:
|
|
118
|
+
result.extend(self._handle_keyword_types(subkw, indent=indent+1))
|
|
119
|
+
result.append(f"{_indent}END")
|
|
120
|
+
|
|
108
121
|
# WHILE loop
|
|
109
122
|
elif kw_type == "WHILE":
|
|
110
123
|
header = f"{_indent}WHILE"
|
|
@@ -134,13 +147,9 @@ class TestCaseParser():
|
|
|
134
147
|
elif kw_type in ("BREAK", "CONTINUE", "RETURN", "ERROR"):
|
|
135
148
|
entry = f"{_indent}{kw_type}"
|
|
136
149
|
if hasattr(kw, 'values') and kw.values:
|
|
137
|
-
entry += f" {
|
|
150
|
+
entry += f" {_sd.join(kw.values)}"
|
|
138
151
|
result.append(entry)
|
|
139
152
|
|
|
140
|
-
# Other types
|
|
141
|
-
elif kw_type in ("COMMENT", "EMPTY"):
|
|
142
|
-
pass
|
|
143
|
-
|
|
144
153
|
# Unknown types
|
|
145
154
|
elif hasattr(kw, 'body'):
|
|
146
155
|
for subkw in kw.body:
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Portions of this file are derived from Robot Framework, licensed under the Apache License 2.0.
|
|
2
|
+
# Derived code: see class `RobotSuiteFiltering`.
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from robot.api import SuiteVisitor, TestSuite
|
|
7
|
+
from .testcaseparser import TestCaseParser
|
|
8
|
+
from .modifier.suitefilemodifier import SuiteFileModifier
|
|
9
|
+
from ..helper.cliargs import CommandLineArguments
|
|
10
|
+
from..helper.pathconverter import PathConverter
|
|
11
|
+
|
|
12
|
+
from robot.conf import RobotSettings
|
|
13
|
+
from robot.running import TestSuiteBuilder
|
|
14
|
+
from robot.testdoc import USAGE
|
|
15
|
+
from robot.utils import (
|
|
16
|
+
abspath, Application, is_list_like
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
class RobotSuiteParser(SuiteVisitor):
|
|
20
|
+
def __init__(self):
|
|
21
|
+
self.suite_counter = 0
|
|
22
|
+
self.suites = []
|
|
23
|
+
self.tests = []
|
|
24
|
+
self.args = CommandLineArguments().data
|
|
25
|
+
|
|
26
|
+
def visit_suite(self, suite):
|
|
27
|
+
|
|
28
|
+
# Skip suite if its already parsed into list
|
|
29
|
+
self._already_parsed(suite)
|
|
30
|
+
|
|
31
|
+
# Test Suite Parser
|
|
32
|
+
suite_info = {
|
|
33
|
+
"id": str(suite.longname).lower().replace(".", "_").replace(" ", "_"),
|
|
34
|
+
"filename": str(Path(suite.source).name) if suite.source else suite.name,
|
|
35
|
+
"name": suite.name,
|
|
36
|
+
"doc": "<br>".join(line.replace("\\n","") for line in suite.doc.splitlines() if line.strip()) if suite.doc else None,
|
|
37
|
+
"is_folder": self._is_directory(suite),
|
|
38
|
+
"num_tests": len(suite.tests),
|
|
39
|
+
"source": str(suite.source),
|
|
40
|
+
"total_tests": 0,
|
|
41
|
+
"tests": [],
|
|
42
|
+
"sub_suites": [],
|
|
43
|
+
"metadata": "<br>".join([f"{k}: {v}" for k, v in suite.metadata.items()]) if suite.metadata else None
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Parse Test Cases
|
|
47
|
+
suite_info = TestCaseParser().parse_test(suite, suite_info)
|
|
48
|
+
|
|
49
|
+
# Collect sub-suites recursive
|
|
50
|
+
suite_info, total_tests = self._recursive_sub_suite(suite, suite_info)
|
|
51
|
+
|
|
52
|
+
# Append to suites object
|
|
53
|
+
suite_info["total_tests"] = total_tests
|
|
54
|
+
self.suites.append(suite_info)
|
|
55
|
+
|
|
56
|
+
def parse_suite(self):
|
|
57
|
+
# Use official Robot Framework Application Package to parse cli arguments and modify suite object.
|
|
58
|
+
robot_options = self._convert_args()
|
|
59
|
+
_rfs = RobotSuiteFiltering()
|
|
60
|
+
_rfs.execute_cli(robot_options, False)
|
|
61
|
+
suite = _rfs._suite_object
|
|
62
|
+
|
|
63
|
+
# Custom suite object modification with new test doc library
|
|
64
|
+
suite = SuiteFileModifier()._modify_root_suite_details(suite)
|
|
65
|
+
suite.visit(self)
|
|
66
|
+
return self.suites
|
|
67
|
+
|
|
68
|
+
##############################################################################################
|
|
69
|
+
# Helper:
|
|
70
|
+
##############################################################################################
|
|
71
|
+
|
|
72
|
+
def _recursive_sub_suite(self,
|
|
73
|
+
suite: TestSuite,
|
|
74
|
+
suite_info: dict
|
|
75
|
+
):
|
|
76
|
+
total_tests = suite_info["num_tests"]
|
|
77
|
+
for sub_suite in suite.suites:
|
|
78
|
+
sub_parser = RobotSuiteParser()
|
|
79
|
+
sub_parser.visit_suite(sub_suite)
|
|
80
|
+
suite_info["sub_suites"].extend(sub_parser.suites)
|
|
81
|
+
total_tests += sum(s["total_tests"] for s in sub_parser.suites)
|
|
82
|
+
return suite_info, total_tests
|
|
83
|
+
|
|
84
|
+
def _is_directory(self, suite) -> bool:
|
|
85
|
+
suite_path = suite.source if suite.source else ""
|
|
86
|
+
return(os.path.isdir(suite_path) if suite_path else False)
|
|
87
|
+
|
|
88
|
+
def _already_parsed(self, suite):
|
|
89
|
+
existing_suite = next((s for s in self.suites if s["name"] == suite.name), None)
|
|
90
|
+
if existing_suite:
|
|
91
|
+
return
|
|
92
|
+
|
|
93
|
+
def _convert_args(self):
|
|
94
|
+
""" Convert given cli args to match internal robotframework syntax """
|
|
95
|
+
_include = self.args.include
|
|
96
|
+
_exclude = self.args.exclude
|
|
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
|
+
|
|
106
|
+
# Format / Syntax Conversions
|
|
107
|
+
robot_options = []
|
|
108
|
+
for item in _include:
|
|
109
|
+
robot_options.append("-i")
|
|
110
|
+
robot_options.append(f"{item}")
|
|
111
|
+
for item in _exclude:
|
|
112
|
+
robot_options.append("-e")
|
|
113
|
+
robot_options.append(f"{item}")
|
|
114
|
+
for item in _source:
|
|
115
|
+
_os_indep_path = PathConverter().conv_generic_path(item)
|
|
116
|
+
robot_options.append(f"{_os_indep_path}")
|
|
117
|
+
robot_options.append(self.args.output_file)
|
|
118
|
+
return robot_options
|
|
119
|
+
|
|
120
|
+
class RobotSuiteFiltering(Application):
|
|
121
|
+
""" Use official RF Application package to build test suite object with given cli options & arguments """
|
|
122
|
+
OPTIONS = """
|
|
123
|
+
Options
|
|
124
|
+
=======
|
|
125
|
+
NOT SUPPORTED YET: -T --title title Set the title of the generated documentation.
|
|
126
|
+
Underscores in the title are converted to spaces.
|
|
127
|
+
The default title is the name of the top level suite.
|
|
128
|
+
NOT SUPPORTED YET: -N --name name Override the name of the top level suite.
|
|
129
|
+
NOT SUPPORTED YET: -D --doc document Override the documentation of the top level suite.
|
|
130
|
+
NOT SUPPORTED YET: -M --metadata name:value * Set/override metadata of the top level suite.
|
|
131
|
+
NOT SUPPORTED YET: -G --settag tag * Set given tag(s) to all test cases.
|
|
132
|
+
NOT SUPPORTED YET: -t --test name * Include tests by name.
|
|
133
|
+
NOT SUPPORTED YET: -s --suite name * Include suites by name.
|
|
134
|
+
-i --include tag * Include tests by tags.
|
|
135
|
+
-e --exclude tag * Exclude tests by tags.
|
|
136
|
+
"""
|
|
137
|
+
def __init__(self):
|
|
138
|
+
self._suite_object = None
|
|
139
|
+
Application.__init__(self, USAGE, arg_limits=(2,))
|
|
140
|
+
|
|
141
|
+
def main(self, datasources, title=None, **options):
|
|
142
|
+
abspath(datasources.pop())
|
|
143
|
+
settings = RobotSettings(options)
|
|
144
|
+
if not is_list_like(datasources):
|
|
145
|
+
datasources = [datasources]
|
|
146
|
+
suite = TestSuiteBuilder(process_curdir=False).build(*datasources)
|
|
147
|
+
suite.configure(**settings.suite_config)
|
|
148
|
+
self._suite_object = suite
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .helper.pathconverter import PathConverter
|
|
2
2
|
from .parser.testsuiteparser import RobotSuiteParser
|
|
3
|
-
from .
|
|
3
|
+
from .html.rendering.render import TestDocHtmlRendering
|
|
4
4
|
from .parser.modifier.suitefilemodifier import SuiteFileModifier
|
|
5
5
|
|
|
6
6
|
class TestDoc():
|
|
@@ -10,7 +10,7 @@ class TestDoc():
|
|
|
10
10
|
suite_path, output_path, config_path = PathConverter().path_convertion()
|
|
11
11
|
|
|
12
12
|
# Parse suite object & return complete suite object with all information
|
|
13
|
-
suite_object = RobotSuiteParser().parse_suite(
|
|
13
|
+
suite_object = RobotSuiteParser().parse_suite()
|
|
14
14
|
|
|
15
15
|
# Run SuiteFileModifier to modify the test suite object
|
|
16
16
|
suite_object = SuiteFileModifier().run(suite_object)
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
from robot.api import SuiteVisitor, TestSuite
|
|
5
|
-
from .testcaseparser import TestCaseParser
|
|
6
|
-
from .modifier.suitefilemodifier import SuiteFileModifier
|
|
7
|
-
|
|
8
|
-
class RobotSuiteParser(SuiteVisitor):
|
|
9
|
-
def __init__(self):
|
|
10
|
-
self.suite_counter = 0
|
|
11
|
-
self.suites = []
|
|
12
|
-
self.tests = []
|
|
13
|
-
|
|
14
|
-
def visit_suite(self, suite):
|
|
15
|
-
|
|
16
|
-
# Skip suite if its already parsed into list
|
|
17
|
-
self._already_parsed(suite)
|
|
18
|
-
|
|
19
|
-
# Test Suite Parser
|
|
20
|
-
suite_info = {
|
|
21
|
-
"id": str(suite.longname).lower().replace(".", "_").replace(" ", "_"),
|
|
22
|
-
"filename": str(Path(suite.source).name),
|
|
23
|
-
"name": suite.name,
|
|
24
|
-
"doc": "<br>".join(line.replace("\\n","") for line in suite.doc.splitlines() if line.strip()) if suite.doc else None,
|
|
25
|
-
"is_folder": self._is_directory(suite),
|
|
26
|
-
"num_tests": len(suite.tests),
|
|
27
|
-
"source": str(suite.source),
|
|
28
|
-
"total_tests": 0,
|
|
29
|
-
"tests": [],
|
|
30
|
-
"sub_suites": [],
|
|
31
|
-
"metadata": "<br>".join([f"{k}: {v}" for k, v in suite.metadata.items()]) if suite.metadata else None
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# Parse Test Cases
|
|
35
|
-
suite_info = TestCaseParser().parse_test(suite, suite_info)
|
|
36
|
-
|
|
37
|
-
# Collect sub-suites recursive
|
|
38
|
-
suite_info, total_tests = self._recursive_sub_suite(suite, suite_info)
|
|
39
|
-
|
|
40
|
-
# Append to suites object
|
|
41
|
-
suite_info["total_tests"] = total_tests
|
|
42
|
-
self.suites.append(suite_info)
|
|
43
|
-
|
|
44
|
-
def parse_suite(self, suite_path):
|
|
45
|
-
suite = TestSuite.from_file_system(suite_path)
|
|
46
|
-
suite = TestCaseParser().consider_tags(suite)
|
|
47
|
-
suite = SuiteFileModifier()._modify_root_suite_details(suite)
|
|
48
|
-
suite.visit(self)
|
|
49
|
-
return self.suites
|
|
50
|
-
|
|
51
|
-
##############################################################################################
|
|
52
|
-
# Helper:
|
|
53
|
-
##############################################################################################
|
|
54
|
-
|
|
55
|
-
def _recursive_sub_suite(self,
|
|
56
|
-
suite: TestSuite,
|
|
57
|
-
suite_info: dict
|
|
58
|
-
):
|
|
59
|
-
total_tests = suite_info["num_tests"]
|
|
60
|
-
for sub_suite in suite.suites:
|
|
61
|
-
sub_parser = RobotSuiteParser()
|
|
62
|
-
sub_parser.visit_suite(sub_suite)
|
|
63
|
-
suite_info["sub_suites"].extend(sub_parser.suites)
|
|
64
|
-
total_tests += sum(s["total_tests"] for s in sub_parser.suites)
|
|
65
|
-
return suite_info, total_tests
|
|
66
|
-
|
|
67
|
-
def _is_directory(self, suite) -> bool:
|
|
68
|
-
suite_path = suite.source if suite.source else ""
|
|
69
|
-
return(os.path.isdir(suite_path) if suite_path else False)
|
|
70
|
-
|
|
71
|
-
def _already_parsed(self, suite):
|
|
72
|
-
existing_suite = next((s for s in self.suites if s["name"] == suite.name), None)
|
|
73
|
-
if existing_suite:
|
|
74
|
-
return
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/atest/config/config_with_colors.toml
RENAMED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/helper/toml_reader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/themes/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.3 → robotframework_testdoc-0.2.6}/src/testdoc/html/themes/themes.py
RENAMED
|
File without changes
|
|
File without changes
|