status.find.is(304), but actually found 200

I recorded a Gatling load test with 1 user on vaadin project. When executing the corresponding recorded test script, It shows warning like “status.find.is(304), but actually found 200”. I have also used Gatling for testing Vaadin projects, but those projects were worked without annotations. Currently I am working on a vaadin project which uses annotations. I disabled XSRF protection also. As a fresher to Gatling and Scala I couldn’t resolve the issue. Please anybody can help me… Very very thanks in advance.

This is how I disabled the XSRF protection.

`

@WebServlet(value = “/*”, asyncSupported = true,
initParams = {
@WebInitParam(name = “disable-xsrf-protection”, value = “true”),
@WebInitParam(name = “syncId”, value = “false”)}
)
@VaadinServletConfiguration(productionMode = true, ui = AweSomeUI.class, widgetset = “aweSomeUIWidgetset”)

`

This is my recorded script.

val httpProtocol = http
    .baseURL("http://192.168.5.51:8080")
    .inferHtmlResources()

val headers_0 = Map("Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")

val headers_2 = Map("Accept" -> "*/*")

val headers_11 = Map("Accept" -> "image/png,image/*;q=0.8,*/*;q=0.5")

val headers_13 = Map(
    "Accept" -> "application/font-woff2;q=1.0,application/font-woff;q=0.9,*/*;q=0.8",
    "Accept-Encoding" -> "identity")

val uri1 = "localhost"

