Gatling 报告非 html 请求自定义

时间:2021-07-28 09:05:57

标签: scala gatling

在gatling中,所有被请求的非html资源都在结果文件中报告(见附图)。如何从结果文件中排除这些资源请求以使报告看起来整洁。

其次,我将所有非 html 资源列入黑名单,如下所示,但它仍然请求获取它们。这是预期的吗?

val httpProtocol = http
        .baseUrl("https://abc")     
        .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.woff2""", """.*\.(t|o)tf""", """.*\.png""", """.*detectportal\.firefox\.com.*"""), WhiteList())  

enter image description here

1 个答案:

答案 0 :(得分:1)

  1. 要从报告中排除资源,只需在协议中添加 .silentResources。 您可以在那里阅读更多相关信息https://gatling.io/docs/gatling/reference/current/http/protocol/#silencing

  2. 您的资源包含类型之后的字符。示例:....css?v=d0edd...,所以需要重写正则表达式: 而是.*\.js.*\.js.*