#selenium
#api
#manualtesting
#automationtesting
#testautomationframework
#framework
#seleniumwebdriver
#seleniumjava
#webautomation
#postman
#postmanapitesting
#java
#maven
#maventutorial
#karate
#karaterestapitesting
#restapi
#restapiautomation
#apitesting
#malayalam
#softwaretesting
#beginners
#മലയാളം
#TheTestingInstinct
#tutorials
The video describes about Use of configuration file karate-config.js in Karate.
karate-config.js file needs to be added under classpath.
It contain a JavaScript function. The function is expected to return a JSON object
and all keys and values in that JSON object will be made available as script variables.
Uses:
store global variables.
configure request url/header/body/proxy/parameter/authentication/retry/soft assertion etc.
Dynamically change variable values based on environment.
The global variables/configuration added under karate-config.js file added across all feature files
in the project.
function fn() {
var env = karate.env; // get java system property 'karate.env'
karate.log('karate.env system property was:', env);
if (!env) {
env = 'dev'; // a custom 'intelligent' default
}
var config = { // base config JSON
appId: 'my.app.id',
appSecret: 'my.secret',
someUrlBase: 'https://some-host.com/v1/auth/',
anotherUrlBase: 'https://another-host.com/v1/'
};
if (env == 'stage') {
// over-ride only those that need to be
config.someUrlBase = 'https://stage-host/v1/auth';
} else if (env == 'e2e') {
config.someUrlBase = 'https://e2e-host/v1/auth';
}
// 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;
}
Github: https://github.com/thetestinginstinct...
Video chapters:
0:00 Introduction, Agenda, Uses
2:01 Demo - Creating karate-config.js, add variables and reusing it in feature file
Git tutorial link: • Introduction to Git and GitHub. An importa...
Playlist link: • Karate REST API Test Automation|REST API T...
Java configuration video link: • Configure Java in Windows OS|Core Java for...
Eclipse IDE installation link: • Install Eclipse IDE in Windows| Learn Sele...
Maven configuration video link: • Configure Apache Maven in Windows| Learn S...
Postman Playlist link: • Postman Rest API Testing | Become an exper...