Forum Discussion

cccarl's avatar
cccarl
New Contributor
5 years ago

Is there any way to retrieve the database-generated id of a created record during a test case?

Just getting started with ReadyAPI.   I have a set of REST Apis that handle CRUD operations on a table. I have a test case in my mind where I create a record, store the id returned, update the rec...
  • richie's avatar
    5 years ago
    Hey cccarl,

    What you need to do is a property transfer. There's several ways to do this, but the easiest i find considering you're gonna reuse the responseId is to save the responseId to a property step. Once the responseId is saved to a property step you can reuse later in your test.

    Some basic steps
    On the Rest request's response, highlight the responseId attribute and click on the 'Transfer to'
    Select 'Add Properties Step'
    Click 'Ok' on 'Create Properties Step' dialogue
    Click 'Ok' on 'Create target property' dialogue
    Click 'Ok' on the 'Transfer to Property' form

    The above generates a 'PropertyTransfer' step and a 'Properties' step.

    The resultant of the above steps is that you can then reuse the responseId property value saved in the Properties step on subsequent steps in your test case.

    Hope this was clear!

    Rich