1

i have a question regarding to this ticket Using karate-config parameters in a feature file

what is the difference between KeyId: secretKey, and KeyId: '#(secretKey)' ? is it possible to use apiKey with out assigning to def inside of the message? like * print "Key in this project is #apiKey" Thank you

Said Yusifli
  • 170
  • 11

1 Answers1

2

You asked 3 questions:

a) Please read: https://github.com/intuit/karate#karate-expressions

b) Please read: https://github.com/intuit/karate#embedded-expressions

c) Please read: https://github.com/intuit/karate#print

for example:

* def val = 'bar'
# correct
* def temp = { foo: '#(val)' } 
# wrong
* def temp = { foo: val }
# correct but not recommended
* def temp = ({ foo: val })
# variables are easy to use, forget about the # part
* print 'value of val:', val
Peter Thomas
  • 40,008
  • 10
  • 46
  • 142
  • I have variable cardholder in my karate-config file. i saved it under entrID. now how can i provide it to my json RequestBody ENTR_ID ? i am a little bit confused in this part.. * def entrID = cardholder * def requestContactHistoryAdd = """ { "Endpoint": "ContactHistoryAdd", "RequestBody": "{ \"ENTR_ID\" : \"entrID\", \"BHVR_ID\" : \"VRU\", }" } """ – Said Yusifli Feb 19 '20 at 20:11
  • here is the screenshot https://imgur.com/LX5x5Wg just make question more clear Thank you :) – Said Yusifli Feb 19 '20 at 20:19
  • @SaidYusifli ask new question – Peter Thomas Feb 20 '20 at 00:33