JMeter:如何在多个线程中处理cookie?

时间:2013-01-03 12:35:35

标签: testing jmeter session-cookies

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

  

setUp线程登录应用程序(打开会话)。

     

主线程执行以在同一会话中执行任务。

     

tearDown线程注销应用程序(关闭会话)。

这是不可能的,因为安装线程的cookie不能在其他线程中使用,因此我们无法在其他线程中获取会话。

请告诉我这是怎么回事?

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您可以使用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)