Skip to content

Expose special exceptions via robot.api #3685

@pekkaklarck

Description

@pekkaklarck

By default exceptions raised by library keywords stop executing the current test (except for possible teardown) and move execution to the next test. We have, however, some special exceptions that change this logic:

  • Continuable failures allow execution to continue. The test will be marked failed in the end anyway.
  • Fatal errors stop the whole test execution.
  • Skip marks the test skipped, not failed.

The way users can mark exceptions continuable or fatal is by adding special attribute ROBOT_CONTINUE_ON_FAILURE or ROBOT_EXIT_ON_FAILURE, respectively, and the plan is to support the same approach with skip as well. There have been two reasons for using special attributes instead of exposing custom exceptions via the robot.api module:

  • Attributes work also with Java based exceptions when using Jython.
  • We wanted it to be possible to write library code without needing to have a dependency to the robot module.

Both of the above reasons are still valid, but it would nevertheless often be useful to be able to import custom exceptions directly without a need to create them. I propose the following:

  • Create custom exceptions for continuable failures, fatal errors and skip.
  • Expose them via the robot.api module.
  • Internally keep using the special attributes for detecting these special exceptions. This means that all old code will continue to work.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions