cancel
Showing results for 
Search instead for 
Did you mean: 

How to test property transfer as data source ?

Highlighted
Frequent Contributor

How to test property transfer as data source ?

Hi,

I'm trying various kinds of data source testing and I encounter a problem:

In my TC1 (Test Case 1) I do a REST request that returns me a JSON body with a list of 'id'

In my TC2 I want to perform a REST request with the list of 'id' as an input.

 

If I copy the REST request from TC1 to TC2, I can use its output to feed my DataSource and perform my second request on all my 'id' elements, which is fine. As I'd rather not copy the first request, I try the following:

In TC1, I do a property transfer to set a TestSuite property with the response JSON.

In TC2, I do a property transfer to set a TC2 property with the previous JSON response

 

When I want to select my data source, I select 'Property Transfer' as source step, but then, I can't select a Source Property. There is none available, even if my TC2 property has been properly set.

 

How could I proceed ?

 

Thank you

1 REPLY 1
Highlighted
Moderator

Re: How to test property transfer as data source ?

Hi krogold,

 

Thank you for your post. I can suggest that you use the approach from this thread: use the File Wait test step to read your JSON file. The File Wait test step can wait for a file to appear, but more importantly, it reads its content to fileContent property, which you later can address to in JSON DataSource. File Wait test step has custom property fileContent. After the step is executed, this property will have the content of your file. You can access it in the following test steps using property expansion string - "${File Wait#fileContent}", where "File Wait" is the name of your File Wait step. 

 

In case of JSON DataSource you should choose your File Wait step in Source Step and fileContent in Source property (see http://readyapi.smartbear.com/structure/sources/json/start). You should run the test case at least once to be able to select nodes from the actual file, using buttons next to Row Path and Column Paths fields.

 

So, you will need to do the following: 

1. Write the received JSON to the file.

2. In the next testcase use the FileWait test step.

3. Read JSON from the File Wait test step.

 

The structure of the project will be the following:

TC1

   REST request

   DataSink (File type)

TC2

   File Wait

   DataSource (JSON type)



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors