I wanted to write a scenario for testing my soap api with multiple soap requests. One thing that i could do is make use of karate CSV file feature to test that scenario with varying data coming from csv. Now since my requests have multiple records like sited below :
<ExternalKeys>
<Key name="MASTERCATALOGNAME" type="string">SYSTEM</Key>
<Key name="PRODUCTID" type="string">SYS1</Key>
</ExternalKeys>
It will not be possible to keep multiple key in csv. Can some one please suggest a alternative? In REST we did it by keeping all json requests in a array and calling it by __row or using the below way :
Feature: Sample feature
Background:
* url restBaseApi
* header Authorization = token
# Reading file using feature to reduce Memory
* def dataRequest = callonce read('ReadFiles.feature')
# gets current time in milli second and is appended Request Header to ObjectID to create unique request ID
* def now = function(){ return java.lang.System.currentTimeMillis() }
# Read the Request Header for each Request
* def headerRequest = read('../data/requestHeader.json')
Scenario Outline: Individual Rule
Given path RestEndPoint
* def sRequest = get[0] dataRequest.gdataRequest[?(@.testReference == '<TEST_REF>')]
* remove sRequest.testReference
* set sRequest.RequestHeader = headerRequest
* set sRequest.RequestHeader.ObjectId = 'SB1000' + now()
* karate.log ('Request is :',sRequest)
And request sRequest
When method POST
Then status 200
* karate.log ('Response is :',response)
And match response.eResponse.stage == '<STAGE>'
* match response.eResponse.Response.responseDetails.code == “PME200"
* match response.eResponse.ObjectId == sRequest.RequestHeader.ObjectId
Examples:
| TEST_REF | STAGE |
| TC01 | In progress |
| TC02 | closed |
Please suggest a alternative to this way in SOAP. How to keep multiple soap request xmls in a file? Or some other way