Skip to main content

Tools to ease creating larger test libraries for Robot Framework using Python.

Project description

Tools to ease creating larger test libraries for Robot Framework using Python. The Robot Framework hybrid and dynamic library API gives more flexibility for library than the static library API, but they also sets requirements for libraries which needs to be implemented in the library side. PythonLibCore eases the problem by providing simpler interface and handling all the requirements towards the Robot Framework library APIs.

Code is stable and version 1.0 is already used by SeleniumLibrary and WhiteLibrary. The version 2.0 support changes in the Robot Framework 3.2.

https://github.com/robotframework/PythonLibCore/workflows/CI/badge.svg?branch=master

Usage

There are two ways to use PythonLinCore, either by HybridCore or by using DynamicCore. HybridCore provides support for the hybrid library API and DynamicCore provides support for dynamic library API. Consult the Robot Framework User Guide, for choosing the correct API for library.

Regardless which library API is chosen, both have similar requirements.

  1. Library must inherit either the HybridCore or DynamicCore.

  2. Library keywords must be decorated with Robot Framework @keyword decorator.

  3. Provide a list of class instances implementing keywords to library_components argument in the HybridCore or DynamicCore __init__.

It is also possible implement keywords in the library main class, by marking method with @keyword as keywords. It is not requires pass main library instance in the library_components argument.

All keyword, also keywords implemented in the classes outside of the main library are available in the library instance as methods. This automatically publish library keywords in as methods in the Python public API.

The example in below demonstrates how the PythonLibCore can be used with a library.

Example

"""Main library."""

from robotlibcore import DynamicCore

from mystuff import Library1, Library2


class MyLibrary(DynamicCore):
    """General library documentation."""

    def __init__(self):
        libraries = [Library1(), Library2()]
        DynamicCore.__init__(self, libraries)

    @keyword
    def keyword_in_main(self):
        pass
"""Library components."""

from robotlibcore import keyword


class Library1(object):

    @keyword
    def example(self):
        """Keyword documentation."""
        pass

    @keyword
    def another_example(self, arg1, arg2='default'):
        pass

    def not_keyword(self):
        pass


class Library2(object):

    @keyword('Custom name')
    def this_name_is_not_used(self):
        pass

    @keyword(tags=['tag', 'another'])
    def tags(self):
        pass

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-pythonlibcore-2.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

robotframework_pythonlibcore-2.0.2-py2.py3-none-any.whl (9.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file robotframework-pythonlibcore-2.0.2.tar.gz.

File metadata

  • Download URL: robotframework-pythonlibcore-2.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for robotframework-pythonlibcore-2.0.2.tar.gz
Algorithm Hash digest
SHA256 43c35e17dcd4fd6e5fa28cb1a5851936244677985f96c9dadfafb8dd22f5a401
MD5 5c56fa230fdf4617fd3f7ab193838aa7
BLAKE2b-256 bfcbb2f687a8bd45cb3c4dda87a52d2bee9b74455c3e123e8adeaeba74e42259

See more details on using hashes here.

File details

Details for the file robotframework_pythonlibcore-2.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: robotframework_pythonlibcore-2.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for robotframework_pythonlibcore-2.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5d810fa324a51f2743e277d66f05cb0a044c949337e9d707f260556dc802ded9
MD5 4cebd004dcb6e71e5a62a9424487f406
BLAKE2b-256 f18c3119fe9235520f54447b6e5ce02d7e3f4afb45fbc41658ca89e4df01de3f

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