Sometimes you want to pass few data when calling another feature file inside a scenario. This data can be anything from a particular response data to entire response file.
In the example below I’m first trying to get all the Repository from my GIT and then passing the entire list of repository to another feature while which will then delete all the repositories until some conditions are met.
We will first see the Get All Repo Feature file, which also acutally calls the delete.I’m using the “Background” keyword to set the Authorization header for the API.

Feature: Delete all repo in GIT using karate
Background: Set the baseURL and call the authentication file
* url baseURL
* header Authorization = call read('basic-auth.js')
Scenario: Deleting a repo and verifying the response
* retry until responseStatus == 200
# change the endpoint to GET
* configure retry = { interval: 1000, count: 10 }
* path '/user/repos'
* method get
* def allRepo = response
* def createRepoResponse = call read('deleteRepoUntil.feature') {'**value**' : #allRepo}
* retry until responseStatus == 205
* print createRepoResponse
We will now see how the data is used in the called feature file

Feature: Delete all repo in GIT using karate
Background: Set the baseURL and call the authentication file
* url baseURL
* header Authorization = call read('basic-auth.js')
Scenario: Deleting a repo and verifying the response
* def value = response
* def myRepoName = $value..name
* print myRepoName
* retry until responseStatus == 404
#match the response with the name that was generated
* def jsonValue = function(){for(var i = 0; i < myRepoName.length; i++) { return myRepoName[i];}}
#using karate.filter to find out repo
#* def myRepo = karate.filter(allRepo, filterandfind)
* def value1 = call jsonValue
* print value1
* path '/repos/'+username+'/'+value1
* method delete
#verify the status code
* status 204 OR 404
* print response