val scn = scenario("AweSomeUI")
    // Search Url
    .exec(http("request_0")
        .get("/AweSomeUI/")
        .headers(headers_0)
        .resources(http("request_1")
        .get(uri1 + "/VAADIN/themes/awesomeUI/styles.css?v=7.6.5")
        .check(status.is(304)),
        http("request_2")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/awesomeUIWidgetset.nocache.js?1463463908372")
        .headers(headers_2),
        http("request_3")
        .get(uri1 + "/VAADIN/themes/awesomeUI/imports.css")
        .check(status.is(304)),
        http("request_4")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/grid-util.css?v=1.0.8a")
        .check(status.is(304)),
        http("request_5")
        .get(uri1 + "/VAADIN/themes/awesomeUI/grid.css")
        .check(status.is(304)),
        http("request_6")
        .get(uri1 + "/VAADIN/themes/awesomeUI/menu.css")
        .check(status.is(304)),
        http("request_7")
        .get(uri1 + "/VAADIN/themes/awesomeUI/modules/myactivity-grid.css")
        .check(status.is(304)),
        http("request_8")
        .get(uri1 + "/VAADIN/themes/awesomeUI/dashboard.css"),
        http("request_9")
        .get(uri1 + "/VAADIN/themes/awesomeUI/modules/project-grid.css")
        .check(status.is(304)),
        http("request_10")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/FAB8FF54E62ED80710F53EB2E2C2434A.cache.js")
        .headers(headers_2)
        .check(status.is(304)),
        http("request_11")
        .get(uri1 + "/VAADIN/themes/valo/shared/img/spinner.gif")
        .headers(headers_11)
        .check(status.is(304)),
        http("request_12")
        .post(uri1 + "/?v-1463463908374")
        .headers(headers_0)
        .formParam("v-browserDetails", "1")
        .formParam("theme", "awesomeUI")
        .formParam("v-appId", "awesomeUI-765090603")
        .formParam("v-sh", "768")
        .formParam("v-sw", "1366")
        .formParam("v-cw", "1366")
        .formParam("v-ch", "697")
        .formParam("v-curdate", "1463463908374")
        .formParam("v-tzo", "-330")
        .formParam("v-dstd", "0")
        .formParam("v-rtzo", "-330")
        .formParam("v-dston", "false")
        .formParam("v-vw", "1366")
        .formParam("v-vh", "0")
        .formParam("v-loc", "localhost")
        .formParam("v-wn", "awesomeUI-765090603-0.6916003790375647"),
        http("request_13")
        .get(uri1 + "/VAADIN/themes/base/fonts/fontawesome-webfont.woff")
        .headers(headers_13)
        .check(status.is(304))))
    .pause(12)
    // Login
    .exec(http("request_14")
        .post("/awesomeUI/UIDL/?v-uiId=0")
        .headers(headers_0)
        .body(RawFileBody("awesomeUI_0014_request.txt"))
        .resources(http("request_15")
        .get(uri1 + "/VAADIN/themes/base/fonts/themeicons-webfont.woff")
        .headers(headers_13)
        .check(status.is(304))))
    .pause(9)
    // Logout
    .exec(http("request_16")
        .post("/awesomeUI/UIDL/?v-uiId=0")
        .headers(headers_0)
        .body(RawFileBody("awesomeUI_0016_request.txt"))
        .resources(http("request_17")
        .get(uri1 + "/")
        .headers(headers_0),
        http("request_18")
        .post(uri1 + "/?v-1463463934756")
        .headers(headers_0)
        .formParam("v-browserDetails", "1")
        .formParam("theme", "awesomeUI")
        .formParam("v-appId", "awesomeUI-765090603")
        .formParam("v-sh", "768")
        .formParam("v-sw", "1366")
        .formParam("v-cw", "1366")
        .formParam("v-ch", "697")
        .formParam("v-curdate", "1463463934756")
        .formParam("v-tzo", "-330")
        .formParam("v-dstd", "0")
        .formParam("v-rtzo", "-330")
        .formParam("v-dston", "false")
        .formParam("v-vw", "1366")
        .formParam("v-vh", "0")
        .formParam("v-loc", "localhost")
        .formParam("v-wn", "awesomeUI-765090603-0.6916003790375647"),
        http("request_19")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/awesomeUIWidgetset.nocache.js?1463463934755")
        .headers(headers_2),
        http("request_20")
        .get(uri1 + "/VAADIN/themes/awesomeUI/styles.css?v=7.6.5"),
        http("request_21")
        .get(uri1 + "/VAADIN/themes/awesomeUI/imports.css"),
        http("request_22")
        .get(uri1 + "/VAADIN/themes/awesomeUI/menu.css"),
        http("request_23")
        .get(uri1 + "/VAADIN/themes/awesomeUI/grid.css"),
        http("request_24")
        .get(uri1 + "/VAADIN/themes/awesomeUI/modules/project-grid.css"),
        http("request_25")
        .get(uri1 + "/VAADIN/themes/awesomeUI/modules/myactivity-grid.css"),
        http("request_26")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/FAB8FF54E62ED80710F53EB2E2C2434A.cache.js")
        .headers(headers_2)))

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

And the gatling console is the following

Why do you expect a status of 304 in the first place?

Dear Fadi Saoudi,

As I am very new to Gatling, I could not understood what did you mean by"Why do you expect a status of 304 in the first place?". Actually I recorded a scenario and while running that scenario it shows error as in the image which I have attached. I searched google for a solution but it was worthless.

I am using Vaadin project to test using Gatling. I hope you can help me . Thanks in advance.

Regards,
Satheesh

It’s showing an error cause your requests specify that you’re expecting them to return an http status of ‘304’ (Not Modified) while the requests are returing 200 (OK). Remove all

".check([status.is](http://status.is)(304))" from your requests and you should be fine.

Your requests will then look like this:

val scn = scenario("AweSomeUI")
    // Search Url
    .exec(http("request_0")
        .get("/AweSomeUI/")
        .headers(headers_0)
        .resources(http("request_1")
        .get(uri1 + "/VAADIN/themes/awesomeUI/styles.css?v=7.6.5"),
        http("request_2")
        .get(uri1 + "/VAADIN/widgetsets/awesomeUIWidgetset/awesomeUIWidgetset.nocache.js?1463463908372")
        .headers(headers_2),
        http("request_3")
        .get(uri1 + "/VAADIN/themes/awesomeUI/imports.css"),
        ...   

Dear Fadi Saoudi,

Thank you very much!!! Great help you did for me. !

Regards,
Satheesh