cancel
Showing results for 
Search instead for 
Did you mean: 

Can I test an href link that is returned from my GET within the same test?

strim355z
Occasional Contributor

Can I test an href link that is returned from my GET within the same test?

I have an api that returns data from our customer table, but in addition to these results for each record it returns href links (self, address, contacts, etc) which I run to drill deeper into a record.  I have seen on message content assertion that I can only verify that the 'expected' link matches 'actual'.  

 

Is there a way to get the resulting href link, then have my test run that uri and assert that content?  Thank you much for your time. 

7 REPLIES 7
JKambli
Staff

Re: Can I test an href link that is returned from my GET within the same test?

Add a groovy script teststep

Save the response URL in a testCase property using point and click in groovy script testStep

testRunner.testCase.setPropertyValue( "urlendpoint", urlendpoint)

Create a HTTP request and add this expansion in HTTP endpoint section

${#TestCase#urlendpoint}

 

Thanks

 



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
strim355z
Occasional Contributor

Re: Can I test an href link that is returned from my GET within the same test?

I have added a groovy teststep.

 

Sorry but this was a little confusing. "Save the response URL in a testCase property using point and click in groovy script testStep"

 

From outline view, I right click on href link and transfer to property, with target step as groovy script?

 

This below goes in Groovy script step?

 

testRunner.testCase.setPropertyValue( "http://ds-domainproxy-500-dev.cloudhub.io:80/api/finance-company/8ac498b41548787001154daf7bcd0046", http://ds-domainproxy-500-dev.cloudhub.io:80/api/finance-company/8ac498b41548787001154daf7bcd0046)

 

Thank you much 

strim355z
Occasional Contributor

Re: Can I test an href link that is returned from my GET within the same test?

Hi, am a new user to soapui pro and need some additional help with this so i appreciate your patience.  

 

Add a groovy script teststep - done

 

 

Save the response URL in a testCase property using point and click in groovy script testStep - in my response on the outline tab i select my href link and have choices to add to property or property test step.

 

If i choose property, on basic tab my target step is Groovy script.  Target path blank, source path auto populates

 

 

For this piece below, i thought it went into groovy script but I am doubting it now because my endpoint looks like a comment (attached)

testRunner.testCase.setPropertyValue( "urlendpoint", urlendpoint)

 

Create a HTTP request and add this expansion in HTTP endpoint section 

${#TestSuite#urlendpoint

 

Thanks much

 

JKambli
Staff

Re: Can I test an href link that is returned from my GET within the same test?

Are you aware of point and click functionality?
https://www.soapui.org/getting-started/point-and-click-testing/point-and-click-with-xpath.html

Right click > Get Data > TestSuite > TestCase > Request > Response
Get that specific value in a variable

Then create a testCase property,

testRunner.testCase.setPropertyValue( "urlendpoint", variableName)

Then add,

${#TestCase#urlendpoint}



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
strim355z
Occasional Contributor

Re: Can I test an href link that is returned from my GET within the same test?

I am not, thank you for the link.  

strim355z
Occasional Contributor

Re: Can I test an href link that is returned from my GET within the same test?

I am using rest and forms are not supported so this might be beyond my capabilities at this point.  Thanks. 

JKambli
Staff

Re: Can I test an href link that is returned from my GET within the same test?

Open a support case.

 

Thanks



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