Skip to main content

Robot Framework Libdoc Extension that generates imbus TestBench Library import formats.

Project description

Libdoc2TestBench

Robot Framework Libdoc extension that generates imbus TestBench Enterprise import formats. It can be used to generate Testbench interactions and datatypes from Robotframework libraries.


Installation:

To install this package you can use the following pip command:

pip install robotframework-libdoc2testbench

Notice: This extension requires Robot Framework 5.0.0 or later and does not work with earlier versions.


Usage:

There are three main use cases:

  • Import official Robot Framework librarys
  • Import custom Robot Framework librarys
  • Import Robot Framework resource files

Import official Robot Framework librarys

LibDoc2TestBench command demo

For the most basic usage you just have to pass a Robot Framework library as an argument to the Libdoc2TestBench command. 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.

Libdoc2TestBench <LIBRARY>

The <LIBRARY> argument corresponds to the Robot Framework library name that you would use to import the library in the *** Settings *** of a robot/resource file. The second positional argument can be used to specify the name of the generated zip-file:

Libdoc2TestBench <LIBRARY> <output.zip>

Import the generated TestBench zip-file

The generated zip-file can be imported via the Import Project... command in the Project Management view of the imbus TestBench:

Import Project Demo

Afterwards you'll find your imported RF library, the different interactions and the datatypes in the Test Elements view:

Test Element View

The imported Testelements can be copied into another testbench project. When copying, it is important that the test elements remain in the same subdivisions.

Import custom robotframework librarys

Libdoc2Testbench can also be used to import custom Robot Framework librarys.

Example for a custom library:

class mycustomlibrary(object):
    def print_hello_world(self):
        print("Hello World")

Example Libdoc2Testbench usage:

Libdoc2TestBench mycustomlibrary.py

Import Robot Framework resource files

Libdoc2Testbench can also be used to import Robot Framework resource files.

Example for a resource file:

*** Keywords ***
print hello world
  log Hello World

Example Libdoc2Testbench usage:

Libdoc2TestBench path/to/keywords.resource

Importing multiple librarys and resource files at once

Libdoc2Testbench can be used to import multiple librarys and resource files at once. A special robot framework section is used for this use case.

Example for a import List:

*** Import List ***
BrowserLibrary
BuiltIn
mycustomlibrary.py
myresource.resource

Example Libdoc2Testbench usage:

Libdoc2TestBench importlist.robot

Command line arguments

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.

Arguments Description Allowed Values
-h, --help Show the help message and exit
-a, --attachment Defines if the resource file, which has been used to generate the interactions, will be attached to those interactions.
-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
--libraryroot LIBRARYROOT Defines the subdivision name which contains the imported Robot Framework libraries. Default is RF.
--resourceroot RESOURCEROOT Defines the subdivision name which contains the imported Robot Framework resources. Default is Resource.
--libversion LIBVERSION Sets the version of the documented library or resource written in the description.
--libname Sets the name of the documented library or resource.
-r REPOSITORY, --repository REPOSITORY Sets the repository id of the TestBench import. The default is iTB_RF.
-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
--version, --info Writes the Libdoc2TestBench, Robot Framework and Python version to console.
--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].
--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].
--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.

Change log

  • 1.2
    • Added library keyword return types with RobotFramework version >= 7
    • Added datatype creation options with default values
    • Removed --xml cli option
    • Removed --temp cli option
  • 1.1
    • Added TestBench datatypes
    • Added default values
  • 1.0rc2
    • ADDED optional arguments for:
      • xml-file output (instead of zip-file)
      • custom temporary directory
      • changing the repository id in the xml-header
      • custom primary key enumeration start
      • info command for printing Libdoc2TestBench/Robot Framework/Python version to console
      • support for resource-files (attachment support coming soon)
    • FIX:
      • only create _Datatype subdivison in libraries when data types are present
      • Resource subdivison is now in the correct parent subdivision
      • Updated README.md / package help-messages to reflect changes
  • 1.0rc1
    • first release candidate

License

Distributed under the Apache-2.0 license. See LICENSE for more information.


Dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-libdoc2testbench-1.2.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file robotframework-libdoc2testbench-1.2.0.tar.gz.

File metadata

File hashes

Hashes for robotframework-libdoc2testbench-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e71a643c73b50e0798b8550174194ac9d813778e32adee2ac52895127d770435
MD5 258d0552370e213b34584eadcdb7ac43
BLAKE2b-256 acc80a4f01cc0a93fb0fd74ccf48d18107f6b4c119e43a388a7367444c77649e

See more details on using hashes here.

File details

Details for the file robotframework_libdoc2testbench-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_libdoc2testbench-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f7e2137fda87df88fc6e8d834dadf120b29ff668a4c97a3219322bb7054cf7b
MD5 b19f1b4ccc2af4d4d9c58fd5ecfe097f
BLAKE2b-256 aeeacf17a8b5c60d98bd509d44287fe31424c022a608e20a025f478a03ea67d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page