Hello everyone,
For some new tests I need to go through an API that have a network protection (I’m not sure if I need a specific IP or I need to add a gateaway to go through it) and actually I tried to use the asyncNameResolution method to force my IP (to test if I can have a good result) but I can’t test it because of this error that appears whenever I try to start any test (launching gatling.sh → Run the simulation locally)
cannot find symbol
symbol: method ascyncNameResolution(java.lang.String)
location: class io.gatling.javaapi.http.HttpProtocolBuilder
My code (that contains this part):
HttpProtocolBuilder httpProtocol = http.baseUrl("{baseURL}")
.acceptHeader("application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.acceptLanguageHeader("fr-FR:q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
.asyncNameResolution("{MyIP}");
ChainBuilder connectAndBasic =
exec(http("Login")
.post("/login")
.body(RawFileBody("loginJsonBody.json"))
.check(status().is(201)));
{baseURL} and {MyIP} are juste here for privacy reason
If needed I can send more informations
However, you can only use it for valid adresses for your load generator machine. Not any random fake address, otherwise the response couldn’t possibly be routed back to you.
Okay, thanks for that explaination, I misunderstood that part, but there’s still a problem in what I have done
Can you help me again please?
I tried to understand better everything that I did on my code and everything still seems clear (I deleted the HTTP Protocol part because I can access the API Platform (the Website containing all routes) without it so the problem seems to be elsewhere
From my Firefox, everything works well (seems logic, I can do it visually from the docs website)
From Postman I can access both routes and make them work
From the code That I send higher: Still doesn’t work for the POST route
The routes
get: {BaseURL}/api/docs
post: {BaseURL}/api/login
The first works everywhere the second not in gatling
If I’m not that clear I can clarify some unclear points
Thanks
Sorry I was not meaning that I can’t get logs, just that I didn’t had any with the code that I had,
I’m gonna take your first answer for solution because It is for my first problem
The answer was simple but Because I didn’t knew I could print every logs of the execution I was kinda lost
It was just a bad body type
I don’t know why it returned a 404 but now it returns a 200
So everything’s good, thank you very much!