testing - JMeter:如何在多线程中处理cookies?

标签 testing jmeter session-cookies

我在 jmeter 中有一个测试计划,其中包含 setUp、tearDown 和一个主线程。

setUp thread logins the application (open a session).

main thread executes to perform a task in same session.

tearDown thread logout the application (close the session).

这是不可能的,因为设置线程的cookie不能在其他线程中使用,所以我们无法在其他线程中获取 session 。

请告诉我这是怎么可能的?

感谢您的帮助。

最佳答案

您可以使用 Inter-Thread Communication 在线程组之间共享数据(包括 cookie)

但是我不明白你为什么要这样做。我建议这样做:

Thread Group
  HTTP Sampler (login)
  .
  Put your logic here. Maybe you need Loop Controller or Synchronizing Timer here
  .
  HTTP Sampler (logout)

关于testing - JMeter:如何在多线程中处理cookies?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14139074/

相关文章:

java - 如何让 Java Applet 使用客户端证书和 session cookie 进行跨域请求?

python - 在 Python 中测试变量类型

testing - 我们可以在 Jmeter 的单个测试计划中并行运行两个线程组吗?

linux - 我的自定义 JMeter 监听器无法在 Linux 中工作

java - 使用 Jsoup 检索 sessionId cookie 时出现问题

cookies - testcafe cookie session cookie

安卓测试 : how to click on dialog box's button?

ScalaMock,意外调用 : <mock-1> when sharing mock instance between tests

testing - jMeter 报告中服务器命中率和吞吐量之间的差异

ssl - 在jmeter中启用详细的服务器证书认证