我正在使用 Dynatrace 和 Gatling 进行性能分析和测试。Dynatrace 支持通过向每个 HTTP 请求添加标头来跟踪测试运行。我希望该标头带有动态测试 guid,而无需在 100 多个地方将其单独添加到每个请求中。
一个示例测试:
def GetLocationPage = exec(http(domain + "GetLocationPage")
.post("/location ")
.formParam("updateVersion", "1")
Run Code Online (Sandbox Code Playgroud)
我知道我可以在每个请求中单独添加标头...
.headers(gatlingHeaders)
Run Code Online (Sandbox Code Playgroud)
...但我的目标是避免在代码中执行 100 多个位置。本质上,我正在寻找与 Spring 中的此功能等效的 Gatling 。
我在 Gatling 上发现了这个问题,但无法确定它是否有用。
有什么建议吗?