Skip to content

Keyword type passed to listeners is wrong with for loops and keyword teardowns #2248

Closed

Description

@pekkaklarck

Keyword type was added to start/end_keyword listeners methods in RF 2.6 (#859). At that time it was decided to use types Suite Setup, Suite Teardown, Test Setup, Test Teardown, and Keyword, and that setup/teardown types are used with all keywords that are executed as part of setup/teardown.

Issue #2227 originally reported problems with keyword types when running for loops. After some investigation, we learned that there are several problems with the current keyword type reporting:

  • As reported by Keyword type passed to listeners is wrong then keyword is for loop #2227, keyword types are wrong with for loops. The current implementation basically doesn't take for loops into account at all.
  • Also keyword teardowns are reported wrong.
  • The fact that all keywords that are used as setup/teardown get setup/teardown type means that we cannot correctly report for loops or keyword teardowns when they are used in setup/teardown.

After thinking various possibilities (see #2227 for discussion), we decided to change the keyword type reporting like this:

  • Only the top level setup/teardown keyword is reported as setup/teardown. This is backwards incompatible change but we don't think it can be avoided.
  • Types Setup and Teardown are used with all setup/teardown keywords. If there is a need to separate e.g. test setups and suite setups, listeners need to keep track is current keyword executed as part of a test or a suite.
  • Keyword teardowns are get type Teardown similarly as other teardowns.
  • For loops get type For and individual for loop iterations get type For Item.
  • Normal keywords get type Keyword like earlier.

As a result, keyword type can be on of the following:

  • Keyword
  • Setup
  • Teardown
  • For
  • For Item

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions