testbench2robotframework 0.8.0a1__tar.gz → 0.8.0a3__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.
Files changed (58) hide show
  1. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/.gitignore +5 -1
  2. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/PKG-INFO +3 -3
  3. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/README.md +1 -1
  4. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/pyproject.toml +4 -2
  5. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/__init__.py +2 -2
  6. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/config.py +15 -1
  7. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/html_parser.py +2 -2
  8. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/json_reader.py +7 -13
  9. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/json_writer.py +15 -6
  10. testbench2robotframework-0.8.0a3/testbench2robotframework/model.py +1644 -0
  11. testbench2robotframework-0.8.0a3/testbench2robotframework/model_utils.py +107 -0
  12. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/result_writer.py +97 -91
  13. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/testbench2rf.py +85 -69
  14. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/utils.py +23 -11
  15. testbench2robotframework-0.8.0a1/testbench2robotframework/model.py +0 -983
  16. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/CreatePiPWheel.bat +0 -0
  17. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/CreatePiPWheel.sh +0 -0
  18. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/DEVELOPMENT.md +0 -0
  19. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/ExampleConfiguration/json_config.json +0 -0
  20. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/ExampleConfiguration/pyproject_example.toml +0 -0
  21. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/ExampleConfiguration/toml_config.toml +0 -0
  22. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/LICENSE +0 -0
  23. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/MANIFEST.in +0 -0
  24. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/json_config_tests/1_tfs.robot +0 -0
  25. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/libs/json_config.py +0 -0
  26. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/libs/pyproject_config.py +0 -0
  27. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/resources/file_management.resource +0 -0
  28. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/resources/testbench2robotframework_cli.resource +0 -0
  29. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/rf_tests/cli_interface/write/json_config.robot +0 -0
  30. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/rf_tests/cli_interface/write/no_config_argument.robot +0 -0
  31. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/atest/robot/rf_tests/cli_interface/write/toml_config.robot +0 -0
  32. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/create_json_schema.py +0 -0
  33. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/LibrarySubdivision.PNG +0 -0
  34. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/Unbenannt.PNG +0 -0
  35. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/generated.png +0 -0
  36. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/libraries.PNG +0 -0
  37. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/resources.PNG +0 -0
  38. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/rfLibraryRootsTestBench.PNG +0 -0
  39. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/testbench_rfLibraryRegex.PNG +0 -0
  40. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/testbench_rfResourceRegex.PNG +0 -0
  41. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/images/testthemen.PNG +0 -0
  42. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/oldModel.py +0 -0
  43. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/pydantic_model.py +0 -0
  44. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/requirements.txt +0 -0
  45. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/robot.toml +0 -0
  46. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tasks.py +0 -0
  47. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench-tools.zip +0 -0
  48. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/__main__.py +0 -0
  49. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/cli.py +0 -0
  50. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/log.py +0 -0
  51. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/robotframework2testbench.py +0 -0
  52. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/testbench2robotframework.py +0 -0
  53. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/testbench2robotframework/testsuite_write.py +0 -0
  54. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tests/test_data/configurations/invalid_config.json +0 -0
  55. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tests/test_data/configurations/valid_config.json +0 -0
  56. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tests/test_missing_files.py +0 -0
  57. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tests/test_robot_files_should_not_contain_invalid_characters.py +0 -0
  58. {testbench2robotframework-0.8.0a1 → testbench2robotframework-0.8.0a3}/tests/test_zip_file_generation.py +0 -0
@@ -153,4 +153,8 @@ results/
153
153
  report.html
154
154
  ExampleConfiguration/toml_config_minimal.toml
155
155
  ExampleConfiguration/toml_new_names.toml
156
- README_new.md
156
+ README_new.md
157
+ report/
158
+ reportt/
159
+ itorx_report/
160
+ config.json
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testbench2robotframework
3
- Version: 0.8.0a1
3
+ Version: 0.8.0a3
4
4
  Summary: Robot Framework Code Generator from Keyword-Driven Tests in imbus TestBench 3.0 and newer
5
5
  Author-email: imbus AG <support@imbus.de>
6
- Requires-Python: >= 3.9
6
+ Requires-Python: >= 3.10
7
7
  Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
9
  Requires-Dist: click >= 8.0
@@ -26,7 +26,7 @@ Provides-Extra: dev
26
26
 
27
27
  # Installation des Robot Code Generators
28
28
 
29
- Voraussetzung für die Installation der Software ist eine vorhandene Python Installation. Die minimal benötigte Version ist Python 3.9. Zum Überprüfen, ob die korrekte Python Version installiert ist, kann der folgende Kommandozeilen Befehl verwendet werden:
29
+ Voraussetzung für die Installation der Software ist eine vorhandene Python Installation. Die minimal benötigte Version ist Python 3.10. Zum Überprüfen, ob die korrekte Python Version installiert ist, kann der folgende Kommandozeilen Befehl verwendet werden:
30
30
 
