Search code examples
parametersperformance-testingloadrunner

How to parameterize Part of the URL in Loadrunner Trueclient?


How do i parameterize Part of the URL as below

URL : example.com/data/api/....../xyz
To be parameterized : api

I tried using TC.getParam("api") but returned with error

    Error: Navigate to [Exception] ** failed - an argument is invalid:
 'Location': JavaScript exception 'SyntaxError: Expected ';'' during evaluation

Also tried with ArgsContext.TC.getParam("api") also returned with same error:
Can anyone help on this.

I do not want to parameterize entire URL because its too big.


Solution

  • Well I tried some thing like this https://www.smashingmagazine.com/"+LR.getParam("url") and it worked for me. So you can try similar way.

    "example.com/data/"+LR.getParam("url")+"/....../xyz"
    

    Here url is a parameter you have to define in the LR parameter file separately. Let me know if this helps. Remember that you select Javascript in the argument option not a parameter. I have attached a sample for you.Sample Screenshot