robotcodedev / robotframework-gherkin-parser

RobotFramework GherkinParser
Apache License 2.0
21 stars 4 forks source link

[BUG] Teardown methods call setup functions #5

Open appaji2020 opened 5 months ago

appaji2020 commented 5 months ago

Describe the bug I am trying to use gherkin parser. I observed that when i define Suite Teardown/Test Teardown, it calls setup method instead.

To Reproduce Steps to reproduce the behavior:

  1. Define hooks.resource as and https://github.com/robotcodedev/robotframework-gherkin-parser/blob/main/examples/simple/features/steps/hooks.resource and refer in https://github.com/robotcodedev/robotframework-gherkin-parser/blob/main/examples/simple/features/__init__.robot
  2. run a demo test
  3. In results I see SuiteTeardown called immediately after setup.
  4. Test Teardown calls the test setup method

gherkin parser error

If possible add some example source code like:

***Settings***
Library  Collections

***Test Cases***
a simple test
    do something    # this should shown something

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/ Videos If applicable, add screenshots or videos to help explain your problem.

Logs Copy the messages from VSCode "Output" view for RobotCode and RobotCode Language Server for the specific folder/workspace.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

psa-jbeaumont commented 2 months ago

A way to fix the behaviour is to patch GherkinParser/Library.py and introduce an event type switch (before- for setup, after- for teardown):