31
31
  ```powershell
32
32
  python --version
@@ -1,6 +1,6 @@
1
1
  # Installation des Robot Code Generators
2
2
 
3
- Voraussetzung für die Installation der Software ist eine vorhandene Python Installation. Die minimal benötigte Version ist Python 3.9. Zum Überprüfen, ob die korrekte Python Version installiert ist, kann der folgende Kommandozeilen Befehl verwendet werden:
3
+ Voraussetzung für die Installation der Software ist eine vorhandene Python Installation. Die minimal benötigte Version ist Python 3.10. Zum Überprüfen, ob die korrekte Python Version installiert ist, kann der folgende Kommandozeilen Befehl verwendet werden:
4
4
 
5
5
  ```powershell
6
6
  python --version
@@ -2,6 +2,8 @@
2
2
  requires = ["flit_core >=3.2,<4"]
3
3
  build-backend = "flit_core.buildapi"
4
4
 
5
+ [tool.testbench2robotframework.console-logging]
6
+ logLevel = "DEBUG"
5
7
 
6
8
  [project]
7
9
  name = "testbench2robotframework"
@@ -9,7 +11,7 @@ authors = [
9
11
  {name = "imbus AG", email = "support@imbus.de"},
10
12
  ]
11
13
  description = "Robot Framework Code Generator from Keyword-Driven Tests in imbus TestBench 3.0 and newer"
12
- requires-python = ">= 3.9"
14
+ requires-python = ">= 3.10"
13
15
  readme = "README.md"
14
16
  license = {text = "Apache 2.0 License"}
15
17
  dynamic = ["version"]
