jmeter停止当前迭代 [英] jmeter stop current iteration

查看:642
本文介绍了jmeter停止当前迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下问题:

我的测试计划中有多个HTTP请求。
如果失败,我希望每个请求重复4次。
我意识到使用BeanShell Assertion,它已经正常工作了。
我的问题是,如果先前的请求失败5次,我不希望执行请求,
但我也不希望线程结束。

I have multiple HTTP Requests in my testplan. I want every request to be repeated 4 times if they fail. I realized that with a BeanShell Assertion, and its already working fine. My problem is, that I don't want requests to be executed if a previous Request failed 5 times, BUT I also dont want the thread to end.

我只想让当前的线程迭代结束,
以便线程的下一次迭代可以用第一个请求重新开始(如果线程要重复)。

I just want the current thread iteration to end, so that the next iteration of the thread can start again with the 1st request (if the thread is meant to be repeated).

如何在BeanShell断言中实现?
这里只是我的代码的简短摘录,我想要解决方案

How do I realize that within the BeanShell Assertion? Here is just a short extract of my code where i want the solution to have

badResponseCounter 是对于请求的每次失败尝试都会增加,这似乎到目前为止工作。之后,变量将被重置。

badResponseCounter is being increased for every failed try of the request, this seems to work so far. Afterwards, the variable gets resetted.

if (badResponseCounter = 5) {
        badResponseCounter = 0;
     // Stop current iteration
    }

我已经检查了API,方法给出了setStopTest()或setStopThread(),但没有用于退出当前迭代。我还需要线程组中的首选项continue,否则整个测试将在1个单个请求失败后停止。
如何做到这一点的想法?

I already checked the API, methods like setStopTest() or setStopThread() are given, but nothing for quitting the current iteration. I also need the preference "continue" in the thread group, as otherwise the entire test will stop after 1 single request failed. Any ideas of how to do this?

推荐答案

试试这个。

ctx.setRestartNextLoop(true);

如果线程数是2,我试图跳过。我得到了如我所料的以下结果(它不会调用b-2)。它也不会杀死线程。

if the thread number is 2, i tried to skip. I get the below result as i expected (it does not call b-2). It does not kill the thread either.

这篇关于jmeter停止当前迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