How to pass values as parameters dynamically to java program using karate framework.
I am trying to read the data from csv file. which is converted to json format
Csv Data
FirstName,MiddleName,LastName
"John","K","Kennady"
"Mahesh","g",Readdy"
* def csvData = read('csv Data')
* read csvData
Output of read csvData
[{"FirstName" : "John","MiddleName" : "K", "LastName" : "Kennady"},{"FirstName" : "Mahesh","MiddleName" : "g", "LastName" : "Readdy"}]
I am able to extract the values from json and the result looks like this
values = ["John", "K", "Kennady"]
I should pass the values as paramters to below command JavaDemo.doWorkStatic
* def JavaDemo = Java.type('com.mycompany.JavaDemo')
* def result = JavaDemo.doWorkStatic('Firstname','MiddleName','lastname')
in javascript we can assign array to array which can assign to arguments for java . But the below step is not possible in karateframework
[a, b ,c ] = Values
cosnole.log(a)
cosnole.log(b)
cosnole.log(c)
def result = JavaDemo.doWorkStatic(a,b,c)
How can i acheive the final step passing the values as arguments
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…