@@ -53,7 +55,7 @@ ignore = [
53
55
 
54
56
 
55
57
  [tool.mypy]
56
- python_version = "3.9"
58
+ python_version = "3.10"
57
59
  ignore_missing_imports = true
58
60
  no_implicit_optional = true
59
61
  strict_optional = true
@@ -13,8 +13,8 @@
13
13
  # limitations under the License.
14
14
 
15
15
  """A Python package for converting TestBench reports to Robot Framework test
16
- suites and enhancing the TestBench report with execution results from Robot Framework."""
16
+ suites and enhancing the TestBench report with execution results from Robot Framework."""
17
17
 
18
18
  from .testbench2robotframework import testbench2robotframework # noqa: F401
19
19
 
20
- __version__ = "0.8.0a1"
20
+ __version__ = "0.8.0a3"
@@ -1,6 +1,7 @@
1
1
  # pylint: skip-file
2
2
  from __future__ import annotations
3
3
 
4
+ from enum import Enum, auto
4
5
  import json
5
6
  import sys
6
7
  from dataclasses import dataclass
@@ -11,7 +12,6 @@ if sys.version_info >= (3, 11):
11
12
  import tomllib
12
13
  else:
13
14
  import tomli as tomllib
14
- from .model import StrEnum
15
15
 
16
16
  DEFAULT_LIBRARY_REGEX = r"(?:.*\.)?(?P<resourceName>[^.]+?)\s*\[Robot-Library\].*"
17
17
  DEFAULT_LIBRARY_ROOTS: Final[list[str]] = ["RF", "RF-Library"]
@@ -19,6 +19,18 @@ DEFAULT_RESOURCE_REGEX = r"(?:.*\.)?(?P<resourceName>[^.]+?)\s*\[Robot-Resource\
19
19
  DEFAULT_RESOURCE_ROOTS: Final[list[str]] = ["RF-Resource"]
20
20
  DEFAULT_GENERATION_DIRECTORY = "{root}/Generated"
21
21
 
22
+ class StrEnum(str, Enum):
23
+ def __new__(cls, *args):
24
+ for arg in args:
25
+ if not isinstance(arg, (str, auto)):
26
+ raise TypeError(f"Values of StrEnums must be strings: {arg!r} is a {type(arg)}")
27
+ return super().__new__(cls, *args)
28
+
29
+ def __str__(self):
30
+ return self.value
31
+
32
+ def _generate_next_value_(name, *_):
33
+ return name
22
34
 
23
35
 
24
36
  def find_pyproject_toml() -> Path:
@@ -36,6 +48,8 @@ def get_testbench2robotframework_toml_dict(toml_path: Path):
36
48
  toml_dict = tomllib.load(toml_file)
37
49
  except FileNotFoundError:
38
50
  return {}
51
+ except PermissionError:
52
+ return {}
39
53
  return toml_dict.get("tool", {}).get("testbench2robotframework", {})
40
54
 
41
55
 
@@ -14,7 +14,7 @@ class TextExtractor(HTMLParser):
14
14
 
15
15
 
16
16
  def extract_text_from_html(html):
17
- html = html.replace('&nbsp;', ' ')
17
+ html = html.replace("&nbsp;", " ")
18
18
  parser = TextExtractor()
19
19
  parser.feed(html)
20
- return parser.get_text().strip().replace('\n', '\n ...').replace('\u00A0',' ')
20
+ return parser.get_text().strip().replace("\n", "\n ...").replace("\u00a0", " ")
@@ -9,9 +9,10 @@ from .log import logger
9
9
  from .model import (
10
10
  TestCaseDetails,
11
11
  TestCaseSetDetails,
12
- TestStructureElementType,
12
+ TestCaseSetNode,
13
13
  TestStructureTree,
14
14
  )
15
+ from .model_utils import from_dict
15
16
 
16
17
  TEST_STRUCTURE_TREE_FILE = "cycle_structure.json"
17
18
  TEST_STRUCTURE_TREE_TOV_FILE = "tov_structure.json"
@@ -56,10 +57,7 @@ class TestBenchJsonReader:
56
57
  test_theme_path = self.get_structure_tree_path()
57
58
  logger.debug(f"Loading TestThemeTree from {test_theme_path}")
58
59
  test_structure_tree = read_json(str(test_theme_path))
59
- self._test_theme_tree = TestStructureTree.from_dict(
60
- test_structure_tree,
61
- bool(str(test_theme_path).endswith(TEST_STRUCTURE_TREE_TOV_FILE)),
62
- )
60
+ self._test_theme_tree = from_dict(TestStructureTree, test_structure_tree)
63
61
  logger.info(f"{len(self._test_theme_tree.nodes)} nodes from TestThemeTree loaded.")
64
62
  return self._test_theme_tree
65
63
 
@@ -103,11 +101,7 @@ class TestBenchJsonReader:
103
101
  def get_test_case_set_uids(self) -> list[str]:
104
102
  nodes = [self.test_theme_tree.root]
105
103
  nodes.extend(self.test_theme_tree.nodes)
106
- return [
107
- tse.base.uniqueID
108
- for tse in nodes
109
- if tse.elementType == TestStructureElementType.TestCaseSetNode
110
- ]
104
+ return [tse.base.uniqueID for tse in nodes if isinstance(tse, TestCaseSetNode)]
111
105
 
112
106
  def get_test_case_uids(self, test_case_set_uid: str) -> list[str]:
113
107
  if not self._test_case_sets:
@@ -123,20 +117,20 @@ class TestBenchJsonReader:
123
117
  tcs_dict = read_json(str(Path(self.json_dir, f"{uid}.json")))
124
118
  if tcs_dict is None:
125
119
  return None
126
- return TestCaseSetDetails.from_dict(tcs_dict)
120
+ return from_dict(TestCaseSetDetails, tcs_dict)
127
121
 
128
122
  def read_test_case(self, uid) -> Optional[TestCaseDetails]:
129
123
  tc_dict = read_json(str(Path(self.json_dir, f"{uid}.json")))
130
124
  if tc_dict is None:
131
125
  return None
132
126
  # return None # TODO: wenn nicht da dann Fehler?
133
- return TestCaseDetails.from_dict(tc_dict)
127
+ return from_dict(TestCaseDetails, tc_dict)
134
128
 
135
129
  def read_test_theme_tree(self, is_tov=False) -> Optional[TestStructureTree]:
136
130
  test_structure_tree = read_json(str(Path(self.json_dir, TEST_STRUCTURE_TREE_FILE)))
137
131
  if test_structure_tree is None:
138
132
  return None
139
- return TestStructureTree.from_dict(test_structure_tree, is_tov)
133
+ return from_dict(TestStructureTree, test_structure_tree)
140
134
 
141
135
 
142
136
  def read_json(filepath: str, silent=True):
@@ -1,14 +1,15 @@
1
1
  import json
2
2
  from dataclasses import asdict
3
+ from enum import Enum
3
4
  from pathlib import Path
4
5
  from typing import Union
5
6
 
6
7
  from .config import Configuration
7
8
  from .log import logger
8
9
  from .model import (
9
- ProtocolTestCaseSetExecutionSummary,
10
10
  TestCaseDetails,
11
11
  TestCaseSetDetails,
12
+ TestCaseSetExecutionForImport,
12
13
  TestStructureTree,
13
14
  )
14
15
 
@@ -24,16 +25,24 @@ def write_test_structure_element(
24
25
  else:
25
26
  filepath = Path(json_dir) / Path(f"{test_structure_element.uniqueID}.json")
26
27
  with Path(filepath).open("w+", encoding="utf8") as output_file:
27
- json.dump(asdict(test_structure_element), output_file, indent=2)
28
+ json.dump(
29
+ asdict(test_structure_element),
30
+ output_file,
31
+ indent=2,
32
+ default=lambda o: o.value if isinstance(o, Enum) else str(o),
33
+ )
28
34
 
29
35
 
30
- def write_main_protocol(
31
- json_dir: str, main_protocol: list[ProtocolTestCaseSetExecutionSummary]
32
- ) -> None:
36
+ def write_main_protocol(json_dir: str, main_protocol: list[TestCaseSetExecutionForImport]) -> None:
33
37
  protocol = [asdict(tcs) for tcs in main_protocol]
34
38
  filepath = Path(json_dir) / Path("protocol.json")
35
39
  with Path(filepath).open("w+", encoding="utf8") as output_file:
36
- json.dump(protocol, output_file, indent=2)
40
+ json.dump(
41
+ protocol,
42
+ output_file,
43
+ indent=2,
44
+ default=lambda o: o.value if isinstance(o, Enum) else str(o),
45
+ )
37
46
 
38
47
 
39
48
  def write_default_config(config_file):