diff --git a/karate-core/src/main/java/com/intuit/karate/core/ScenarioEngine.java b/karate-core/src/main/java/com/intuit/karate/core/ScenarioEngine.java index a38d14dd0..e861386c4 100644 --- a/karate-core/src/main/java/com/intuit/karate/core/ScenarioEngine.java +++ b/karate-core/src/main/java/com/intuit/karate/core/ScenarioEngine.java @@ -1930,10 +1930,12 @@ public Variable call(Variable called, Variable arg, boolean sharedScope) { case JAVA_FUNCTION: return arg == null ? executeFunction(called) : executeFunction(called, new Object[]{arg.getValue()}); case FEATURE: - // will be always a map or a list of maps (loop call result) + // will be always a map or a list of maps (loop call result) Object callResult = callFeature(called.getValue(), arg, -1, sharedScope); - recurseAndAttach(callResult); - return new Variable(callResult); + synchronized (runtime.featureRuntime.suite) { // make sure any artifacts from a callonce / callsingle are handled + recurseAndAttach(callResult); + return new Variable(callResult); + } default: throw new RuntimeException("not a callable feature or js function: " + called); } diff --git a/karate-core/src/test/java/com/intuit/karate/core/parallel/parallel-outline-1.feature b/karate-core/src/test/java/com/intuit/karate/core/parallel/parallel-outline-1.feature index 6d07fecfe..1a2c1330b 100644 --- a/karate-core/src/test/java/com/intuit/karate/core/parallel/parallel-outline-1.feature +++ b/karate-core/src/test/java/com/intuit/karate/core/parallel/parallel-outline-1.feature @@ -7,10 +7,10 @@ Background: * def data = [ { name: 'value1' }, { name: 'value2' }, { name: 'value3' }, { name: 'value4' } ] # java object that comes from a callSingle in the config * def helloClass = HelloConfigSingle -* callonce read('call-once-from-feature.feature') + * callonce read('call-once-from-feature.feature') Scenario Outline: - # * call read('called.feature') + * call read('called.feature') * match functionFromKarateBase() == 'fromKarateBase' * path 'fromfeature' * method get