Skip to main content

pytest-robotframework

a pytest plugin to generate robotframework reports without having to write your tests in the robot langauge

install

poetry add pytest-robotframework --group=dev

usage

pytest should automatically find and activate the plugin once you install it, so all you should have to do is write tests with pytest like you would normally:

# you can use both robot and pytest features
from robot.api import logger
from pytest import Cache

from pytest_robotframework import keyword

@keyword  # make this function show as a keyword in the robot log
def foo():
    ...


def test_foo(cache: Cache):
    foo()

robot command line arguments

specify robot CLI arguments with the --robotargs argument:

pytest --robotargs="-d results --listener foo.Foo"

some arguments such as --extension obviously won't work .

setup/teardown and other hooks

to define a function that runs for each test at setup or teardown, create a conftest.py with a pytest_runtest_setup and/or pytest_runtest_teardown function:

# ./tests/conftest.py
def pytest_runtest_setup():
    log_in()
# ./tests/test_suite.py
def test_something():
    """i am logged in now"""

these hooks appear in the log the same way that the a .robot file's Setup and Teardown options in *** Settings *** would:

for more information, see writing hook functions. pretty much every pytest hook should work with this plugin but i haven't tested them all. please raise an issue if you find one that's broken.

tags/markers

pytest markers are converted to tags in the robot log:

from pytest import mark

@mark.slow
def test_blazingly_fast_sorting_algorithm():
    [1,2,3].sort()

Download files

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

Source Distribution

pytest_robotframework-1.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_robotframework-1.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest_robotframework-1.0.1.tar.gz.

File metadata

  • Download URL: pytest_robotframework-1.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.4 Linux/5.15.0-1042-azure

File hashes

Hashes for pytest_robotframework-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1b6ed32011466e641d987117e866faf6e475812a09cfab9bfa70a15edf8db121
MD5 29b476a58d45742479e21d6b14023b3b
BLAKE2b-256 5c7b773e1e8489f704d3f1a2deb3274c26caf06a3b8e1ba3b817cb9617eb9c7e

See more details on using hashes here.

File details

Details for the file pytest_robotframework-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_robotframework-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21c45c2174545302d1fcba7cf98d73121e1c6f34e088aab564c36be136ac6fc1
MD5 22c11f69aa62b1cca277c21628c8012d
BLAKE2b-256 b2d489c7944f2779d6fb403b5ee130522d30b4a9e2fad82fb02254f51ce26cd5

See more details on using hashes here.

Release history Release notifications | RSS feed

4.6.3

2 files

4.6.2

2 files

4.6.1

2 files

4.6.0

2 files

4.5.0

2 files

4.4.1.post1

2 files

4.4.1

2 files

4.4.0.post2

2 files

4.4.0.post1

2 files

4.4.0

2 files

4.3.2

2 files

4.3.1

2 files

4.3.0

2 files

4.2.6

2 files

4.2.5

2 files

4.2.4

2 files

4.2.3

2 files

4.2.2

2 files

4.2.1

2 files

4.2.0

2 files

4.1.4

2 files

4.1.3

2 files

4.1.2

2 files

4.1.1

2 files

4.1.0

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

4.0.0

2 files

3.2.1

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.1

2 files

3.0.0

2 files

2.5.2

2 files

2.5.1

2 files

2.5.0

2 files

2.4.0

2 files

2.3.1

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.10.3

2 files

1.10.2

2 files

1.10.1

2 files

1.10.0

2 files

1.9.0

2 files

1.8.3

2 files

1.8.2

2 files

1.8.1

2 files

1.8.0

2 files

1.7.2

2 files

1.7.1

2 files

1.7.0

2 files

1.6.2

2 files

1.6.1

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page