Query regarding simulating static resources

Hello All,

I have recently started using Gatling to perform Load testing in my project. As my project does not use CDN and is a public facing website trying to record simulation along with static resources served by the server.
However this would need recording script for each build as there will be change in static resources.

For eg. sample script would look like the following . each of test request trying to load around 10-15 static resources.

`

object TestScenario1 {

val httpProtocol = http
.baseURL(“https://testsite”)
.inferHtmlResources(BlackList(""“https://platform.twitter.com”"", “”“https://farm1.staticflickr.com”"", “”“https://s.ytimg.com/yts”"", “”“https://pbs.twimg.com”"", “”“https://www.google-analytics.com”"", “”“static.doubleclick.net”"", “”“https://syndication.twitter.com”"", “”“https://www.googletagmanager.com/.*”"", “”“https://maxcdn.bootstrapcdn.com”"", “”“https://fonts.gstatic.com”"", “”“https://i.ytimg.com”"", “”“https://www.youtube.com”"", “”“www.google.com”"", “”“farm6.staticflickr.com”"", “”“https://fonts.googleapis.com/css”"", “”“creatingahealthier.files.wordpress.com”""), WhiteList())

val headers_0 = Map(
“Accept” → “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”,
“Accept-Encoding” → “gzip, deflate”)

val headers_1 = Map(“Accept” → “image/png,image/;q=0.8,/*;q=0.5”)

val headers_17 = Map(“Accept” → “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)

val headers_34 = Map(
“Accept” → “application/json, text/javascript, /; q=0.01”,
“X-Requested-With” → “XMLHttpRequest”)

val uri1 = “testsite”
val uri2 = “https://testsite:443

val navigation = group(“Home Page”) {
// Homepage
exec(http(“request_0”)
.get(“http://” + uri2 + “/”)
.headers(headers_0)
.resources(http(“request_1”)
.get(uri3 + “/assets/images/icons/arrows/int_arrow_right_42px.png”)
.headers(headers_1),
http(“request_2”)
.get(uri3 + “/assets/images/office/so_crest_48px.png”)
.headers(headers_1),
http(“request_3”)
.get(uri3 + “/assets/images/domain-logos/domain_195px.png”)
.headers(headers_1),
http(“request_4”)
.get(uri3 + “/assets/images/icons/notification_close_white.png”)
.headers(headers_1)))
}
.pause(18)
// Navigate to Business

.group(“Navigate to Cateogry List - Business “) {
exec(http(“request_19”)
.get(”/business/”)
.headers(headers_17)
.resources(http(“request_20”)
.get(uri3 + “/assets/images/crest/crest_tint_desk_270px.png”)
.headers(headers_1),
http(“request_21”)
.get(uri3 + “/assets/scripts/domain/format.categories.js”),
http(“request_22”)
.get(uri3 + “/assets/scripts/domain/sticky-back-to-top.js”),
http(“request_23”)
.get(uri3 + “/assets/images/icons/arrows/int_arrow_up_70px.png”)
.headers(headers_1)))

}
}

`

Would you please advise if there is better way to record scripts programmatically, instead of using recorder.

I have tried using PhantomJS to capture all traffic and save to a csv file.
However I don’t see any option to pass csv file as part of resources for each test request.

Would you please advise if someone had simulated Website navigation along with static resources in a better manner.

Regards,
Raja

One option could be use Fiddler to save traffic into text file, and create a reader to parse properly.

It’s not easy, but possible.

Cheers,