├── .gitignore ├── .python-version ├── Development.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── Setup.py ├── createPip_whl_tar.bat ├── createPip_whl_tar.sh ├── libdoc2testbench ├── __init__.py ├── __main__.py ├── arg_parser.py ├── argument_api.py ├── datatype_creator.py ├── datatype_storage.py ├── interaction_creator.py ├── libdoc_generation.py ├── pk_generator.py ├── project_dump_builder.py ├── project_dump_model │ ├── __init__.py │ ├── itb_project_export.py │ └── model_api.py ├── testbench_import_generator.py ├── uid_generator.py └── utils.py ├── pyproject.toml ├── requirements.txt ├── res ├── example_usage.gif ├── example_usage.stg ├── projectmanagement_view.gif ├── projectmanagement_view.stg └── test_element_view.png ├── setup.cfg └── xsdata_config.xml /.gitignore: -------------------------------------------------------------------------------- 1 | ### Python ### 2 | # Byte-compiled / optimized / DLL files 3 | __pycache__/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | cover/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | .pybuilder/ 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | # For a library or package, you might want to ignore these files since the code is 88 | # intended to run in multiple environments; otherwise, check them in: 89 | # .python-version 90 | 91 | # pipenv 92 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 93 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 94 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 95 | # install all needed dependencies. 96 | #Pipfile.lock 97 | 98 | # poetry 99 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 100 | # This is especially recommended for binary packages to ensure reproducibility, and is more 101 | # commonly ignored for libraries. 102 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 103 | #poetry.lock 104 | 105 | # pdm 106 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 107 | #pdm.lock 108 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 109 | # in version control. 110 | # https://pdm.fming.dev/#use-with-ide 111 | .pdm.toml 112 | 113 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 114 | __pypackages__/ 115 | 116 | # Celery stuff 117 | celerybeat-schedule 118 | celerybeat.pid 119 | 120 | # SageMath parsed files 121 | *.sage.py 122 | 123 | # Environments 124 | .env 125 | .venv 126 | env/ 127 | venv/ 128 | ENV/ 129 | env.bak/ 130 | venv.bak/ 131 | 132 | # Spyder project settings 133 | .spyderproject 134 | .spyproject 135 | 136 | # Rope project settings 137 | .ropeproject 138 | 139 | # mkdocs documentation 140 | /site 141 | 142 | # mypy 143 | .mypy_cache/ 144 | .dmypy.json 145 | dmypy.json 146 | 147 | # Pyre type checker 148 | .pyre/ 149 | 150 | # pytype static type analyzer 151 | .pytype/ 152 | 153 | # Cython debug symbols 154 | cython_debug/ 155 | 156 | # PyCharm 157 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 158 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 159 | # and can be added to the global gitignore or merged into this file. For a more nuclear 160 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 161 | #.idea/ 162 | 163 | ### Python Patch ### 164 | # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration 165 | poetry.toml 166 | 167 | # ruff 168 | .ruff_cache/ 169 | 170 | # LSP config files 171 | pyrightconfig.json 172 | 173 | ### robotframework ### 174 | results/ 175 | log.html 176 | output.xml 177 | report.html 178 | selenium-screenshot-*.png 179 | 180 | ### testbench 181 | test.xml 182 | test_libraries/ 183 | 184 | ###vs code 185 | .vscode/ 186 | 187 | ### libdoc2testbench 188 | project-dump.zip 189 | project-dump.xml 190 | Browser.zip 191 | validate_model.py 192 | web_itorx_import_list.txt 193 | fix_model.py 194 | dump.bat 195 | *.zip 196 | testbench_xsd/ 197 | 198 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.8.9 2 | -------------------------------------------------------------------------------- /Development.md: -------------------------------------------------------------------------------- 1 | ## Setting up project for the first time 2 | 1. Write all dependencies into setup.cfg (install_requires and extras_require). 3 | 2. Create venv (python -m venv .venv) and activate it (".venv\scripts\activate" or "source .venv/bin/activate") 4 | 3. Update pip (python -m pip install -U pip) 5 | 3. Install pip-tools (pip install pip-tools) 6 | 4. Update/Create `requirements.txt` 7 | - with Development dependencies 8 | > pip-compile --extra dev setup.cfg 9 | - or only with Runtime dependencies 10 | > pip-compile setup.cfg 11 | 5. Install dependencies (pip install -U -r requirements.txt) 12 | 6. Install project into local venv (pip install -e .[extra]) 13 | 14 | ## Generate Dataclasses from xsd 15 | ```xsdata testbench_xsd\itb-project-export.xsd --config .\xsdata_config.xml``` 16 | 17 | ## Fix unreadable Enums in newly generated model 18 | ```python .\fix_model.py .\libdoc2testbench\project_dump_model\itb_project_export.py``` 19 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021- imbus AG 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.py 2 | include LICENSE 3 | 4 | 5 | # added by check-manifest 6 | exclude *.bat 7 | exclude *.sh 8 | exclude *.zip 9 | 10 | # added by check-manifest 11 | recursive-exclude res *.gif 12 | recursive-exclude res *.png 13 | recursive-exclude res *.stg 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Libdoc2TestBench 2 | Robot Framework Libdoc extension that generates imbus [TestBench Enterprise](https://www.imbus.de/en/testbench-enterprise) import formats. 3 | It can be used to generate Testbench interactions and datatypes from Robotframework libraries. 4 | ___ 5 | 6 | ### Installation: 7 | 8 | To install this package you can use the following `pip` command: 9 | 10 | ```bash 11 | pip install robotframework-libdoc2testbench 12 | ``` 13 | 14 | *Notice: This extension requires Robot Framework 5.0.0 or later and does not work with earlier versions.* 15 | ___ 16 | ### Usage: 17 | 18 | There are three main use cases: 19 | * Import official Robot Framework librarys 20 | * Import custom Robot Framework librarys 21 | * Import Robot Framework resource files 22 | 23 | #### Import official Robot Framework librarys 24 | 25 | ![LibDoc2TestBench command demo](res/example_usage.gif) 26 | 27 | For the most basic usage you just have to pass a Robot Framework library as an argument to the ``Libdoc2TestBench`` command. 28 | ``Libdoc2TestBench`` will create a zip-file with the name of the library in the current working directory. This zip-file can be imported to TestBench in order to use Robot Framework keywords from within TestBench. 29 | 30 | ```bash 31 | Libdoc2TestBench 32 | ``` 33 | The `` argument corresponds to the Robot Framework library name that you would use to import the library in the ``*** Settings ***`` of a robot/resource file. 34 | The second positional argument can be used to specify the name of the generated zip-file: 35 | 36 | ```bash 37 | Libdoc2TestBench 38 | ``` 39 | 40 | #### Import the generated TestBench zip-file 41 | The generated zip-file can be imported via the `Import Project...` command in the Project Management view of the imbus TestBench: 42 | 43 | ![Import Project Demo](res/projectmanagement_view.gif) 44 | 45 | Afterwards you'll find your imported RF library, the different interactions and the datatypes in the Test Elements view: 46 | 47 | ![Test Element View](res/test_element_view.png) 48 | 49 | The imported Testelements can be copied into another testbench project. When copying, it is important that the test elements remain in the same subdivisions. 50 | 51 | #### Import custom robotframework librarys 52 | 53 | Libdoc2Testbench can also be used to import custom Robot Framework librarys. 54 | 55 | Example for a custom library: 56 | ```python 57 | class mycustomlibrary(object): 58 | def print_hello_world(self): 59 | print("Hello World") 60 | ``` 61 | 62 | Example Libdoc2Testbench usage: 63 | 64 | ```bash 65 | Libdoc2TestBench mycustomlibrary.py 66 | ``` 67 | 68 | #### Import Robot Framework resource files 69 | 70 | Libdoc2Testbench can also be used to import Robot Framework resource files. 71 | 72 | Example for a resource file: 73 | 74 | ```robotframework 75 | *** Keywords *** 76 | print hello world 77 | log Hello World 78 | ``` 79 | 80 | Example Libdoc2Testbench usage: 81 | 82 | ```bash 83 | Libdoc2TestBench path/to/keywords.resource 84 | ``` 85 | 86 | #### Importing multiple librarys and resource files at once 87 | 88 | Libdoc2Testbench can be used to import multiple librarys and resource files at once. A special robot framework section is used for this use case. 89 | 90 | Example for a import List: 91 | 92 | ```robotframework 93 | *** Import List *** 94 | BrowserLibrary 95 | BuiltIn 96 | mycustomlibrary.py 97 | myresource.resource 98 | ``` 99 | 100 | Example Libdoc2Testbench usage: 101 | 102 | ```bash 103 | Libdoc2TestBench importlist.robot 104 | ``` 105 | 106 | ___ 107 | ### Command line arguments 108 | There are several optional arguments, that follow the structure of the robot.libdoc module. When generating imports from a RF library, these values should already be set up correctly. You may overwrite the docformat and other meta data by setting the associated arguments written below. 109 | 110 | | Arguments | Description | Allowed Values | 111 | |- |- |- | 112 | | `-h`, `--help` | Show the help message and exit 113 | | `-a`, `--attachment` | Defines if the resource file, which has been used to generate the interactions, will be attached to those interactions. 114 | | `-F FORMAT`, `--docformat FORMAT` | Specifies the source documentation format. Possible values are Robot Framework's documentation format, HTML, plain text, and reStructuredText. The default value can be specified in library source code and the initial default value is `ROBOT`. | `ROBOT` `HTML` `TEXT` `REST` | 115 | | `--libraryroot LIBRARYROOT`| Defines the subdivision name which contains the imported Robot Framework libraries. Default is ``RF``. 116 | | `--resourceroot RESOURCEROOT` |Defines the subdivision name which contains the imported Robot Framework resources. Default is ``Resource``. 117 | | `--libversion LIBVERSION` | Sets the version of the documented library or resource written in the description. 118 | | `--libname` | Sets the name of the documented library or resource. | | 119 | | `-r REPOSITORY`, `--repository REPOSITORY`| Sets the repository id of the TestBench import. The default is `iTB_RF`.|| 120 | | `-s SPECFORMAT`, `--specdocformat SPECFORMAT` | Specifies the documentation format used with XML and JSON spec files. `RAW` means preserving the original documentation format and `HTML` means converting documentation to HTML. The default is `HTML`. | `HTML` `RAW` | 121 | | `--version`, `--info` | Writes the Libdoc2TestBench, Robot Framework and Python version to console. | | 122 | | `--library_name_extension` | Adds an extension to the name of an Robot Framework library subdivision in TestBench. Often used in combination with the `rfLibraryRegex` in `testbench2robotframework`. Default is `[Robot-Library]`.|| 123 | | `--resource_name_extension` | Adds an extension to the name of an Robot Framework resource subdivision in TestBench. Often used in combination with the `rfResourceRegex` in `testbench2robotframework`. Default is `[Robot-Resource]`.|| 124 | | `--created_datatypes` | Option to specify if all Robot Framework datatypes should be created in TestBench (`ALL`), only the enum types (`ENUM`) or if no datatype should be created and only generic parameters are used (`NONE`). The default is `ALL`. || 125 | ___ 126 | 127 | ### Change log 128 | * 1.2 129 | * Added library keyword return types with RobotFramework version >= 7 130 | * Added datatype creation options with default values 131 | * Removed `--xml` cli option 132 | * Removed `--temp` cli option 133 | * 1.1 134 | * Added TestBench datatypes 135 | * Added default values 136 | * 1.0rc2 137 | * ADDED optional arguments for: 138 | * xml-file output (instead of zip-file) 139 | * custom temporary directory 140 | * changing the repository id in the xml-header 141 | * custom primary key enumeration start 142 | * info command for printing Libdoc2TestBench/Robot Framework/Python version to console 143 | * support for resource-files (attachment support coming soon) 144 | * FIX: 145 | * only create `_Datatype` subdivison in libraries when data types are present 146 | * `Resource` subdivison is now in the correct parent subdivision 147 | * Updated README.md / package help-messages to reflect changes 148 | * 1.0rc1 149 | * first release candidate 150 | 151 | ___ 152 | ### License 153 | Distributed under the [Apache-2.0 license](https://github.com/imbus/robotframework-libdoc2testbench/blob/main/LICENSE). See [LICENSE](LICENSE) for more information. 154 | ___ 155 | ### Dependencies 156 | - python >= 3.8 157 | - [robotframework](https://github.com/robotframework/robotframework) >= 5.0.0 158 | -------------------------------------------------------------------------------- /Setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | if __name__ == '__main__': 4 | setup() 5 | -------------------------------------------------------------------------------- /createPip_whl_tar.bat: -------------------------------------------------------------------------------- 1 | check-manifest --update 2 | pause 3 | del dist\* /Q /S /F 4 | pause 5 | python setup.py bdist_wheel sdist 6 | pause 7 | python -m twine check dist/* 8 | pause 9 | echo "Next step - uploading to pypi!" 10 | pause 11 | python -m twine upload dist/* 12 | pause -------------------------------------------------------------------------------- /createPip_whl_tar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | check-manifest --update 3 | rm -f dist/*.* 4 | python setup.py bdist_wheel sdist 5 | twine check dist/* 6 | echo "Next step - uploading to pypi!" 7 | read -n 1 8 | twine upload dist/* 9 | -------------------------------------------------------------------------------- /libdoc2testbench/__init__.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | from robot.running.arguments.argumentspec import ArgInfo 4 | from robot.utils import safe_str 5 | 6 | try: 7 | from robot.utils import NOT_SET 8 | except ImportError: 9 | NOT_SET = ArgInfo.NOTSET 10 | 11 | __version__ = "1.2.1" 12 | 13 | 14 | def default_repr(self): 15 | if self.default is NOT_SET: 16 | return None 17 | if isinstance(self.default, (bool, int, float)) or self.default is None: 18 | return f"${{{self.default}}}" 19 | if self.default == "": 20 | return "${Empty}" 21 | if isinstance(self.default, Enum): 22 | return self.default.name 23 | return safe_str(self.default) 24 | 25 | 26 | ArgInfo.default_repr = property(default_repr) 27 | -------------------------------------------------------------------------------- /libdoc2testbench/__main__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | import robot 4 | 5 | from libdoc2testbench import __version__ 6 | from libdoc2testbench.arg_parser import parser 7 | from libdoc2testbench.testbench_import_generator import TestBenchImportGenerator 8 | 9 | 10 | def run(): 11 | args = parser.parse_args() 12 | version_info = args.version 13 | if version_info: 14 | print( 15 | f"Libdoc2TestBench {__version__} [Robot Framework {robot.version.get_full_version()}]" 16 | ) 17 | sys.exit() 18 | library = args.library_or_resource 19 | if not library: 20 | sys.exit("Libdoc2TestBench error: Missing required argument 'library_or_resource'") 21 | TestBenchImportGenerator(args).create_project_dump() 22 | 23 | 24 | if __name__ == "__main__": 25 | run() 26 | -------------------------------------------------------------------------------- /libdoc2testbench/arg_parser.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | parser = argparse.ArgumentParser( 4 | description="""Robot Framework Libdoc Extension that generates imbus 5 | TestBench Library import formats. The easiest way to run 6 | Libdoc2TestBench is just using the `Libdoc2TestBench` 7 | command and giving it one resource or library to generate 8 | a zip-file at the current location. 9 | """, 10 | usage="Libdoc2TestBench ", 11 | prog='Libdoc2TestBench', 12 | epilog='Example: Libdoc2TestBench Browser Browser.zip', 13 | ) 14 | parser.add_argument("library_or_resource", help="RF library or resource", nargs='?', default=None) 15 | parser.add_argument( 16 | 'outfile_path', 17 | nargs='?', 18 | default='', 19 | help="""Optional argument to specify the path of the created project-dump. 20 | Can be a .zip or .xml file. Default = project-dump.zip""", 21 | ) 22 | parser.add_argument( 23 | '-a', 24 | '--attachment', 25 | action='store_true', 26 | help="""Defines if the resource file, which has been used 27 | to generate the interactions, will be attached to those interactions.""", 28 | ) 29 | parser.add_argument( 30 | '-F', 31 | '--docformat', 32 | choices=['ROBOT', 'HTML', 'TEXT', 'REST'], 33 | help="""Specifies the source documentation format. 34 | Possible values are Robot Framework's documentation format, 35 | HTML, plain text, and reStructuredText. The default value can be 36 | specified in library source code and the initial default value is `ROBOT`.""", 37 | ) 38 | parser.add_argument( 39 | '--libraryroot', 40 | help='Defines the subdivision name which contains the imported Robot Framework libraries.', 41 | default='RF', 42 | ) 43 | parser.add_argument( 44 | '--resourceroot', 45 | help='Defines the subdivision name which contains the imported Robot Framework resources.', 46 | default='Resource', 47 | ) 48 | parser.add_argument( 49 | '--libversion', 50 | help="Sets the version of the documented library or resource written in the description.", 51 | ) 52 | parser.add_argument('--libname', help="Sets the name of the documented library or resource.") 53 | parser.add_argument( 54 | '-r', 55 | '--repository', 56 | help='Sets the repository id of the TestBench import. Default = iTB_RF', 57 | default='iTB_RF', 58 | ) 59 | parser.add_argument( 60 | '-s', 61 | '--specdocformat', 62 | default='HTML', 63 | choices=['HTML', 'RAW'], 64 | help="""Specifies the documentation format used with XML and JSON spec files. 65 | `raw` means preserving the original documentation format and `html` means 66 | converting documentation to HTML. The default is `html`.""", 67 | ) 68 | parser.add_argument( 69 | '--version', 70 | '--info', 71 | action='store_true', 72 | help='Writes the Libdoc2TestBench, Robot Framework and Python version to console.', 73 | ) 74 | parser.add_argument( 75 | '--library_name_extension', 76 | help='Adds an extension to the name of all Robot Framework Library subdivisions in TestBench.', 77 | default=' [Robot-Library]', 78 | ) 79 | parser.add_argument( 80 | '--resource_name_extension', 81 | help='Adds an extension to the name of all Robot Framework Resource subdivisions in TestBench.', 82 | default=' [Robot-Resource]', 83 | ) 84 | parser.add_argument( 85 | '--created_datatypes', 86 | default='ALL', 87 | choices=['ALL', 'ENUMS', 'NONE'], 88 | help="""Option to specify if all Robot Framework datatypes should be 89 | created in TestBench (`ALL`), only the enum types (`ENUMS`) or if 90 | no datatype should be created and only generic parameters are used (`NONE`). 91 | The default is `ALL`.""", 92 | ) 93 | -------------------------------------------------------------------------------- /libdoc2testbench/argument_api.py: -------------------------------------------------------------------------------- 1 | from itertools import chain 2 | from typing import List, Optional 3 | 4 | from robot.running.arguments.argumentspec import ArgInfo 5 | 6 | try: 7 | from robot.utils import NOT_SET 8 | except ImportError: 9 | NOT_SET = ArgInfo.NOTSET 10 | 11 | 12 | def _get_arg_sub_types(arg_type) -> List: 13 | if not arg_type.is_union: 14 | return [arg_type.name] 15 | nested_types = [_get_arg_sub_types(nested_type) for nested_type in arg_type.nested] 16 | return list(chain.from_iterable(nested_types)) 17 | 18 | 19 | def get_argument_type_names(argument: ArgInfo) -> List[str]: 20 | try: 21 | return _get_arg_sub_types(argument.type) 22 | except AttributeError: 23 | return argument.types_reprs # above block does not work for rf5 24 | 25 | 26 | def get_arg_kind_default_value(argument_kind: str) -> Optional[str]: 27 | if argument_kind == ArgInfo.VAR_POSITIONAL: 28 | return "@{EMPTY}" 29 | if argument_kind == ArgInfo.VAR_NAMED: 30 | return "&{EMPTY}" 31 | return None 32 | 33 | 34 | def requires_datatype_creation(argument) -> bool: 35 | argument_kind = argument.kind 36 | if ( 37 | not argument_kind 38 | or argument_kind == ArgInfo.POSITIONAL_ONLY_MARKER 39 | or argument_kind == ArgInfo.NAMED_ONLY_MARKER 40 | or argument_kind == NOT_SET 41 | ): 42 | return False 43 | return True 44 | -------------------------------------------------------------------------------- /libdoc2testbench/datatype_creator.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | from typing import Dict, List, Optional 3 | 4 | from robot.libdocpkg.robotbuilder import LibraryDoc 5 | from robot.running.arguments.argumentspec import ArgInfo 6 | 7 | from libdoc2testbench.argument_api import ( 8 | get_arg_kind_default_value, 9 | get_argument_type_names, 10 | requires_datatype_creation, 11 | ) 12 | from libdoc2testbench.datatype_storage import DatatypeStorage 13 | from libdoc2testbench.pk_generator import PKGenerator 14 | from libdoc2testbench.project_dump_model import ( 15 | Datatype, 16 | EquivalenceClasses, 17 | ) 18 | from libdoc2testbench.project_dump_model.itb_project_export import ( 19 | EquivalenceClass, 20 | Ref, 21 | Representatives, 22 | Subdivision, 23 | ) 24 | from libdoc2testbench.project_dump_model.model_api import ( 25 | create_datatype, 26 | create_equivalence_class, 27 | create_representative, 28 | create_subdivision, 29 | ) 30 | from libdoc2testbench.uid_generator import TestElementType, UidGenerator 31 | 32 | 33 | class CreatedDatatypes(Enum): 34 | ALL = "ALL" 35 | ENUMS = "ENUMS" 36 | NONE = "NONE" 37 | 38 | 39 | class DatatypeCreator: 40 | def __init__( 41 | self, 42 | libdoc: LibraryDoc, 43 | pk_generator: PKGenerator, 44 | uid_generator: UidGenerator, 45 | created_datatypes: CreatedDatatypes, 46 | ) -> None: 47 | self.libdoc = libdoc 48 | self.created_datatypes = created_datatypes 49 | self.pk_generator = pk_generator 50 | self.uid_generator = uid_generator 51 | self.datatypes = DatatypeStorage(pk_generator, uid_generator) 52 | 53 | @property 54 | def default_datatype(self): 55 | if not self.datatypes.get_datatype("default_value"): 56 | self.create_default_datatype() 57 | return self.datatypes.get_datatype("default_value") 58 | 59 | @property 60 | def ordering(self): 61 | self._ordering += 1024 62 | return self._ordering 63 | 64 | def create_datatype_subdivision(self, library_name: str) -> Subdivision: 65 | datatype_subdivision = create_subdivision( 66 | pk=self.pk_generator.get_pk(), 67 | name="_Datatypes", 68 | uid=self.uid_generator.get_uid(TestElementType.SUBDIVISION, "_Datatypes", library_name), 69 | ) 70 | self.get_return_value_datatype() 71 | if self.created_datatypes.value in [ 72 | CreatedDatatypes.ALL.value, 73 | CreatedDatatypes.ENUMS.value, 74 | ]: 75 | self.get_enum_datatypes() 76 | if self.created_datatypes.value == CreatedDatatypes.ALL.value: 77 | self.get_typed_dict_datatypes() 78 | self.get_remaining_datatypes() 79 | datatype_subdivision.element.extend(self.datatypes.get_datatypes()) 80 | return datatype_subdivision 81 | 82 | def map_argument_to_datatype(self, argument: ArgInfo) -> Optional[str]: 83 | arg_type_names = get_argument_type_names(argument) 84 | for arg_type in arg_type_names: 85 | datatype = self.datatypes.get_datatype(arg_type) 86 | if datatype: 87 | return datatype 88 | datatype = self.datatypes.get_datatype(argument.name) 89 | if datatype: 90 | return datatype 91 | if self.created_datatypes.value == CreatedDatatypes.ALL.value: 92 | datatype = create_datatype( 93 | pk=self.pk_generator.get_pk(), 94 | name=argument.name, 95 | uid=self.uid_generator.get_uid( 96 | TestElementType.DATATYPE, argument.name, self.libdoc.name 97 | ), 98 | equivalence_classes=EquivalenceClasses(equivalence_class=[]), 99 | ) 100 | self.datatypes.add_datatype(argument.name, datatype) 101 | else: 102 | datatype = self.default_datatype 103 | return datatype 104 | 105 | def get_remaining_datatypes(self) -> None: 106 | for keyword in self.libdoc.keywords: 107 | for arg in keyword.args: 108 | if not requires_datatype_creation(arg): 109 | continue 110 | datatype = self.map_argument_to_datatype(arg) 111 | arg_type_names = get_argument_type_names(arg) 112 | arg_kind_default = get_arg_kind_default_value(arg.kind) 113 | equivalence_class = self.datatypes.get_equivalence_class( 114 | datatype.name, datatype.name 115 | ) 116 | if arg.default_repr and arg.default_repr not in ["${None}", '${True}', '${False}']: 117 | self.datatypes.add_equivalence_class_members( 118 | datatype.name, equivalence_class.name, [arg.default_repr] 119 | ) 120 | if arg_kind_default: 121 | self.datatypes.add_equivalence_class_members( 122 | datatype.name, datatype.name, [arg_kind_default] 123 | ) 124 | if arg.default_repr in ['${True}', '${False}'] or "bool" in arg_type_names: 125 | self.datatypes.add_equivalence_class_members( 126 | datatype.name, "bool", ['${True}', '${False}'] 127 | ) 128 | if arg.default_repr == "${None}" or "None" in arg_type_names: 129 | self.datatypes.add_equivalence_class_members(datatype.name, "None", ["${None}"]) 130 | 131 | def get_enum_datatypes(self) -> List[Datatype]: 132 | enums = filter(lambda type_doc: type_doc.type == 'Enum', self.libdoc.type_docs) 133 | for enum in enums: 134 | self._ordering = 0 135 | representatives = Representatives( 136 | representative=[ 137 | create_representative( 138 | pk=self.pk_generator.get_pk(), 139 | name=member.name, 140 | ordering=str(self.ordering), 141 | ) 142 | for member in enum.members 143 | ] 144 | ) 145 | enum_equivalence_class = EquivalenceClass( 146 | pk=self.pk_generator.get_pk(), 147 | ordering="1024", 148 | name=enum.name, 149 | description=enum.name, 150 | representatives=representatives, 151 | default_representative_ref=Ref(pk=representatives.representative[0].pk), 152 | ) 153 | datatype = create_datatype( 154 | pk=self.pk_generator.get_pk(), 155 | name=enum.name, 156 | uid=self.uid_generator.get_uid( 157 | TestElementType.DATATYPE, enum.name, self.libdoc.name 158 | ), 159 | html_description=f"{enum.doc}", 160 | equivalence_classes=EquivalenceClasses(equivalence_class=[enum_equivalence_class]), 161 | ) 162 | self.datatypes.add_datatype(enum.name, datatype) 163 | 164 | def get_typed_dict_datatypes(self) -> List[Datatype]: 165 | typed_dicts = filter(lambda type_doc: type_doc.type == 'TypedDict', self.libdoc.type_docs) 166 | self.typed_dict_dicts: Dict[str, Datatype] = {} 167 | for typed_dict in typed_dicts: 168 | datatype = create_datatype( 169 | pk=self.pk_generator.get_pk(), 170 | name=typed_dict.name, 171 | uid=self.uid_generator.get_uid( 172 | TestElementType.DATATYPE, typed_dict.name, self.libdoc.name 173 | ), 174 | html_description=f"{typed_dict.doc}", 175 | equivalence_classes=EquivalenceClasses(equivalence_class=[]), 176 | ) 177 | self.datatypes.add_datatype(typed_dict.name, datatype) 178 | 179 | def get_return_value_datatype(self) -> Datatype: 180 | datatype = create_datatype( 181 | pk=self.pk_generator.get_pk(), 182 | name="assigned_variable", 183 | uid=self.uid_generator.get_uid( 184 | TestElementType.DATATYPE, "assigned_variable", self.libdoc.name 185 | ), 186 | equivalence_classes=EquivalenceClasses( 187 | equivalence_class=[ 188 | create_equivalence_class( 189 | pk=self.pk_generator.get_pk(), 190 | name="assigned_variable", 191 | description=r"regex:(?\$\{.*})", 192 | ordering="1024", 193 | default_representative_ref=Ref(pk="-1"), 194 | representatives=Representatives( 195 | representative=[ 196 | create_representative( 197 | pk=self.pk_generator.get_pk(), 198 | name="${return_value}", 199 | ordering="1024", 200 | ) 201 | ] 202 | ), 203 | ), 204 | create_equivalence_class( 205 | pk=self.pk_generator.get_pk(), 206 | name="no_assignment", 207 | description="regex:^$", 208 | ordering="2048", 209 | default_representative_ref=Ref(pk="-1"), 210 | representatives=Representatives( 211 | representative=[ 212 | create_representative( 213 | pk=self.pk_generator.get_pk(), 214 | name="", 215 | ordering="1024", 216 | ) 217 | ] 218 | ), 219 | ), 220 | ] 221 | ), 222 | ) 223 | self.datatypes.add_datatype("assigned_variable", datatype) 224 | 225 | def create_default_datatype(self) -> Datatype: 226 | datatype = create_datatype( 227 | pk=self.pk_generator.get_pk(), 228 | name="default_value", 229 | uid=self.uid_generator.get_uid( 230 | TestElementType.DATATYPE, "default_value", self.libdoc.name 231 | ), 232 | equivalence_classes=EquivalenceClasses( 233 | equivalence_class=[ 234 | create_equivalence_class( 235 | pk=self.pk_generator.get_pk(), 236 | name="default_value", 237 | description="", 238 | ordering="1024", 239 | representatives=Representatives(representative=[]), 240 | default_representative_ref=Ref(pk="-1"), 241 | ) 242 | ] 243 | ), 244 | ) 245 | self.datatypes.add_datatype("default_value", datatype) 246 | -------------------------------------------------------------------------------- /libdoc2testbench/datatype_storage.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, List, Optional 2 | 3 | from libdoc2testbench.pk_generator import PKGenerator 4 | from libdoc2testbench.project_dump_model.itb_project_export import ( 5 | Datatype, 6 | EquivalenceClass, 7 | Ref, 8 | Representative, 9 | Representatives, 10 | ) 11 | from libdoc2testbench.project_dump_model.model_api import ( 12 | create_equivalence_class, 13 | create_representative, 14 | ) 15 | from libdoc2testbench.uid_generator import UidGenerator 16 | 17 | 18 | class DatatypeStorage: 19 | def __init__( 20 | self, 21 | pk_generator: PKGenerator, 22 | uid_generator: UidGenerator, 23 | ) -> None: 24 | self._datatypes: Dict[str, Datatype] = {} 25 | self.pk_generator = pk_generator 26 | self.uid_generator = uid_generator 27 | 28 | def add_datatype(self, name: str, datatype: Datatype) -> None: 29 | self._datatypes[name] = datatype 30 | 31 | def get_datatypes(self) -> List[Datatype]: 32 | return dict(sorted(self._datatypes.items())).values() 33 | 34 | def get_datatype(self, name: str): 35 | return self._datatypes.get(name) 36 | 37 | def get_equivalence_class( 38 | self, datatype_name: str, name: str, create_eqc=True 39 | ) -> EquivalenceClass: 40 | datatype = self._datatypes.get(datatype_name) 41 | eqc = next( 42 | filter(lambda eq: eq.name == name, datatype.equivalence_classes.equivalence_class), 43 | None, 44 | ) 45 | if not eqc and create_eqc: 46 | try: 47 | ordering = int(datatype.equivalence_classes.equivalence_class[-1].ordering) + 1024 48 | except IndexError: 49 | ordering = 1024 50 | eqc = create_equivalence_class( 51 | pk=self.pk_generator.get_pk(), 52 | name=name, 53 | ordering=str(ordering), 54 | default_representative_ref=Ref(pk="-1"), 55 | representatives=Representatives(representative=[]), 56 | ) 57 | datatype.equivalence_classes.equivalence_class.append(eqc) 58 | return eqc 59 | 60 | def _get_ec_representatives(self, ec: EquivalenceClass) -> List[Representative]: 61 | if not ec.representatives or not ec.representatives.representative: 62 | return [] 63 | return ec.representatives.representative 64 | 65 | def add_equivalence_class_members( 66 | self, datatype_name: str, equivalence_class_name: str, members: List[str] 67 | ) -> None: 68 | equivalence_class = self.get_equivalence_class(datatype_name, equivalence_class_name) 69 | existing_representatives = [ 70 | representative.name 71 | for representative in self._get_ec_representatives(equivalence_class) 72 | ] 73 | for member in members: 74 | if member in existing_representatives: 75 | continue 76 | try: 77 | ordering = int(equivalence_class.representatives.representative[-1].ordering) + 1024 78 | except IndexError: 79 | ordering = 1024 80 | equivalence_class.representatives.representative.append( 81 | create_representative( 82 | pk=self.pk_generator.get_pk(), name=str(member), ordering=str(ordering) 83 | ) 84 | ) 85 | 86 | def get_representative( 87 | self, datatype_name: str, representative: str 88 | ) -> Optional[Representative]: 89 | datatype = self._datatypes.get(datatype_name) 90 | for eqc in datatype.equivalence_classes.equivalence_class: 91 | representatives = self._get_ec_representatives(eqc) 92 | filtered_representative = next( 93 | filter(lambda rpr: rpr.name == representative, representatives), None 94 | ) 95 | if filtered_representative: 96 | return filtered_representative 97 | return None 98 | -------------------------------------------------------------------------------- /libdoc2testbench/interaction_creator.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | from robot.libdocpkg.model import KeywordDoc 4 | from robot.libdocpkg.robotbuilder import LibraryDoc 5 | from robot.running.arguments.argumentspec import ArgInfo 6 | 7 | from libdoc2testbench.argument_api import ( 8 | get_arg_kind_default_value, 9 | get_argument_type_names, 10 | requires_datatype_creation, 11 | ) 12 | from libdoc2testbench.datatype_storage import DatatypeStorage 13 | from libdoc2testbench.pk_generator import PKGenerator 14 | from libdoc2testbench.project_dump_model import ( 15 | Interaction, 16 | Parameter, 17 | Parameters, 18 | Ref, 19 | References, 20 | ) 21 | from libdoc2testbench.project_dump_model.itb_project_export import ( 22 | DefaultValue, 23 | DefaultValueType, 24 | DefinitionType, 25 | UseType, 26 | ) 27 | from libdoc2testbench.project_dump_model.model_api import create_interaction 28 | from libdoc2testbench.uid_generator import TestElementType, UidGenerator 29 | 30 | try: 31 | from robot.utils import NOT_SET 32 | except ImportError: 33 | NOT_SET = ArgInfo.NOTSET 34 | 35 | 36 | class InteractionCreator: 37 | def __init__( 38 | self, 39 | libdoc: LibraryDoc, 40 | datatypes: DatatypeStorage, 41 | pk_generator: PKGenerator, 42 | uid_generator: UidGenerator, 43 | ) -> None: 44 | self.libdoc = libdoc 45 | self.datatypes = datatypes 46 | self.pk_generator = pk_generator 47 | self.uid_generator = uid_generator 48 | self.parameter_name_prefix = { 49 | ArgInfo.VAR_POSITIONAL: "* ", 50 | ArgInfo.VAR_NAMED: "** ", 51 | ArgInfo.NAMED_ONLY: "- ", 52 | } 53 | 54 | def get_interactions( 55 | self, keywords: List[KeywordDoc], reference_pk: Optional[str] 56 | ) -> List[Interaction]: 57 | interactions = { 58 | keyword.name: self.get_interaction_from_keyword(keyword, reference_pk) 59 | for keyword in keywords 60 | } 61 | return dict(sorted(interactions.items())).values() 62 | 63 | def get_interaction_from_keyword( 64 | self, keyword: KeywordDoc, reference_pk: Optional[str] 65 | ) -> Interaction: 66 | references = ( 67 | References(reference_ref=[Ref(pk=reference_pk)]) if reference_pk else References() 68 | ) 69 | return create_interaction( 70 | pk=self.pk_generator.get_pk(), 71 | name=keyword.name, 72 | uid=self.uid_generator.get_uid( 73 | TestElementType.INTERACTION, keyword.name, self.libdoc.name 74 | ), 75 | html_description=( 76 | f"" 77 | f"{keyword.doc.replace('
', '
').replace('
', '
')}" 78 | f"" 79 | ), 80 | references=references, 81 | parameters=self.get_interaction_parameters(keyword), 82 | ) 83 | 84 | def get_return_type_parameter(self, keyword: KeywordDoc) -> Optional[Parameter]: 85 | keyword_dict = keyword.to_dictionary() 86 | if not keyword_dict.get('returnType'): 87 | return None 88 | return Parameter( 89 | pk=self.pk_generator.get_pk(), 90 | name="return_value", 91 | definition_type=DefinitionType.DETAILED, 92 | use_type=UseType.CALL_BY_REFERENCE, 93 | default_value=DefaultValue( 94 | type_value="1", 95 | type_attribute=DefaultValueType.REPRESENTATIVE, 96 | representative_ref=Ref( 97 | pk=self.datatypes.get_equivalence_class( 98 | "assigned_variable", "no_assignment", False 99 | ) 100 | .representatives.representative[0] 101 | .pk 102 | ), 103 | ), 104 | datatype_ref=Ref(pk=self.datatypes.get_datatype("assigned_variable").pk), 105 | ) 106 | 107 | def get_interaction_parameters(self, keyword: KeywordDoc) -> Parameters: 108 | parameters = Parameters(parameter=[]) 109 | for argument in keyword.args: 110 | if not requires_datatype_creation(argument): 111 | continue 112 | arg_type_names = get_argument_type_names(argument) 113 | datatype = None 114 | for arg_type in arg_type_names: 115 | datatype = self.datatypes.get_datatype(arg_type) 116 | if datatype: 117 | break 118 | if not datatype: 119 | datatype = self.datatypes.get_datatype(argument.name) 120 | if not datatype and ( 121 | argument.default_repr or get_arg_kind_default_value(argument.kind) 122 | ): 123 | datatype = self.datatypes.get_datatype("default_value") 124 | datatype_pk = datatype.pk if datatype and datatype.name != "default_value" else "-1" 125 | 126 | parameter = Parameter( 127 | pk=self.pk_generator.get_pk(), 128 | name=f"{self.parameter_name_prefix.get(argument.kind, '')}{argument.name}", 129 | datatype_ref=Ref(pk=datatype_pk), 130 | definition_type=DefinitionType.DETAILED, 131 | use_type=UseType.CALL_BY_VALUE, 132 | ) 133 | default_value = argument.default_repr or get_arg_kind_default_value(argument.kind) 134 | 135 | representative = ( 136 | self.datatypes.get_representative(datatype.name, default_value) 137 | if datatype 138 | else None 139 | ) 140 | if representative: 141 | parameter.default_value = DefaultValue( 142 | type_value="1", 143 | representative_ref=Ref(pk=representative.pk), 144 | type_attribute=DefaultValueType.REPRESENTATIVE, 145 | ) 146 | parameters.parameter.append(parameter) 147 | return_parameter = self.get_return_type_parameter(keyword) 148 | if return_parameter: 149 | parameters.parameter.append(return_parameter) 150 | return parameters 151 | -------------------------------------------------------------------------------- /libdoc2testbench/libdoc_generation.py: -------------------------------------------------------------------------------- 1 | import re 2 | import sys 3 | from pathlib import Path 4 | from typing import List 5 | 6 | from robot.libdocpkg import LibraryDocumentation 7 | from robot.libdocpkg.robotbuilder import LibraryDoc 8 | 9 | 10 | def create_libdoc( 11 | lib_or_res, lib_name: str, lib_version: str, doc_format: str, spec_format: str 12 | ) -> LibraryDoc: 13 | try: 14 | library_documentation = LibraryDocumentation(lib_or_res, lib_name, lib_version, doc_format) 15 | if spec_format == 'HTML': 16 | library_documentation.convert_docs_to_html() 17 | return library_documentation 18 | except Exception: 19 | sys.exit(f"The requested module {lib_or_res} could not be found.") 20 | 21 | 22 | def create_libdocs_from_import_list( 23 | import_list: Path, lib_name: str, lib_version: str, doc_format: str, spec_format: str 24 | ) -> List[LibraryDoc]: 25 | library_documentations = [] 26 | with Path(import_list).open(encoding='UTF-8') as library_list: 27 | first_line = library_list.readline() 28 | if not re.fullmatch(r'\*+\s*import\s?list(\s?\**)\n?', first_line, re.IGNORECASE): 29 | sys.exit( 30 | f"Import list {import_list} should contain the following header:" 31 | f" *** Import List ***" 32 | ) 33 | for line in library_list.read().splitlines(): 34 | if not line.strip().startswith('#') and len(line.strip()) != 0: 35 | library_documentation = create_libdoc( 36 | line.strip(), lib_name, lib_version, doc_format, spec_format 37 | ) 38 | library_documentations.append(library_documentation) 39 | return library_documentations 40 | 41 | 42 | def get_library_documentations( 43 | library_or_path: str, 44 | library_name: str, 45 | library_version: str, 46 | documentation_format: str, 47 | spec_format: str, 48 | ) -> List[LibraryDoc]: 49 | if not Path(library_or_path).exists() or Path(library_or_path).suffix in [".resource", ".py"]: 50 | libdocs = [ 51 | create_libdoc( 52 | library_or_path, library_name, library_version, documentation_format, spec_format 53 | ) 54 | ] 55 | else: 56 | libdocs = create_libdocs_from_import_list( 57 | Path(library_or_path), library_name, library_version, documentation_format, spec_format 58 | ) 59 | return libdocs 60 | -------------------------------------------------------------------------------- /libdoc2testbench/pk_generator.py: -------------------------------------------------------------------------------- 1 | class PKGenerator: 2 | """A class used to generate unique primary keys for test elements. 3 | Only one instance should be created and used to ensure continuous 4 | unique pks.""" 5 | 6 | def __init__(self, first_pk: int = 230): 7 | self.pk_counter = first_pk 8 | 9 | def get_pk(self) -> str: 10 | self.pk_counter += 1 11 | return str(self.pk_counter) 12 | -------------------------------------------------------------------------------- /libdoc2testbench/project_dump_builder.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime, timezone 2 | from pathlib import Path 3 | 4 | from robot.libdocpkg.robotbuilder import LibraryDoc 5 | from xsdata.formats.dataclass.context import XmlContext 6 | from xsdata.formats.dataclass.serializers import XmlSerializer 7 | from xsdata.formats.dataclass.serializers.config import SerializerConfig 8 | 9 | from libdoc2testbench.datatype_creator import CreatedDatatypes, DatatypeCreator 10 | from libdoc2testbench.interaction_creator import InteractionCreator 11 | from libdoc2testbench.pk_generator import PKGenerator 12 | from libdoc2testbench.project_dump_model import ( 13 | ProjectDump, 14 | TestElements, 15 | Testobjectversions, 16 | ) 17 | from libdoc2testbench.project_dump_model.itb_project_export import ( 18 | References, 19 | Subdivision, 20 | ) 21 | from libdoc2testbench.project_dump_model.model_api import ( 22 | create_project_details, 23 | create_project_dump, 24 | create_reference, 25 | create_settings, 26 | create_subdivision, 27 | create_testobjecversion, 28 | ) 29 | from libdoc2testbench.uid_generator import TestElementType, UidGenerator 30 | from libdoc2testbench.utils import print_stat, replace_invalid_characters 31 | 32 | 33 | class ProjectDumpBuilder: 34 | def __init__( 35 | self, 36 | repository: str, 37 | library_root_name: str, 38 | resource_root_name: str, 39 | create_attachment_references: bool, 40 | created_datatypes: CreatedDatatypes, 41 | ) -> None: 42 | self.repository = repository 43 | self.library_root_name = library_root_name 44 | self.resource_root_name = resource_root_name 45 | self.create_attachment_references = create_attachment_references 46 | self.created_datatypes = created_datatypes 47 | self.other_library_created = False 48 | self.other_resource_created = False 49 | self.pk_generator = PKGenerator() 50 | self.uid_generator = UidGenerator(repository) 51 | self.project_dump = self.initialize_project_dump( 52 | version="3.0", build_number="230202/6a0c", repository=repository 53 | ) 54 | 55 | def add_library_subdivision( 56 | self, libdoc: LibraryDoc, library_name_extension: str, resource_name_extension: str 57 | ): 58 | self.reference_pk = None 59 | library_name = replace_invalid_characters(libdoc.name) 60 | if libdoc.type == 'RESOURCE': 61 | resource_subdivision = self.create_resource_subdivision( 62 | libdoc, f"{library_name}{resource_name_extension}" 63 | ) 64 | self.resource_root_subdivision.element.append(resource_subdivision) 65 | else: 66 | library_subdivision = self.create_library_subdivision( 67 | libdoc, f"{library_name}{library_name_extension}" 68 | ) 69 | self.library_root_subdivision.element.append(library_subdivision) 70 | 71 | def create_library_subdivision(self, libdoc: LibraryDoc, subdivision_name: str) -> Subdivision: 72 | if not self.other_library_created: 73 | self.library_root_subdivision = create_subdivision( 74 | pk=self.pk_generator.get_pk(), 75 | name=self.library_root_name, 76 | description="Robot Framework Libraries", 77 | uid=self.uid_generator.get_uid(TestElementType.SUBDIVISION, self.library_root_name), 78 | ) 79 | self.project_dump.testobjectversions.testobjectversion[0].test_elements.element.append( 80 | self.library_root_subdivision 81 | ) 82 | self.other_library_created = True 83 | return self.create_library_subdivision_from_libdoc(libdoc, subdivision_name) 84 | 85 | def create_resource_subdivision(self, libdoc: LibraryDoc, subdivision_name: str) -> Subdivision: 86 | if not self.other_resource_created: 87 | self.resource_root_subdivision = create_subdivision( 88 | pk=self.pk_generator.get_pk(), 89 | name=self.resource_root_name, 90 | description="Robot Framework Resource Files", 91 | uid=self.uid_generator.get_uid( 92 | TestElementType.SUBDIVISION, self.resource_root_name 93 | ), 94 | ) 95 | self.project_dump.testobjectversions.testobjectversion[0].test_elements.element.append( 96 | self.resource_root_subdivision 97 | ) 98 | self.other_resource_created = True 99 | if self.create_attachment_references: 100 | self.reference_pk = self.pk_generator.get_pk() 101 | attachment_name = str(Path(libdoc.source).name) 102 | reference = create_reference( 103 | pk=self.reference_pk, 104 | attachment_path=str(Path(libdoc.source).parent.resolve()), 105 | filename=attachment_name, 106 | attachment_pk=self.pk_generator.get_pk(), 107 | attachment_filename=attachment_name, 108 | attachment_file_pk=self.pk_generator.get_pk(), 109 | ) 110 | self.project_dump.references.reference.append(reference) 111 | return self.create_library_subdivision_from_libdoc(libdoc, subdivision_name) 112 | 113 | def create_library_subdivision_from_libdoc( 114 | self, libdoc: LibraryDoc, subdivision_name: str 115 | ) -> Subdivision: 116 | library_subdivision = create_subdivision( 117 | pk=self.pk_generator.get_pk(), 118 | name=subdivision_name, 119 | uid=self.uid_generator.get_uid(TestElementType.SUBDIVISION, libdoc.name), 120 | html_description=( 121 | f"

