cancel
Showing results for 
Search instead for 
Did you mean: 

Need to pass REST parameters from a file

SOLVED
Highlighted
Occasional Contributor

Need to pass REST parameters from a file

I have a REST API that has three parameters in the URL.

  1. http://myservice.it.com:8080/data/inventory/generateItemInventory?item=&bin=&itemCount=&itemSize=

I have defined the three parameters at the Resource level. I have a GET method that does not contain the parameters. My test case has three steps:

Load Parameter Properties and I have specified the file containing the properties

Set Item request which references the resource and method. Each parameter is a Query style at the Resource level

Property Transfer which transfers the response to a custom Project property

 

What's happening is that while the Load Parameter Properties step is working (the values are being set from the file) the Set Item request is failing because it says the parameters are missing. I don;t understand why the parameter values are not neing passed to the request?

 

Any help appreciated!

 

Thanks,Linda

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Need to pass REST parameters from a file

@Lschoend 

 

1. Like it was mentioned earlier, you don't load from properties step

2. Please see the attached screen shot.

- Test case has custom property DATA_FILE where you provide the property file name

- In the setup script, use code from below script

https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/testCaseSetup/LoadPropertiesFromFile...

- You always run the test case (not individual test step, specially when property file content is changed)



Regards,
Rao.

View solution in original post

17 REPLIES 17
Highlighted
Community Hero

Re: Need to pass REST parameters from a file

Please provide screen shots of test case, the file in which data is the and REST request step where you want to pass values. And how it is expected.


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Need to pass REST parameters from a file

Thanks Rao. Screen shots are attached, any help gratefully appreciated!

 

Linda

Highlighted
Community Hero

Re: Need to pass REST parameters from a file

Thanks for that.

What type of file are you loading in step1? Is it comma separated file? Sample data would help.

So you wanted to put the data  into Step2 as parameter values which are read from file?

Not sure of the significance of step3.



Regards,
Rao.
Highlighted
Occasional Contributor

Re: Need to pass REST parameters from a file

Sorry for the delay in responding.

 

I have attached the file. It seems to be working because the step that loads the parameters from the file is showing the correct values. They are just not being passed to step 2.. Step 3 is transferring the response to a custom project property that I use in my integration with my test tool.

Highlighted
Community Hero

Re: Need to pass REST parameters from a file

Looad these values at custom properties of test case so that there is not need to pass, they can directly used in requests using Property expansion.
https://www.soapui.org/scripting-properties/property-expansion.html


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Need to pass REST parameters from a file

Thanks Rao. I must not be using them right. I am new to REST so not completely familiar with where the custom properties need to be included so they will pass as parameters. I have attached a set of screen shots with the flow. I am getting the right property values loaded but they are still not being passed to the request. 

 

Just FYI I am staying away from scripting because this project will be handed off to BAs who are not comfortable with script code. They can get around in SOAP UI and they can create the properties external file. I have done normal web services using custom properties in the past (you helped me then too, thanks) and it worked fine so it seems it should work here too. 

 

As always, appreciate all of your patient and kind help.

 

Linda

Highlighted
Community Hero

Re: Need to pass REST parameters from a file

Please go thru the links provided in earlier reply. There is no scripting involved.


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Need to pass REST parameters from a file

Thanks Rao. I did read the links, more than once. I referenced scripting because the link has scripting examples at the end. 

 

Can you identify any errors in the screen shots I sent you that would explain why the properties are not being passed? Please don't give up on me!

 

Thanks,

Linda

Highlighted
Community Hero

Re: Need to pass REST parameters from a file

@Lschoend
Make the below changes to the test case.
1. Remove step #1 (properties step)
2. In the REST step, use ${#TestCase#material} and similarly for other parameter values.
Note that there is change in the case and it is case sensitive.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Top Kudoed Authors