0
votes

now I'm trying to conduct load test with gatling.
I have been trying create gatling's simulation script via gatling recorder and it was going well.
but, when I executed that, I encountered file not found error below although there are files
(in this case /step1/0006_request.json is exist)

request_6: Failed to build request: Resource /step1/0006_request.json not found 

there are many json files and that error occurred some of specific post requests. every requests which is failed are composed following setting.

  • using request header 'headers_6' below
  • using RawFileBody method (even if this is obvious thing because content-type is 'application/json')

I already have been using 12 hour over and I have to finish my task in a timely manner.
I'm so sorry about that I can't share my application which is target of this issue.
if anyone have any idea or kindly want to more detail please ask me.

val headers_6 = Map(
        "Content-Type" -> "application/json",
        "Origin" -> "applicationServerURL")


.exec(http("request_6")
            .post("requestUrl")
            .headers(headers_6)
            .body(RawFileBody("/step1/0006_request.json"))
            .resources(http("request_7")

additionally, I checked json files which were created by gatling recorder on 'resource' directory, them contains only one char 'X'.
this means Gatling recorder doesn't capture request json file's content?

env:
Gatling version gatling 3.5.1 Used Browser: FireFox

1
Please provide a way for someone else to reproduce your issue. Without such means, it's impossible to help. - Stéphane LANDELLE
thank you for reply and I just solved this problem. I can't provide exact way of reproduce due to leak knowledge of this issue and security, but I'll update way of solving and hope my comment will be helpful to someone who encounter similar issue due to file not found on gatling, - prepare123

1 Answers

0
votes

I just solved this issue.
this issue was caused by very simple fact.

firstly, I encountered error message below

request_6: Failed to build request: Resource /step1/0006_request.json not found 

and I have to check the file paths although this script was auto created by gatling recorder(do not trust gatling tool).

The auto created file path was absolute path and start with ‘/’. And the script started to work once I remove the ‘/’.
I referred other post on stack overflow, and it was written that file path must be written with absolute path if you are using gatling version 3 or later version.
I hope my reply can be informative to someone who may be having same issue as me.
Using 'relative path'.

//As is
.exec(http("request_6")
            .post("requestUrl")
            .headers(headers_6)
            .body(RawFileBody("/step1/0006_request.json"))
            .resources(http("request_7")
//To be
.exec(http("request_6")
            .post("requestUrl")
            .headers(headers_6)
            .body(RawFileBody("step1/0006_request.json"))
            .resources(http("request_7")