you can make the following changes in
the karate-config.js file like below,
function() {
var env = karate.env; // get java system property 'karate.env'
karate.log('karate.env system property was:', env);
if (!env) {
env = 'local'; // a custom 'intelligent' default
}
var config = { // base config
env: env,
profile: 'local',
DataSetUrl: 'http://localhost:9005/v0.2.4/',
DMUrl: 'http://localhost:8004/v0.2.3/',
SchemaUrl: 'http://localhost:8006/v0.2.3/',
URUrl: 'http://localhost:9005/v0.2.4/',
username: 'null',
password: 'null'
};
if (env == 'staging') {
// over-ride only those that need to be
var config = { // base config
env: env,
profile: 'staging',
baseUrl: 'staging url',
dbname: 'url2',
server_url: '12.12.12.12',
server_port: 31700,
username: 'mongo-staging-user',
dbname: 'db_name',
password: 'passoword'
};
}
}
// don't waste time waiting for a connection or if servers don't respond
// within 5 seconds
karate.configure('connectTimeout', 5000);
karate.configure('readTimeout', 5000);
return config;
}
For the Authorisation you can create a config.feature file which will look like this,
Feature: Auth
Scenario: Auth
* def Auth = 'auth'
And in the feature file you can use the urls and authorization
Feature: Test
Background:
* def config = call read('classpath:features/Config.feature')
* def auth = config.Auth
Scenario:1
* url DMUrl
Given path 'yourpath'
When method get
Then status 200
#
* url DataSetUrl
Given path 'yourpath'
When method get
Then status 200