I have the following file karate-config-test.js
function fn() {
var env = karate.env; // get system property 'karate.env'
var baseUrl = "http://localhost:5000"
var config = {
env: env,
baseUrl: baseUrl
};
//open connection to message broker (mqtt, amqp)
var async_message = karate.callSingle('classpath:com/connect/apitests/commons/async_message/async_message.feature', config);
config.mqtt = async_message.mqtt
config.amqp = async_message.amqp
return config;
}
And the following feature async_message.feature
@ignore
Feature: utility that instance async message broker
Background:
* url baseUrl
Scenario: Set instance of a class AmqpUtils And MqttUtils
* def amqp = 'pippo'
Scenario: Set instance of a class MqttUtils
* def mqtt = 'pluto'
when i check the value of the variable async_message i see the variables of one scenario but not both, for example I saw only mqtt. Why is this happening? In karate documentation I read
- All variables that were defined (using def) in the 'called' script would be returned as 'keys' within a JSON-like object.