Skip to content

Failed imports should fail suite they belong to #4774

@JonasSchares

Description

@JonasSchares

We encountered follwoing scenario while using a custom library: (RF 6.0, Python 3.10.8)
When the initialization of the custom library fails, the test execution is continued until the first keyword provided by that library is used. The result is a rather misleading "No keyword with name 'XY' found.".

Here is a minimal example:
ExampleLib.py:

class ExampleLib:
    ROBOT_LIBRARY_SCOPE = 'SUITE'
    ROBOT_LISTENER_API_VERSION = 3

    def __init__(self):
        # do init stuff
        raise Exception("something bad happened while doing init stuff")

    def sayHello(self):
        return "Hello World"

Example.robot:

*** Settings ***
Library    ExampleLib.py

*** Test Cases ***
Test SayHello
    ${res} =    Set Variable    "This is a String"
    ${res} =    sayHello
    Log To Console    ${res}

Result:
Result

It would be great to have the possibility to stop the test execution from within the custom libraries constructor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions