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.0.tar.gz (8.3 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.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_robotframework-1.0.0.tar.gz
  • Upload date:
  • Size: 8.3 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.0.tar.gz
Algorithm Hash digest
SHA256 76d1d56cfb0ecf4709930c32d1e419c73d38ce370e63156042048cb5b737b670
MD5 bca873c1592fb93c7f560009431ebd71
BLAKE2b-256 75a7526f37543adb7e82dabd2310a943b9ba6b88ab8dc512f55cfe2cc34d9d6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_robotframework-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59fc700a039ab5f0fb2d186a24a7998d3798535350ca508114f40b3cd1be98b6
MD5 f4aac15ce624c23ad857dfe0d4aeee88
BLAKE2b-256 084658e1b91ea163914d09368d0be02b150cbac7b09e0464a5cf95164faadcc0

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

1.0.1

2 files

This release

1.0.0 This release

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