0

Actually I had one scenario in which I need to use a variable inside while loop in eval block and the value for that variable changes in every iteration. So is it possible to get the value of that variable from another feature file ?

Feature: Testing API with multiple different URL's

Scenario: Testing 
* def URLforTesting = {testURL : 'Google.com'}
* eval
"""
while(URLforTesting!=null)
{
karate.call('xyz.feature',URLforTesting ) 
URLforTesting = ??? // Is there any way I can update this variable 
                       inside loop with a value that got generated in 
                       another feature file ?
}
"""

In this feature file I will be calling an API and passing URL in argument. In its response I will be getting the next URL(Pagination)

FYI : I had one function in feature file xyz.feature which returns the value in same format as it requires for URLforTesting . Just the thing is I am not able to fetch that value from xyz.feature

Jakson
  • 57
  • 3
  • sorry you need to work on this question a lot, I could not understand anything. provide at least some example code - I also recommend that you never write such "clever" tests: https://stackoverflow.com/a/50350442/143475 – Peter Thomas Jan 12 '22 at 14:35
  • @PeterThomas I tried again. Will it be possible to achieve? – Jakson Jan 12 '22 at 15:14
  • this is easy to answer. the answer is no. also please don't write loops by hand: https://github.com/karatelabs/karate#loops – Peter Thomas Jan 12 '22 at 15:39

0 Answers0