Whenever I try to call the feature file(one.feature) from another feature file(starter.feature), I am not able to access the info(caller) in specific scenario
But It is working fine and I am able to access info(caller),
- when I run one.feature file standalone.
- when I run one.feature file through Junit test case.
CODE WORK-FLOW : In one.feature : In the scenario(Scenario: matching two Strings) we are trying to match two Strings and configuring afterScenario JS function to get the info of the scenario and If the info contains any errors, The function will call the other scenario(Scenario: getting caller details) with info details assigned in the variable caller
starter.feature :
Feature: call another feature
Scenario: calling feature file
* def callFeat = call read('one.feature')
one.feature :
Feature: get details
Background:
* configure afterScenario =
"""
function() {
var info = karate.info;
if(info.errorMessage){
karate.call('one.feature@CallCaller', { caller : info });
}
}
"""
@CreateErrorMsg
Scenario: matching two Strings
* def Text1 = 'Hey'
* def Text2 = 'Hello'
* match Text1 == Text2
@CallCaller @ignore
Scenario: getting caller details
* print caller