Adding Fake Arguement Does Not Allow Callonce File to be Cached Twice
See original GitHub issueWhen calling the same file twice using Callonce, adding a fake argument is supposed to cache the responses for each call, but instead the cache is being hit.
Feature: test set-up routines that run only once, similar to how @BeforeClass works
Background:
* url demoBaseUrl
* def firstCall = read('../callarray/kitten-create.feature')
* def secondCall = read('../callarray/kitten-create.feature')
* def firstResult = callonce firstCall kittens
* def secondResult = callonce secondCall kittens
Scenario Outline: various tests on the cats created
Given path 'cats'
When method get
Then status 200
And match response[*].name contains '<name>'
Examples:
| name |
| Bob |
| Nyan |
The result is kitten-create.feature gets called for every line of the Examples table, instead of being cached and only called once.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Adding Fake Arguement Does Not Allow Callonce File to be ...
When calling the same file twice using Callonce, adding a fake argument is supposed to cache the responses for each call, but instead...
Read more >Karate - callonce feature doesn't cache the response
1 Answer 1 ... It must be because you are using the IDE support / right-click / "run-as" option. This is an open...
Read more >Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework.
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
Cached response #. The problem. Let's inspect the interception object yielded by the cy.wait command. The interception does not the response ...
Read more >Using .NET: Avoid Common Performance Pitfalls for Speedier ...
It will allow reflection to go down an optimized, more efficient code path that does not perform argument type-coercion. If the argument types ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figured out the solution, can’t believe I didn’t think of it sooner. I need to move the test when the file get’s called twice into a separate Scenario that runs first in the .feature file. Then I can use callonce in the scenario outline to prevent all over 100 unnecessary requests from running, and bloating the log with over 1,000 extra lines.
Allowing
callonce
to function dynamically depending on where it’s placed in a feature file is still a better approach, in my opinion, but you don’t seem interested in pursing that line of thought.Appreciate your time in trying to help me solve this.
@NuttBoxer I just realized that if you were using the IDE “right-click and run-as” option to run tests in dev mode,
callonce
would NOT work at all. I always assumed that you were using the JUnit runner.In case you were using the IDE, perhaps this has contributed to some of the miscommunication, apologies 😐
I just fixed this in dev, here’s the issue reference: https://github.com/intuit/karate/issues/136