prepare123
prepare123

Reputation: 165

While running recorded simulation in Gatling, I got file not found error

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.

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

Upvotes: 0

Views: 1339

Answers (1)

prepare123
prepare123

Reputation: 165

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")

Upvotes: 1

Related Questions