Import of {libdoc.name} {libdoc.version}

{libdoc.doc}" 122 | ), 123 | ) 124 | datatype_creator = DatatypeCreator( 125 | libdoc, self.pk_generator, self.uid_generator, self.created_datatypes 126 | ) 127 | datatype_subdivision = datatype_creator.create_datatype_subdivision(libdoc.name) 128 | library_subdivision.element.append(datatype_subdivision) 129 | interaction_creator = InteractionCreator( 130 | libdoc, datatype_creator.datatypes, self.pk_generator, self.uid_generator 131 | ) 132 | interaction_creator.get_interactions(libdoc.keywords, self.reference_pk) 133 | library_subdivision.element.extend( 134 | interaction_creator.get_interactions(libdoc.keywords, self.reference_pk) 135 | ) 136 | num_datatypes = len( 137 | next(filter(lambda te: te.name == "_Datatypes", library_subdivision.element)).element 138 | ) 139 | num_interactinos = len(library_subdivision.element) - 1 140 | print_stat(libdoc, num_interactinos, num_datatypes) 141 | return library_subdivision 142 | 143 | def write_project_dump(self, path: Path): 144 | context = XmlContext() 145 | config = SerializerConfig( 146 | encoding="UTF-8", pretty_print=True, ignore_default_attributes=False 147 | ) 148 | serializer = XmlSerializer(config=config, context=context) 149 | with Path(path).open('w', encoding="utf-8") as project_dump: 150 | project_dump.write(serializer.render(self.project_dump)) 151 | 152 | def initialize_project_dump( 153 | self, version: str, build_number: str, repository: str 154 | ) -> ProjectDump: 155 | creation_time = datetime.now(tz=timezone.utc).strftime('%Y-%m-%d %H:%M:%S %z') 156 | references = References(reference=[]) if self.create_attachment_references else None 157 | return create_project_dump( 158 | version=version, 159 | build_number=build_number, 160 | repository=repository, 161 | details=create_project_details( 162 | name="RF Import", 163 | testobjectname="RF Import", 164 | created_time=creation_time, 165 | settings=create_settings(), 166 | ), 167 | references=references, 168 | testobjectversions=Testobjectversions( 169 | testobjectversion=[ 170 | create_testobjecversion( 171 | pk=self.pk_generator.get_pk(), 172 | id="RF Import", 173 | created_time=creation_time, 174 | description="Robot Framework Import", 175 | testing_intelligence="false", 176 | test_elements=TestElements(element=[]), 177 | ) 178 | ] 179 | ), 180 | ) 181 | -------------------------------------------------------------------------------- /libdoc2testbench/project_dump_model/__init__.py: -------------------------------------------------------------------------------- 1 | from libdoc2testbench.project_dump_model.itb_project_export import ( 2 | ActivityStatus, 3 | AdvancedContent, 4 | Automation, 5 | AutomationDetails, 6 | AutomationStatus, 7 | Baseline, 8 | BaselineDetails, 9 | Baselines, 10 | BinaryDigit, 11 | CalledLibraries, 12 | CalledLibrary, 13 | CallParameter, 14 | CallParameterType, 15 | CallSequence, 16 | ClassMapping, 17 | Condition, 18 | ConditionRef, 19 | Conditions, 20 | ConditionVersion, 21 | ConditionVersions, 22 | Datatype, 23 | DatatypeVersion, 24 | DatatypeVersions, 25 | DefaultCallType, 26 | DefaultCallTypeName, 27 | DefaultValue, 28 | DefaultValueType, 29 | DefectUserDefinedField, 30 | DefectUserDefinedFields, 31 | DefinitionType, 32 | Details, 33 | DmSettings, 34 | EquivalenceClass, 35 | EquivalenceClasses, 36 | ErrorId, 37 | ErrorIdReferences, 38 | ErrorIdRefs, 39 | ErrorIds, 40 | Errors, 41 | ExecLogfile, 42 | ExecLogfiles, 43 | Execution, 44 | ExecutionCycles, 45 | ExecutionDetails, 46 | ExecutionStatus, 47 | Field, 48 | Fields, 49 | ForeignLibraryLabel, 50 | ForeignLibraryLabelGroup, 51 | IdenticalVersionDatatype, 52 | IdenticalVersionDatatypeMapping, 53 | IdenticalVersionMetaword, 54 | IdenticalVersionMetawordMapping, 55 | IdenticalVersionMetawordParam, 56 | Instance, 57 | Instances, 58 | InstancesArray, 59 | InstancesArrays, 60 | Interaction, 61 | InteractionCall, 62 | InteractionCallPhase, 63 | InteractionCallType, 64 | InteractionVersion, 65 | InteractionVersions, 66 | Keyword, 67 | Keywords, 68 | KeywordsDefinition, 69 | KindOfDataType, 70 | Label, 71 | Labels, 72 | LabelsRef, 73 | LibraryInformation, 74 | LibraryLabel, 75 | LibraryLabelGroup, 76 | LibraryLabels, 77 | Marker, 78 | Message, 79 | MustField, 80 | OldVersions, 81 | Parameter, 82 | ParameterCombinationExec, 83 | ParameterCombinationsExec, 84 | ParameterCombinationSpec, 85 | ParameterCombinationsSpec, 86 | Parameters, 87 | ParameterValues, 88 | Placeholder, 89 | Placeholders, 90 | PlaceholderValue, 91 | PlaceholderValues, 92 | PriorityMapping, 93 | ProjectDetails, 94 | ProjectDump, 95 | ProjectRole, 96 | ProjectStatus, 97 | ProjectUser, 98 | Ref, 99 | Reference, 100 | ReferencedUserNames, 101 | ReferenceKind, 102 | References, 103 | Representative, 104 | Representatives, 105 | RepresentativeType, 106 | Requirement, 107 | RequirementChildren, 108 | RequirementNode, 109 | RequirementNodeType, 110 | RequirementProject, 111 | RequirementProjects, 112 | RequirementRefs, 113 | RequirementRepositories, 114 | RequirementRepository, 115 | Requirements, 116 | RequirementUdfs, 117 | Roles, 118 | SequencePath, 119 | Settings, 120 | Specification, 121 | SpecificationDetails, 122 | SpecificationStatus, 123 | StatusMapping, 124 | Subdivision, 125 | SubdivisionVersion, 126 | SubdivisionVersions, 127 | Testcase, 128 | Testcycle, 129 | Testcycles, 130 | TestElement, 131 | TestElements, 132 | TestElementVersionInfo, 133 | Testobjectversion, 134 | Testobjectversions, 135 | Testtheme, 136 | TestthemeChildren, 137 | Testthemes, 138 | TsePriority, 139 | UdfDefinition, 140 | UdfDefinitionType, 141 | Udfs, 142 | UdfSyncOption, 143 | UdfType, 144 | UdfValue, 145 | Undefined, 146 | UserDefinedField, 147 | UserDefinedFieldDefinition, 148 | UserDefinedFields, 149 | UserDefinedFieldsDefinition, 150 | UserMapping, 151 | UserMappings, 152 | Userroles, 153 | UseType, 154 | Value, 155 | Values, 156 | VariantsDefinition, 157 | VariantsDefinitions, 158 | VariantsMarker, 159 | VariantsMarkers, 160 | VerdictStatus, 161 | Version, 162 | VisibilityGroup, 163 | Warnings, 164 | ) 165 | 166 | __all__ = [ 167 | "DefectUserDefinedField", 168 | "DefectUserDefinedFields", 169 | "UserDefinedFieldDefinition", 170 | "UserDefinedFieldsDefinition", 171 | "ActivityStatus", 172 | "AdvancedContent", 173 | "Automation", 174 | "AutomationDetails", 175 | "AutomationStatus", 176 | "Baseline", 177 | "BaselineDetails", 178 | "Baselines", 179 | "BinaryDigit", 180 | "CallParameter", 181 | "CallParameterType", 182 | "CallSequence", 183 | "CalledLibraries", 184 | "CalledLibrary", 185 | "ClassMapping", 186 | "Condition", 187 | "ConditionRef", 188 | "ConditionVersion", 189 | "ConditionVersions", 190 | "Conditions", 191 | "Datatype", 192 | "DatatypeVersion", 193 | "DatatypeVersions", 194 | "DefaultCallType", 195 | "DefaultCallTypeName", 196 | "DefaultValue", 197 | "DefaultValueType", 198 | "DefinitionType", 199 | "Details", 200 | "DmSettings", 201 | "EquivalenceClass", 202 | "EquivalenceClasses", 203 | "ErrorId", 204 | "ErrorIdReferences", 205 | "ErrorIdRefs", 206 | "ErrorIds", 207 | "Errors", 208 | "ExecLogfile", 209 | "ExecLogfiles", 210 | "Execution", 211 | "ExecutionCycles", 212 | "ExecutionDetails", 213 | "ExecutionStatus", 214 | "Field", 215 | "Fields", 216 | "ForeignLibraryLabel", 217 | "ForeignLibraryLabelGroup", 218 | "IdenticalVersionDatatype", 219 | "IdenticalVersionDatatypeMapping", 220 | "IdenticalVersionMetaword", 221 | "IdenticalVersionMetawordMapping", 222 | "IdenticalVersionMetawordParam", 223 | "Instance", 224 | "Instances", 225 | "InstancesArray", 226 | "InstancesArrays", 227 | "Interaction", 228 | "InteractionCall", 229 | "InteractionCallType", 230 | "InteractionCallPhase", 231 | "InteractionVersion", 232 | "InteractionVersions", 233 | "Keyword", 234 | "Keywords", 235 | "KeywordsDefinition", 236 | "KindOfDataType", 237 | "Label", 238 | "Labels", 239 | "LabelsRef", 240 | "LibraryInformation", 241 | "LibraryLabel", 242 | "LibraryLabelGroup", 243 | "LibraryLabels", 244 | "Marker", 245 | "Message", 246 | "MustField", 247 | "OldVersions", 248 | "Parameter", 249 | "ParameterCombinationExec", 250 | "ParameterCombinationSpec", 251 | "ParameterCombinationsExec", 252 | "ParameterCombinationsSpec", 253 | "ParameterValues", 254 | "Parameters", 255 | "Placeholder", 256 | "PlaceholderValue", 257 | "PlaceholderValues", 258 | "Placeholders", 259 | "PriorityMapping", 260 | "ProjectDetails", 261 | "ProjectDump", 262 | "ProjectRole", 263 | "ProjectStatus", 264 | "ProjectUser", 265 | "Ref", 266 | "Reference", 267 | "ReferenceKind", 268 | "ReferencedUserNames", 269 | "References", 270 | "Representative", 271 | "RepresentativeType", 272 | "Representatives", 273 | "Requirement", 274 | "RequirementChildren", 275 | "RequirementNode", 276 | "RequirementNodeType", 277 | "RequirementProject", 278 | "RequirementProjects", 279 | "RequirementRefs", 280 | "RequirementRepositories", 281 | "RequirementRepository", 282 | "RequirementUdfs", 283 | "Requirements", 284 | "Roles", 285 | "SequencePath", 286 | "Settings", 287 | "Specification", 288 | "SpecificationDetails", 289 | "SpecificationStatus", 290 | "StatusMapping", 291 | "Subdivision", 292 | "SubdivisionVersion", 293 | "SubdivisionVersions", 294 | "TestElement", 295 | "TestElementVersionInfo", 296 | "TestElements", 297 | "Testcase", 298 | "Testcycle", 299 | "Testcycles", 300 | "Testobjectversion", 301 | "Testobjectversions", 302 | "Testtheme", 303 | "TestthemeChildren", 304 | "Testthemes", 305 | "TsePriority", 306 | "UdfDefinition", 307 | "UdfDefinitionType", 308 | "UdfValue", 309 | "UdfSyncOption", 310 | "UdfType", 311 | "Udfs", 312 | "Undefined", 313 | "UseType", 314 | "UserMapping", 315 | "UserMappings", 316 | "UserDefinedField", 317 | "UserDefinedFields", 318 | "Userroles", 319 | "Value", 320 | "Values", 321 | "VariantsDefinition", 322 | "VariantsDefinitions", 323 | "VariantsMarker", 324 | "VariantsMarkers", 325 | "VerdictStatus", 326 | "Version", 327 | "VisibilityGroup", 328 | "Warnings", 329 | ] 330 | -------------------------------------------------------------------------------- /libdoc2testbench/project_dump_model/model_api.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional, Union 2 | 3 | from libdoc2testbench.project_dump_model.itb_project_export import ( 4 | Baselines, 5 | BinaryDigit, 6 | CallSequence, 7 | Conditions, 8 | Datatype, 9 | DefaultCallType, 10 | DefaultCallTypeName, 11 | EquivalenceClass, 12 | EquivalenceClasses, 13 | Errors, 14 | Fields, 15 | InstancesArrays, 16 | Interaction, 17 | OldVersions, 18 | Parameters, 19 | Placeholders, 20 | PlaceholderValues, 21 | ProjectDetails, 22 | ProjectDump, 23 | ProjectStatus, 24 | Ref, 25 | Reference, 26 | ReferencedUserNames, 27 | ReferenceKind, 28 | References, 29 | Representative, 30 | Representatives, 31 | RequirementProjects, 32 | RequirementRepositories, 33 | RequirementUdfs, 34 | Settings, 35 | SpecificationStatus, 36 | Subdivision, 37 | Testcycles, 38 | TestElement, 39 | TestElements, 40 | Testobjectversion, 41 | Testobjectversions, 42 | Testthemes, 43 | Values, 44 | VariantsDefinitions, 45 | VariantsMarkers, 46 | Warnings, 47 | ) 48 | 49 | 50 | def create_subdivision( 51 | name: str, 52 | uid: str, 53 | pk: str, 54 | locker: str = "", 55 | description: str = "", 56 | html_description: str = "", 57 | history_pk: str = "-1", 58 | identical_version_pk: str = "-1", 59 | references: Union[References, None] = None, 60 | element: Optional[List[TestElement]] = None, 61 | ) -> Subdivision: 62 | if element is None: 63 | element = [] 64 | return Subdivision( 65 | name=name, 66 | uid=uid, 67 | pk=pk, 68 | locker=locker, 69 | description=description, 70 | html_description=html_description, 71 | history_pk=history_pk, 72 | identical_version_pk=identical_version_pk, 73 | references=references, 74 | element=element, 75 | ) 76 | 77 | 78 | def create_interaction( 79 | name: str, 80 | pk: str, 81 | uid: str, 82 | locker: str = "", 83 | description: str = "", 84 | html_description: str = "", 85 | history_pk: str = "-1", 86 | identical_version_pk: str = "-1", 87 | status: SpecificationStatus = SpecificationStatus.SPECSTATUS_INPROGRESS, 88 | default_call_type: DefaultCallType = DefaultCallType( 89 | name=DefaultCallTypeName.FLOW, value=BinaryDigit.FLOW 90 | ), 91 | preconditions: Conditions = Conditions(), 92 | postconditions: Conditions = Conditions(), 93 | parameters: Parameters = Parameters(), 94 | call_sequence: CallSequence = CallSequence(), 95 | references: References = References(), 96 | ) -> Interaction: 97 | return Interaction( 98 | name=name, 99 | pk=pk, 100 | uid=uid, 101 | locker=locker, 102 | description=description, 103 | html_description=html_description, 104 | history_pk=history_pk, 105 | identical_version_pk=identical_version_pk, 106 | status=status, 107 | default_call_type=default_call_type, 108 | preconditions=preconditions, 109 | postconditions=postconditions, 110 | parameters=parameters, 111 | call_sequence=call_sequence, 112 | references=references, 113 | ) 114 | 115 | 116 | def create_representative( 117 | pk: str, name: str, ordering: str, values: Values = Values() 118 | ) -> Representative: 119 | return Representative(pk=pk, name=name, ordering=ordering, values=values) 120 | 121 | 122 | def create_equivalence_class( 123 | pk: str, 124 | name: str, 125 | ordering: str, 126 | default_representative_ref: Ref, 127 | description: str = "", 128 | representatives: Representatives = Representatives(), 129 | ) -> EquivalenceClass: 130 | return EquivalenceClass( 131 | pk=pk, 132 | name=name, 133 | description=description, 134 | ordering=ordering, 135 | default_representative_ref=default_representative_ref, 136 | representatives=representatives, 137 | ) 138 | 139 | 140 | def create_datatype( 141 | name: str, 142 | pk: str, 143 | uid: str, 144 | locker: str = "", 145 | description: str = "", 146 | html_description: str = "", 147 | history_pk: str = "-1", 148 | identical_version_pk: str = "-1", 149 | status: SpecificationStatus = SpecificationStatus.SPECSTATUS_INPROGRESS, 150 | fields: Fields = Fields(), 151 | instances_arrays: InstancesArrays = InstancesArrays(), 152 | equivalence_classes: EquivalenceClasses = EquivalenceClasses(), 153 | ) -> Datatype: 154 | return Datatype( 155 | name=name, 156 | pk=pk, 157 | uid=uid, 158 | locker=locker, 159 | description=description, 160 | html_description=html_description, 161 | history_pk=history_pk, 162 | identical_version_pk=identical_version_pk, 163 | status=status, 164 | fields=fields, 165 | instances_arrays=instances_arrays, 166 | equivalence_classes=equivalence_classes, 167 | ) 168 | 169 | 170 | def create_settings( 171 | overwrite_exec_responsible: bool = False, 172 | optional_checkin: bool = False, 173 | filter_sync_interval: int = 30, 174 | ignore_not_edited: bool = False, 175 | ignore_not_planned: bool = True, 176 | designers_may_manage_baselines: bool = False, 177 | designers_may_import_baselines: bool = False, 178 | only_admins_manage_udfs: bool = False, 179 | variants_management_enabled: bool = False, 180 | ) -> Settings: 181 | return Settings( 182 | overwrite_exec_responsible=overwrite_exec_responsible, 183 | optional_checkin=optional_checkin, 184 | filter_sync_interval=filter_sync_interval, 185 | ignore_not_edited=ignore_not_edited, 186 | ignore_not_planned=ignore_not_planned, 187 | designers_may_manage_baselines=designers_may_manage_baselines, 188 | designers_may_import_baselines=designers_may_import_baselines, 189 | only_admins_manage_udfs=only_admins_manage_udfs, 190 | variants_management_enabled=variants_management_enabled, 191 | ) 192 | 193 | 194 | def create_project_details( 195 | name: str, 196 | testobjectname: str, 197 | html_description: str = "", 198 | description: str = "", 199 | created_time: str = "", 200 | id: str = "", # noqa: A002 201 | state: str = "active", 202 | customername: str = "", 203 | customeradress: str = "", 204 | contactperson: str = "", 205 | testlab: str = "", 206 | checklocation: str = "", 207 | startdate: str = "", 208 | enddate: str = "", 209 | status: ProjectStatus = ProjectStatus.ACTIVE, 210 | testing_intelligence: str = "false", 211 | settings: Settings = create_settings(), 212 | requirement_repositories: RequirementRepositories = RequirementRepositories(), 213 | requirement_projects: RequirementProjects = RequirementProjects(), 214 | requirement_udfs: RequirementUdfs = RequirementUdfs(), 215 | ) -> ProjectDetails: 216 | return ProjectDetails( 217 | name=name, 218 | id=id, 219 | testobjectname=testobjectname, 220 | state=state, 221 | customername=customername, 222 | customeradress=customeradress, 223 | contactperson=contactperson, 224 | testlab=testlab, 225 | checklocation=checklocation, 226 | startdate=startdate, 227 | enddate=enddate, 228 | status=status, 229 | description=description, 230 | html_description=html_description, 231 | testing_intelligence=testing_intelligence, 232 | created_time=created_time, 233 | settings=settings, 234 | requirement_repositories=requirement_repositories, 235 | requirement_projects=requirement_projects, 236 | requirement_udfs=requirement_udfs, 237 | ) 238 | 239 | 240 | def create_testobjecversion( 241 | pk: str, 242 | id: str = "", # noqa: A002 243 | startdate: str = "", 244 | enddate: str = "", 245 | status: ProjectStatus = ProjectStatus.ACTIVE, 246 | created_time: str = "", 247 | description: str = "", 248 | html_description: str = "", 249 | testing_intelligence: str = "", 250 | baselines: Baselines = Baselines(), 251 | placeholders: Placeholders = Placeholders(), 252 | variants_definitions: VariantsDefinitions = VariantsDefinitions(), 253 | variants_markers: VariantsMarkers = VariantsMarkers(), 254 | placeholder_values: PlaceholderValues = PlaceholderValues(), 255 | testcycles: Testcycles = Testcycles(), 256 | testthemes: Testthemes = Testthemes(), 257 | test_elements: TestElements = TestElements(), 258 | ) -> Testobjectversion: 259 | return Testobjectversion( 260 | pk=pk, 261 | id=id, 262 | startdate=startdate, 263 | enddate=enddate, 264 | status=status, 265 | created_time=created_time, 266 | description=description, 267 | html_description=html_description, 268 | testing_intelligence=testing_intelligence, 269 | baselines=baselines, 270 | placeholders=placeholders, 271 | variants_definitions=variants_definitions, 272 | variants_markers=variants_markers, 273 | placeholder_values=placeholder_values, 274 | testcycles=testcycles, 275 | testthemes=testthemes, 276 | test_elements=test_elements, 277 | ) 278 | 279 | 280 | def create_reference( 281 | pk: str, 282 | filename: str, 283 | attachment_pk: Union[str, None], 284 | attachment_path: Union[str, None], 285 | attachment_filename: Union[str, None], 286 | attachment_file_pk: Union[str, None], 287 | type_value: ReferenceKind = ReferenceKind.ATTACHMENT, 288 | version: str = "", 289 | old_versions: Optional[OldVersions] = None, 290 | ) -> Reference: 291 | return Reference( 292 | pk=pk, 293 | filename=filename, 294 | attachment_pk=attachment_pk, 295 | attachment_path=attachment_path, 296 | attachment_filename=attachment_filename, 297 | attachment_file_pk=attachment_file_pk, 298 | type_value=type_value, 299 | version=version, 300 | old_versions=old_versions, 301 | ) 302 | 303 | 304 | def create_project_dump( 305 | repository: str, 306 | details: ProjectDetails, 307 | testobjectversions: Testobjectversions = None, 308 | version: str = "", 309 | build_number: str = "", 310 | references: Union[References, None] = None, 311 | referenced_user_names: Union[ReferencedUserNames, None] = None, 312 | errors: Union[Errors, None] = None, 313 | warnings: Union[Warnings, None] = None, 314 | 315 | ) -> ProjectDump: 316 | return ProjectDump( 317 | details=details, 318 | testobjectversions=testobjectversions or Testobjectversions(), 319 | version=version, 320 | build_number=build_number, 321 | repository=repository, 322 | references=references, 323 | referenced_user_names=referenced_user_names or ReferencedUserNames(), 324 | errors=errors or Errors(), 325 | warnings=warnings or Warnings() 326 | ) 327 | -------------------------------------------------------------------------------- /libdoc2testbench/testbench_import_generator.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from argparse import Namespace 3 | from pathlib import Path 4 | from zipfile import ZipFile 5 | 6 | from libdoc2testbench.datatype_creator import CreatedDatatypes 7 | from libdoc2testbench.libdoc_generation import get_library_documentations 8 | from libdoc2testbench.project_dump_builder import ProjectDumpBuilder 9 | 10 | 11 | class TestBenchImportGenerator: 12 | def __init__(self, cli_args: Namespace) -> None: 13 | self.library_or_resource: str = cli_args.library_or_resource 14 | self.output_path: str = cli_args.outfile_path 15 | self.attachment: bool = cli_args.attachment 16 | self.library_root: str = cli_args.libraryroot 17 | self.resource_root: str = cli_args.resourceroot 18 | self.doc_format: str = cli_args.docformat 19 | self.spec_format: str = cli_args.specdocformat 20 | self.lib_name: str = cli_args.libname 21 | self.lib_version: str = cli_args.libversion 22 | self.repository: str = cli_args.repository 23 | self.lib_name_ext: str = cli_args.library_name_extension 24 | self.res_name_ext: str = cli_args.resource_name_extension 25 | self.created_datatypes: CreatedDatatypes = CreatedDatatypes[cli_args.created_datatypes] 26 | 27 | def create_project_dump(self) -> None: 28 | self.libdocs = get_library_documentations( 29 | self.library_or_resource, 30 | self.lib_name, 31 | self.lib_version, 32 | self.doc_format, 33 | self.spec_format, 34 | ) 35 | project_dump_path = self.get_project_dump_path() 36 | self.check_for_existing_dump(project_dump_path) 37 | self.write_temp_dump() 38 | self.save_project_dump(project_dump_path) 39 | 40 | def get_project_dump_path(self) -> str: 41 | project_dump_path = self.output_path 42 | if not project_dump_path: 43 | project_dump_path = ( 44 | f"{self.libdocs[0].name}.zip" if len(self.libdocs) == 1 else "project-dump.zip" 45 | ) 46 | elif Path(self.output_path).suffix.lower() not in [".zip", ".xml"]: 47 | sys.exit("Output path must end with '.xml' or '.zip'") 48 | return Path(project_dump_path) 49 | 50 | def write_temp_dump(self) -> None: 51 | project_dump = ProjectDumpBuilder( 52 | self.repository, 53 | self.library_root, 54 | self.resource_root, 55 | self.attachment, 56 | self.created_datatypes, 57 | ) 58 | for libdoc in self.libdocs: 59 | project_dump.add_library_subdivision(libdoc, self.lib_name_ext, self.res_name_ext) 60 | self.temp_path = Path.cwd() / Path("project-dump.xml") 61 | project_dump.write_project_dump(self.temp_path) 62 | 63 | def check_for_existing_dump(self, dump: Path) -> None: 64 | if dump.is_file(): 65 | user_input = input(f"'{dump}' already exists... overwrite? y/n? \n") 66 | if user_input.lower() not in ['y', 'yes']: 67 | sys.exit('Stopped execution - file was not changed.') 68 | Path(dump).unlink() 69 | 70 | def save_project_dump(self, dump_path: Path): 71 | if dump_path.suffix.lower() == ".xml": 72 | Path(self.temp_path).rename(str(dump_path)) 73 | else: 74 | self.write_zip_dump(dump_path) 75 | self.temp_path.unlink() 76 | print(f"Successfully written TestBench project dump to: \n{Path(dump_path).resolve()}") 77 | 78 | def write_zip_dump(self, project_dump_zip: Path): 79 | resources = list(filter(lambda libdoc: libdoc.type == "RESOURCE", self.libdocs)) 80 | with ZipFile(project_dump_zip, 'w') as zip_file: 81 | zip_file.write(self.temp_path, 'project-dump.xml') 82 | if resources and self.attachment: 83 | for libdoc in resources: 84 | if Path(libdoc.source).exists(): 85 | zip_file.write(libdoc.source, "attachments/" + Path(libdoc.source).name) 86 | -------------------------------------------------------------------------------- /libdoc2testbench/uid_generator.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | from hashlib import sha1 3 | from re import sub 4 | from typing import ClassVar 5 | 6 | 7 | class TestElementType(Enum): 8 | SUBDIVISION = "subdivision" 9 | INTERACTION = "interaction" 10 | DATATYPE = "datatype" 11 | 12 | 13 | class UidGenerator: 14 | type_abbrev: ClassVar = { 15 | TestElementType.SUBDIVISION: "SD", 16 | TestElementType.INTERACTION: "IA", 17 | TestElementType.DATATYPE: "DT", 18 | } 19 | 20 | def __init__(self, repository) -> None: 21 | self.repository = repository 22 | 23 | def get_uid( 24 | self, 25 | test_element_type: TestElementType, 26 | test_element_name: str, 27 | lib_name: str = "", 28 | ) -> str: 29 | # UIDs format: 30 | # Prefix: RepositoryID-ElementTypeAbbreviation-Root 31 | # Root: first 10 characters of sha1Hash of LibraryName.ElementName 32 | test_element_name = sub(r'[_ ]', "", test_element_name) 33 | test_element_name = test_element_name.lower() 34 | root_hash = sha1(f"{lib_name}.{test_element_name}".encode()).hexdigest()[:10] 35 | return f"{self.repository}-{self.type_abbrev.get(test_element_type)}-{root_hash}" 36 | -------------------------------------------------------------------------------- /libdoc2testbench/utils.py: -------------------------------------------------------------------------------- 1 | from re import sub 2 | 3 | from robot.libdocpkg.robotbuilder import LibraryDoc 4 | 5 | 6 | def replace_invalid_characters(name: str) -> str: 7 | return sub(r'[/."\'<>\\&,]', "_", name) 8 | 9 | 10 | def print_stat(libdoc: LibraryDoc, num_interactinos: int, num_datatypes: int) -> None: 11 | print(f"{libdoc.type.lower()}: {libdoc.name}") 12 | print(f" {num_interactinos} Interactions") 13 | if num_datatypes > 0: 14 | print(f" {num_datatypes} Data Types") 15 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [tool.mypy] 6 | python_version = "3.8" 7 | ignore_missing_imports = true 8 | no_implicit_optional = true 9 | strict_optional = true 10 | warn_return_any = true 11 | warn_no_return = true 12 | warn_unreachable = true 13 | pretty = true 14 | exclude = ["test_libraries/"] 15 | 16 | [tool.black] 17 | target-version = ['py38'] 18 | line-length = 100 19 | include_trailing_comma = false 20 | skip-string-normalization = true 21 | 22 | [tool.ruff] 23 | line-length = 100 24 | unfixable = [ 25 | "UP007" 26 | ] 27 | exclude = [ 28 | "__pycache__", 29 | "config.py", 30 | "model.py", 31 | "tests", 32 | "itb_project_export.py" 33 | ] 34 | ignore = [ 35 | "T201", 36 | "B008", # Todo: fix later 37 | "PLR0913", # Todo: fix later 38 | ] 39 | target-version = "py38" 40 | select = [ 41 | "E", 42 | "F", 43 | "W", 44 | "C90", 45 | "I", 46 | "N", 47 | "B", 48 | "PYI", 49 | "PL", 50 | "PTH", 51 | "UP", 52 | "A", 53 | "C4", 54 | "DTZ", 55 | "ISC", 56 | "ICN", 57 | "INP", 58 | "PIE", 59 | "T20", 60 | "PYI", 61 | "PT", 62 | "RSE", 63 | "RET", 64 | "SIM", 65 | "RUF" 66 | ] -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is autogenerated by pip-compile with Python 3.8 3 | # by the following command: 4 | # 5 | # pip-compile --extra=dev setup.cfg 6 | # 7 | astroid==3.0.1 8 | # via pylint 9 | black==23.11.0 10 | # via libdoc2testbench (setup.cfg) 11 | build==1.0.3 12 | # via 13 | # check-manifest 14 | # pip-tools 15 | certifi==2023.11.17 16 | # via requests 17 | charset-normalizer==3.3.2 18 | # via 19 | # docformatter 20 | # requests 21 | check-manifest==0.49 22 | # via libdoc2testbench (setup.cfg) 23 | click==8.1.7 24 | # via 25 | # black 26 | # click-default-group 27 | # pip-tools 28 | # xsdata 29 | click-default-group==1.2.4 30 | # via xsdata 31 | colorama==0.4.6 32 | # via 33 | # build 34 | # click 35 | # pylint 36 | # pytest 37 | coverage[toml]==7.3.2 38 | # via 39 | # coverage 40 | # pytest-cov 41 | dill==0.3.7 42 | # via pylint 43 | docformatter==1.7.5 44 | # via xsdata 45 | docutils==0.20.1 46 | # via readme-renderer 47 | exceptiongroup==1.2.0 48 | # via pytest 49 | flake8==6.1.0 50 | # via libdoc2testbench (setup.cfg) 51 | idna==3.6 52 | # via requests 53 | importlib-metadata==6.9.0 54 | # via 55 | # build 56 | # keyring 57 | # twine 58 | importlib-resources==6.1.1 59 | # via keyring 60 | iniconfig==2.0.0 61 | # via pytest 62 | isort==5.12.0 63 | # via pylint 64 | jaraco-classes==3.3.0 65 | # via keyring 66 | jinja2==3.1.2 67 | # via xsdata 68 | keyring==24.3.0 69 | # via twine 70 | markdown-it-py==3.0.0 71 | # via rich 72 | markupsafe==2.1.3 73 | # via jinja2 74 | mccabe==0.7.0 75 | # via 76 | # flake8 77 | # pylint 78 | mdurl==0.1.2 79 | # via markdown-it-py 80 | more-itertools==10.1.0 81 | # via jaraco-classes 82 | mypy==1.7.1 83 | # via libdoc2testbench (setup.cfg) 84 | mypy-extensions==1.0.0 85 | # via 86 | # black 87 | # mypy 88 | nh3==0.2.14 89 | # via readme-renderer 90 | packaging==23.2 91 | # via 92 | # black 93 | # build 94 | # pytest 95 | pathspec==0.11.2 96 | # via black 97 | pip-tools==7.3.0 98 | # via libdoc2testbench (setup.cfg) 99 | pkginfo==1.9.6 100 | # via twine 101 | platformdirs==4.0.0 102 | # via 103 | # black 104 | # pylint 105 | pluggy==1.3.0 106 | # via pytest 107 | pycodestyle==2.11.1 108 | # via flake8 109 | pyflakes==3.1.0 110 | # via flake8 111 | pygments==2.17.2 112 | # via 113 | # readme-renderer 114 | # rich 115 | pylint==3.0.2 116 | # via libdoc2testbench (setup.cfg) 117 | pyproject-hooks==1.0.0 118 | # via build 119 | pytest==7.4.3 120 | # via 121 | # libdoc2testbench (setup.cfg) 122 | # pytest-cov 123 | pytest-cov==4.1.0 124 | # via libdoc2testbench (setup.cfg) 125 | pytest-spec==3.2.0 126 | # via libdoc2testbench (setup.cfg) 127 | pywin32-ctypes==0.2.2 128 | # via keyring 129 | readme-renderer==42.0 130 | # via twine 131 | requests==2.31.0 132 | # via 133 | # requests-toolbelt 134 | # twine 135 | requests-toolbelt==1.0.0 136 | # via twine 137 | rfc3986==2.0.0 138 | # via twine 139 | rich==13.7.0 140 | # via twine 141 | robotframework==6.1.1 142 | # via libdoc2testbench (setup.cfg) 143 | ruff==0.1.6 144 | # via libdoc2testbench (setup.cfg) 145 | six==1.16.0 146 | # via pytest-spec 147 | tomli==2.0.1 148 | # via 149 | # black 150 | # build 151 | # check-manifest 152 | # coverage 153 | # mypy 154 | # pip-tools 155 | # pylint 156 | # pyproject-hooks 157 | # pytest 158 | tomlkit==0.12.3 159 | # via pylint 160 | toposort==1.10 161 | # via xsdata 162 | twine==4.0.2 163 | # via libdoc2testbench (setup.cfg) 164 | typing-extensions==4.7.1 165 | # via 166 | # astroid 167 | # black 168 | # mypy 169 | # pylint 170 | # rich 171 | # xsdata 172 | untokenize==0.1.1 173 | # via docformatter 174 | urllib3==2.1.0 175 | # via 176 | # requests 177 | # twine 178 | wheel==0.42.0 179 | # via 180 | # libdoc2testbench (setup.cfg) 181 | # pip-tools 182 | xsdata[cli]==23.8 183 | # via libdoc2testbench (setup.cfg) 184 | zipp==3.17.0 185 | # via 186 | # importlib-metadata 187 | # importlib-resources 188 | 189 | # The following packages are considered to be unsafe in a requirements file: 190 | # pip 191 | # setuptools 192 | -------------------------------------------------------------------------------- /res/example_usage.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbus/robotframework-libdoc2testbench/276e49afb0c87a37655f556560af697b8ac162a8/res/example_usage.gif -------------------------------------------------------------------------------- /res/example_usage.stg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbus/robotframework-libdoc2testbench/276e49afb0c87a37655f556560af697b8ac162a8/res/example_usage.stg -------------------------------------------------------------------------------- /res/projectmanagement_view.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbus/robotframework-libdoc2testbench/276e49afb0c87a37655f556560af697b8ac162a8/res/projectmanagement_view.gif -------------------------------------------------------------------------------- /res/projectmanagement_view.stg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbus/robotframework-libdoc2testbench/276e49afb0c87a37655f556560af697b8ac162a8/res/projectmanagement_view.stg -------------------------------------------------------------------------------- /res/test_element_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbus/robotframework-libdoc2testbench/276e49afb0c87a37655f556560af697b8ac162a8/res/test_element_view.png -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = robotframework-libdoc2testbench 3 | author = imbus AG 4 | version = attr: libdoc2testbench.__version__ 5 | description = Robot Framework Libdoc Extension that generates imbus TestBench Library import formats. 6 | long_description = file: README.md 7 | long_description_content_type = text/markdown 8 | license = Apache 2.0 License 9 | url = https://github.com/imbus/robotframework-libdoc2testbench 10 | platforms = any 11 | classifiers = 12 | Environment :: Console 13 | Programming Language :: Python :: 3 14 | Programming Language :: Python :: 3.8 15 | Operating System :: OS Independent 16 | License :: OSI Approved :: Apache Software License 17 | Topic :: Software Development :: Testing 18 | Topic :: Software Development :: Testing :: Acceptance 19 | Framework :: Robot Framework 20 | 21 | [options] 22 | zip_safe = False 23 | packages = find: 24 | python_requires = >= 3.8 25 | install_requires = 26 | robotframework >= 5.0, < 8.0 27 | xsdata 28 | 29 | [options.entry_points] 30 | console_scripts = 31 | libdoc2testbench = libdoc2testbench.__main__:run 32 | Libdoc2TestBench = libdoc2testbench.__main__:run 33 | 34 | [options.extras_require] 35 | dev = 36 | xsdata[cli] 37 | black 38 | flake8 39 | pylint 40 | mypy 41 | pytest 42 | pytest-cov 43 | pytest-spec 44 | check-manifest 45 | twine 46 | wheel 47 | setuptools 48 | ruff 49 | pip-tools 50 | 51 | [options.packages.find] 52 | exclude = 53 | tests 54 | -------------------------------------------------------------------------------- /xsdata_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | libdoc2testbench.ProjectDumpModel 5 | 6 | --------------------------------------------------------------------------------