I'm reading an xml file to build it dynamically using a table.
Scenario: Create subscriber base
* table data
|PaidMode|BillCycleCredit|BillCycleType|PrimaryOffer|SubscriberNo |
|'0' |'100000' |'1' |'500033' |'#(postPaidSubscriber1)'|
|'0' |'100001' |'1' |'500035' |'#(postPaidSubscriber2)'|
* def Request = read('newSubscriber.xml')
And request Request
* print Request
My xml file (exert):
<NewSubscriberRequest>
<new1:Customer>
<shar:FirstName>#(FirstName)</shar:FirstName>
<shar:LastName>#(LastName)</shar:LastName>
<shar:LangType>#(LangType)</shar:LangType>
</new1:Customer>
<new1:Account>
<shar:PaidMode>#(PaidMode)</shar:PaidMode>
<shar:BillCycleCredit>#(BillCycleCredit)</shar:BillCycleCredit>
<shar:CreditCtrlMode>#(CreditCtrlMode)</shar:CreditCtrlMode>
<new1:BillCycleType>#(BillCycleType)</new1:BillCycleType>
</new1:Account>
I've had a look at this solution, How to use dynamic values for Karate Features, he seams to want to do the same thing but it doesnt work for me i get the below error.
feature call loop failed at index: 0, match failed: EQUALS
$ | not equal | match failed for name: 'SubscriberNo' (MAP:MAP)
{"PaidMode":"0","BillCycleCredit":"100000","BillCycleType":"1","PrimaryOffer":"500033","SubscriberNo":"#(postPaidSubscriber1)"}
{"PaidMode":"0","BillCycleCredit":"100000","BillCycleType":"1","PrimaryOffer":"500033","SubscriberNo":"#(postPaidSubscriber1)"}
$.SubscriberNo | not equal (STRING:STRING)
'#(postPaidSubscriber1)'
'699111115'
I'm now here https://github.com/karatelabs/karate/blob/v1.2.0/karate-junit4/src/test/java/com/intuit/karate/junit4/xml/xml.feature again trying to figure out how best to do this. This question is similar to my previous question How to set a variable in the xml per scenario just want to read it from a table to create my subscriber base basically for readability and usage reasons. Sorry Peter I see you get alot of these type of questions (second from me alone lol). I just need a little nudge I think