1

I have a scenario where I POST a file using soap service (xml). The scenario works ok, but I need to get the id that is generated automatically and incrementaly and to save it in a variable. Someone asked me to use this:

  • def id= //logId And print id

It worked in another case where the id is always the same. That is, in one case where I insert a file that is overwritten, keeping the same id.

However, if I try to use it for the first case, where the id is incremental it returns a #notpresent message in the "print id". But if I use and assertion where I write:

id == #present, it returs ok.

This es the response after executing the scenario. It is Ok, the id is present in the assertion but it doesn't print.

And match response /Envelope/Body/respuesta/return/message == 'OK'
And match response /Envelope/Body/respuesta/return/status == '0100'
And match response /Envelope/Body/respuesta/return/logId == '#present'

* def id = //logId
And print id

12:48:23.800 [print] #notpresent

Thanks for your help.

Julian
  • 21
  • 3
  • I'm sorry I can't understand your question. if you are trying to save a file locally, my opinion is that you are doing it wrong, so please read this: https://stackoverflow.com/a/54593057/143475 – Peter Thomas Feb 18 '22 at 19:45
  • Hi friend, thanks for your help. I'm not trying to save a file locally. My scenario is already doing that. I need to fetch the id generated when the file is saved in the database. For that purpose, I'm doing the following: * def id = //logId And print id However, the system is returning this: 12:48:23.800 [print] #notpresent – Julian Feb 21 '22 at 12:48
  • ok, I pass. hope someone else here can help you – Peter Thomas Feb 21 '22 at 15:52
  • Hi friends, Thanks for your help. I have solved the issue. I had to put a "return" after the double //: def id = //return/logId – Julian Feb 21 '22 at 17:07

1 Answers1

1

Thanks for your help. I have solved the issue. I had to put a "return" after the double //:

  • def id = //return/logId
Julian
  • 21
  • 3