I have a Karate test like this one. here I create an def = externalIdArray, and It has a view like -
[print] ["COUNTRY","NAME","SURNAME","SEX", "ID"]
and after I want to put this data from externalIdArray to Examples section and run the tests where every variable from array will be replaced instead of "@@@PRODUCT_ID@@@" so it should be 5 tests.
Is that possible to pass somehow the externalIdArray
into examples?
Feature: Testing data
Background:
* def app = Java.type('library.classes.application')
* configure retry = { count: 4, interval: 5000 }
* def config = { username: 'username', password: 'password', url: 'url', driverClassName: 'oracle' }
* def DbUtils = Java.type('library.classes.dbUtils')
* def db = new DbUtils(config)
Scenario Outline: Testing data
* def externalIds = db.readRows('SELECT EXTERNAL_ID FROM PRODUCT')
* def externalIdArray = karate.map(externalIds, function(x){ return x.EXTERNAL_ID })
* print externalIdArray
* def requestID = app.GenerateRequestId()
* def createRequest = karate.read('../model/request.xml')
* replace createRequest
| token | value |
| @@@REQUEST_ID@@@ | requestID |
| @@@PRODUCT_ID@@@ | <externalId> |
* print createRequest
And request createRequest
And method post
And print response
Then status 200
Examples:
| externalId |
| <externalIdArray> | ?????
I am expect all data from array will pass into examples section