robotframework-testdoc 0.2.2__tar.gz → 0.2.4__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.2/.github/workflows/build-publish.yml → robotframework_testdoc-0.2.4/.github/workflows/build.yml +23 -13
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/.github/workflows/release.yml +9 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/PKG-INFO +13 -5
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/README.md +5 -3
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/pyproject.toml +12 -2
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/PKG-INFO +13 -5
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/SOURCES.txt +1 -1
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/cli.py +1 -1
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/pathconverter.py +16 -4
- robotframework_testdoc-0.2.4/src/testdoc/parser/testsuiteparser.py +148 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/testdoc.py +1 -1
- robotframework_testdoc-0.2.2/src/testdoc/parser/testsuiteparser.py +0 -74
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/.gitignore +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/LICENSE +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/atest/config/config_with_colors.toml +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/atest/config/testdoc.toml +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/atest/config_pyproject/example_pyproject.toml +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/atest/test_cli.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/atest/test_cli.robot +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/html_v1_common.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/html_v2_root.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/html_v2_suitefile.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/style_blue.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/style_dark.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/docs/style_robot.png +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/setup.cfg +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/dependency_links.txt +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/entry_points.txt +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/requires.txt +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/robotframework_testdoc.egg-info/top_level.txt +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/__init__.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/__main__.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/default.toml +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/cliargs.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/datetimeconverter.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/logger.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/toml_reader.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/images/robotframework.svg +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/templates/v1/jinja_template_01.html +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/templates/v1/jinja_template_02.html +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/templates/v2/jinja_template_03.html +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/themes/__init__.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/themes/theme_config.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/themes/themes.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html_rendering/render.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/parser/modifier/sourceprefixmodifier.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/parser/modifier/suitefilemodifier.py +0 -0
- {robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/parser/testcaseparser.py +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
name: Build Python Package
|
|
1
|
+
name: Build & Test Python Package
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
-
- '**'
|
|
8
7
|
tags-ignore:
|
|
9
8
|
- 'v*.*.*'
|
|
10
9
|
paths:
|
|
@@ -20,9 +19,8 @@ on:
|
|
|
20
19
|
- pyproject.toml
|
|
21
20
|
|
|
22
21
|
jobs:
|
|
23
|
-
|
|
22
|
+
code-quality:
|
|
24
23
|
runs-on: ubuntu-latest
|
|
25
|
-
|
|
26
24
|
steps:
|
|
27
25
|
- name: Checkout Repository
|
|
28
26
|
uses: actions/checkout@v3
|
|
@@ -40,9 +38,28 @@ jobs:
|
|
|
40
38
|
- name: Lint with Ruff
|
|
41
39
|
run: ruff check .
|
|
42
40
|
|
|
41
|
+
test-build:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
strategy:
|
|
44
|
+
matrix:
|
|
45
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
46
|
+
steps:
|
|
47
|
+
- name: Checkout Repository
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Set up Python
|
|
51
|
+
uses: actions/setup-python@v5
|
|
52
|
+
with:
|
|
53
|
+
python-version: ${{ matrix.python-version }}
|
|
54
|
+
|
|
55
|
+
- name: Install Build Dependencies
|
|
56
|
+
run: |
|
|
57
|
+
python -m pip install --upgrade pip
|
|
58
|
+
pip install build ruff pytest
|
|
59
|
+
|
|
43
60
|
- name: Build Package
|
|
44
61
|
run: python -m build
|
|
45
|
-
|
|
62
|
+
|
|
46
63
|
- name: Test CLI Command
|
|
47
64
|
run: |
|
|
48
65
|
pip install .
|
|
@@ -50,11 +67,4 @@ jobs:
|
|
|
50
67
|
|
|
51
68
|
- name: Run Unit Tests
|
|
52
69
|
run: pytest atest/
|
|
53
|
-
|
|
54
|
-
# - name: Publish to TestPyPI
|
|
55
|
-
# env:
|
|
56
|
-
# TWINE_USERNAME: __token__
|
|
57
|
-
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
58
|
-
# run: |
|
|
59
|
-
# pip install twine
|
|
60
|
-
# twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
|
70
|
+
|
|
@@ -53,3 +53,12 @@ jobs:
|
|
|
53
53
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
54
54
|
run: twine upload dist/*
|
|
55
55
|
|
|
56
|
+
# Backup:
|
|
57
|
+
# - name: Publish to TestPyPI
|
|
58
|
+
# env:
|
|
59
|
+
# TWINE_USERNAME: __token__
|
|
60
|
+
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
61
|
+
# run: |
|
|
62
|
+
# pip install twine
|
|
63
|
+
# twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
|
64
|
+
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-testdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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
|
-
License:
|
|
6
|
+
License: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/MarvKler/robotframework-testdoc
|
|
8
8
|
Project-URL: Issues, https://github.com/MarvKler/robotframework-testdoc/issues
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
15
|
Requires-Python: >=3.7
|
|
10
16
|
Description-Content-Type: text/markdown
|
|
11
17
|
License-File: LICENSE
|
|
@@ -23,9 +29,11 @@ Link to GitHub Project: [robotframework-testdoc](https://github.com/MarvKler/rob
|
|
|
23
29
|
|
|
24
30
|
## Statistics
|
|
25
31
|
|
|
26
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
27
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
33
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
34
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
35
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
36
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
29
37
|
|
|
30
38
|
## Installation
|
|
31
39
|
|
|
@@ -6,9 +6,11 @@ Link to GitHub Project: [robotframework-testdoc](https://github.com/MarvKler/rob
|
|
|
6
6
|
|
|
7
7
|
## Statistics
|
|
8
8
|
|
|
9
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
10
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
10
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
11
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
12
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
13
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
14
16
|
|
|
@@ -4,14 +4,24 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robotframework-testdoc"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.4"
|
|
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"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "Marvin Klerx", email = "marvinklerx20@gmail.com" }
|
|
13
13
|
]
|
|
14
|
-
license = { text = "
|
|
14
|
+
license = { text = "Apache-2.0" }
|
|
15
|
+
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Programming Language :: Python",
|
|
19
|
+
# "Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12"
|
|
24
|
+
]
|
|
15
25
|
|
|
16
26
|
dependencies = [
|
|
17
27
|
"click",
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-testdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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
|
-
License:
|
|
6
|
+
License: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/MarvKler/robotframework-testdoc
|
|
8
8
|
Project-URL: Issues, https://github.com/MarvKler/robotframework-testdoc/issues
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
15
|
Requires-Python: >=3.7
|
|
10
16
|
Description-Content-Type: text/markdown
|
|
11
17
|
License-File: LICENSE
|
|
@@ -23,9 +29,11 @@ Link to GitHub Project: [robotframework-testdoc](https://github.com/MarvKler/rob
|
|
|
23
29
|
|
|
24
30
|
## Statistics
|
|
25
31
|
|
|
26
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
27
|
-
[](https://github.com/MarvKler/robotframework-testdoc/actions/workflows/release.yml)
|
|
33
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
34
|
+
[](https://pypi.org/project/robotframework-testdoc)
|
|
35
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
36
|
+
[](https://pepy.tech/projects/robotframework-testdoc)
|
|
29
37
|
|
|
30
38
|
## Installation
|
|
31
39
|
|
|
@@ -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.2 → robotframework_testdoc-0.2.4}/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)
|
|
@@ -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
|
|
@@ -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
|
{robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/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.2 → robotframework_testdoc-0.2.4}/src/testdoc/helper/toml_reader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/themes/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html/themes/themes.py
RENAMED
|
File without changes
|
{robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/html_rendering/render.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.2 → robotframework_testdoc-0.2.4}/src/testdoc/parser/testcaseparser.py
RENAMED
|
File without changes
|