Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callonce seems to be called more than once through ignored scenarios #2292

Closed
phipgn opened this issue Apr 5, 2023 · 1 comment
Closed
Labels

Comments

@phipgn
Copy link

phipgn commented Apr 5, 2023

Hi there, not sure if this is an issue or not, but it's still worth asking I think.

I have test2.feature like this:

Feature: Test 2

Background:

@ignore @scenario1
Scenario: Scenario 1
    * print "Hello from Test 2 - Scenario 1"

And test.feature like this:

Feature: Test 1

    Background:
        * callonce read('test2.feature@scenario1')

    Scenario: Scenario 1
        * print 'Hello from Test 1 - Scenario 1'

    Scenario: Scenario 2
        * print 'Hello from Test 1 - Scenario 2'

When I execute test.feature, it looks good, test2.feature@scenario1 is only called once, which is as expected:
image

Now I change test.feature to be like this: An ignored scenario (scenario0) added, then call to that one from Scenario 1 and 2.

Feature: Test 1

    Background:
        * callonce read('test2.feature@scenario1')

    @ignore @scenario0
    Scenario: Scenario 0
        * print 'Hello from Test 1 - Scenario 0'

    Scenario: Scenario 1
        * call read('@scenario0')
        * print 'Hello from Test 1 - Scenario 1'

    Scenario: Scenario 2
        * call read('@scenario0')
        * print 'Hello from Test 1 - Scenario 2'

This time, test2.feature@scenario1 is called 3 times (1 for Background, and 2 for every time we call the ignored (scenario0). I expect that test2.feature@scenario1 should be always called once no matter what. Please kindly let me know if I am expecting it correctly? Thank you very much.
image

@phipgn phipgn changed the title callonce seems to be called many times through ignored scenarios callonce seems to be called more than once through ignored scenarios Apr 5, 2023
@ptrthomas
Copy link
Member

@phipgn this is a very complicated case (background, ignore, call by tag) and I insist that you follow this process to reopen: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

I know this may sound like a lot of work, but we explain why we ask for this in the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants