Does Gatling UI performance testing support multiple baseurl

Hello,

I’m working on UI performance testing on gatling open source where I came across this scenario :
When clicked on one tab, its redirected to other url (our baseurl changes here) & new tab opens.
Because of this its giving 302 error.
So is this supported in gatling UI performance testing?

Hello,

Yes this is supported. You need to use absolute URLs instead of base URLs in this instance.

All the best,
Pete

Thanks Pete.
I was able to solve this.
Now I want to access a session variable & append it in get request like -
.exec(
http(login method")
.get(“https://google.com/"+"session_variable”)
.headers(headers_0)
)

Is there any way to do this? If yes how can it be done?

Hello,

Of course, I suggest that you take a look at the Gatling Session documentation: Gatling session scripting reference

As a heads up in this community we try to “teach you how to fish” rather than providing solutions immediately. The idea is that you read the documentation, make your best attempt, if it doesn’t work show us the code and we can help from there :slight_smile:

All the best,
Pete

1 Like

Sure Pete.
I have already checked this documentation & also existing issues related to this here but didn’t find any resolution on the same.
I saw we can get whole url from session like this -
exec(http(“name”)
.get(session → str)
But my query is how to append this session variable with a request url like this -
.get(“https://google.com/”+session->str)
It would be great if you can give me resolution on the same.

I would follow Pete’s advice to look on your own, but at least I can give you some hint, note that this syntax from Gatling 3.9.5, not sure if anything changed in syntax on 3.10.4:

  .exec{
    session => 
      val sessionName = session.set("attribute", "your-value")
    sessionName
  }

The code block initiate a new attribute in V.U, named attribute, holds your-value, to access this attribute, use:

.get(“https://google.com/#{attribute}")

Take a look Gatling session scripting reference - session API
Gatling Expression Language #{ } is used to call attributes. Keep that in mind.
Cheers!

1 Like

Sure I will try this way.
thank you!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.