# Query regarding simulating static resources

**URL:** <https://community.gatling.io/t/query-regarding-simulating-static-resources/2982>\
**Category:** Gatling (Open-Source)\
**Created:** [May 6, 2016, 2:30pm UTC](https://community.gatling.io/t/query-regarding-simulating-static-resources/2982 "2016-05-06T14:30:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://community.gatling.io/u/Guest)\
**Post date:** [May 6, 2016, 2:30pm UTC](https://community.gatling.io/t/query-regarding-simulating-static-resources/2982/1 "2016-05-06T14:30:23Z")

</div>

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](https://testsite)”)  
.inferHtmlResources(BlackList(""“[https://platform.twitter.com](https://platform.twitter.com)”"", “”“[https://farm1.staticflickr.com](https://farm1.staticflickr.com)”"", “”“[https://s.ytimg.com/yts](https://s.ytimg.com/yts)”"", “”“[https://pbs.twimg.com](https://pbs.twimg.com)”"", “”“[https://www.google-analytics.com](https://www.google-analytics.com)”"", “”“[static.doubleclick.net](http://static.doubleclick.net)”"", “”“[https://syndication.twitter.com](https://syndication.twitter.com)”"", “”“[https://www.googletagmanager.com/.\*](https://www.googletagmanager.com/.*)”"", “”“[https://maxcdn.bootstrapcdn.com](https://maxcdn.bootstrapcdn.com)”"", “”“[https://fonts.gstatic.com](https://fonts.gstatic.com)”"", “”“[https://i.ytimg.com](https://i.ytimg.com)”"", “”“[https://www.youtube.com](https://www.youtube.com)”"", “”“[www.google.com](http://www.google.com)”"", “”“[farm6.staticflickr.com](http://farm6.staticflickr.com)”"", “”“[https://fonts.googleapis.com/css](https://fonts.googleapis.com/css)”"", “”“[creatingahealthier.files.wordpress.com](http://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](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

---

<div class="post-metadata">

**Author:** ![Jose\_Manuel\_Vega\_Mon](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@Jose\_Manuel\_Vega\_Mon](https://community.gatling.io/u/Jose_Manuel_Vega_Mon)\
**Post date:** [May 13, 2016, 12:50pm UTC](https://community.gatling.io/t/query-regarding-simulating-static-resources/2982/2 "2016-05-13T12:50:33Z")

</div>

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,
