Skip to content

Batch Mode for @pytest_execute: Run All Tests in One Pytest Session #2

@jbraseth

Description

@jbraseth

https://github.com/petr-kus/pytest-in-robotframework/blob/a5cdad75ceea483368ce4e6eb175944bea8683e4/pytest_in_robotframework/pytest_in_robotframework.py

Hi Petr,

I'm using your plugin as per the (README). Our tests use session‑scoped fixtures (e.g. shared browser) and require detailed, step‑level Robot reports.

Currently, each test decorated with @pytest_execute triggers its own pytest.main(), starting a new session. This forces reinitialization of session‑scoped fixtures.

Example test:

@pytest_execute
@pytest.mark.description("Should open nav item")
def test_ui_scenario_step1(playwright_page):
    playwright_page.goto_mode("Composer")
    playwright_page.navbar.service_chain_profiles.open()
    assert playwright_page.navbar.is_panel_open(playwright_page.navbar.service_chain_profiles.name)

@pytest_execute
@pytest.mark.description("Nav item should still be open")
def test_ui_scenario_step2(playwright_page):
    assert playwright_page.navbar.is_panel_open(playwright_page.navbar.service_chain_profiles.name)

Robot suite calls:

*** Settings ***
Library    ui.test_scenario

*** Test Cases ***
Module scoped test
    Test UI Scenario Step1    opscenter_scenario
    Test UI Scenario Step2    opscenter_scenario

Is it possible to add a batch execution mode and call pytest.main() once? That way session‑scoped fixtures are shared and each test can yield step‑level data in the Robot report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions