Jump to content


Photo

Extract parameter from semantic URL


  • Please log in to reply
2 replies to this topic

#1 trish.mcdonough

trish.mcdonough

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 13 January 2015 - 05:37 PM

Apologies if this has been answered before - I couldn't follow the solutions in any similar questions.

 

We have a system with 'semantic' URLs so instead of 

http://www.domain.com/case/view.aspx?caseid=48

 we have 

http://www.domain.com/case/48/view

The profile I'm attempting to run includes creating a 'case' and then performing further actions on it.  The 'user' completes http://www.domain.com/case/add and is then redirected to the view screen of the case they have just created - the URL of which is (for example) http://www.domain.com/case/48/view.

 

The response consists of two parts, firstly a redirect - the response body of which is:

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/case/48/view">here</a>.</h2>
</body></html>

and then the http://www.domain.com/case/48/view page.  This response body does not contain the CaseID anywhere - it is only in the URL. 

 

I was trying to use the $Search function to set the 'caseID' variable from the first response (the redirect) but I couldn't get it to work - I found this article which confirmed that the variables are only set from the latest response.

 

I can't use the $UrlParam to get the case ID from the URL due to it being a semantic URL (no ?, = or &).  As the response body doesn't not contain the case ID - I have to extract it from the URL.  The $Search function only works on the Response Body (it doesn't include the URL) - so how do I do this?

 

Apologies if this is obvious - all my previous profiles were very straight forward and I'm quite stumped with this issue.

 

Thanks in advance.

Trish



#2 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 14 January 2015 - 05:30 AM

In WAPT Pro you can use JavaScript operator and extract case ID from context.requestHeader.


Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#3 trish.mcdonough

trish.mcdonough

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 14 January 2015 - 09:31 AM

Thanks for the reply Sergei.

 

Alas I've WAPT 7.1 but at least I know now, it was driving me nuts because I was convinced I was just not using it correctly.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users