Jmeter--多个线程组顺序执行和并行执行

本期目标: 理解Thread Groups的顺序执行与并行执行

控制因子:Run Thread Groups consecutively(i.e.one at time)

预期结论:

1、勾选 Run Thread Groups consecutively(i.e.one at time),则表示顺序执行。顺序执行,指的是测试计划中存在多个线程组时,第一个线程组执行完后再执行下一个线程组。

2、不勾选 Run Thread Groups consecutively(i.e.one at time),则表示并行执行。并行执行,指的是指的是测试计划中存在多个线程组时,所有线程组都在同一时刻执行

一、实验环境:

1、windows系统 + jmeter

2、xampp + phpwind

二、实验步骤:

a、顺序执行。

    1、设置Test Plan属性。打开jmeter:

        1.1、点击Test plan,name输入框输入:Thread Groups Test Plan

        1.2、勾选Run Thread Groups consecutively(i.e.one at time)选项

    2、添加Thread Group。

        2.1、选中Test Plan,单击鼠标右键,Add ->Threads -> Thread Group。

        2.1.1、在新添加的Thread Group 页面:

            name: First Thread Group

            Loop Count: 2

    3、 添加 HTTP request。

        3.1、选中上一步骤添加的Thread Group: First Thread Group,单击鼠标右键,Add -> Sampler -> HTTP Request

        3.2、接上一步,修改HTTP Request的信息:

            Name: tucool request

            Server Name or IP:127.0.0.1

            Port: 8022(自己搭建环境的端口号)

            Method: GET

            Path: /phpwind/upload/html/channel/tucool

            注:/phpwind/upload, 是我搭建phpwind的主页路径

    4、再次创建一个Thread Group或者直接复制后修改。

        4.1、 选中First Thread Group,并复制。

        4.2、选中Thread Groups Test Plan,并粘贴。此时会生成和First Thread Group一样名字的线程组

        4.3、单击第二个线程组:

             Name: Second Thread Group

        4.4、展开Second Thread Group,鼠标单击HTTP Request:

            Name:由tucool request 改成cms request

            Path: /phpwind/upload/index.php

            Parameters列表点击Add按钮:

                name: m

                Values: cms

    5、First Thread Group增加Think time。

        5.1、选中First Thread Group ,鼠标单击右键,点击Add Think Times to children

        5.2、点击Think time:

            Action: Pause

            Duration : 1000

        注:为啥要加Think time,是为了看效果,看啥效果呢。

    6、添加结果树。

        6.1、选中  Thread Groups Test Plan,鼠标单击右键,Add -> Listener -> View Results Tree

    7、点击start 运行,查看结果树,并记录结果。

b、并行执行Thread Groups。

    1、单击Thread Groups Test Plan,去掉勾选Run Thread Groups consecutively(i.e.one at time)选项。

    2、点击start 运行,查看结果树,并记录结果。


三、对比两次结果。

顺序执行时,结果树的执行顺序是:(loop count=2)

    tucool request[loop 1] -> tucool request[loop 2] -> cms request[loop 1] -> cms request[loop 2]

并行执行时,结果树的执行顺序是:

    首先、tucool request[loop 1] 、cms request[loop 1] (runned at on time)

    然后、cms request[loop 2] -> tucool request[loop 2]

注:如果还是想不懂的话,反复清空结果树,多执行几次,然后观察,得出自己的结论(理解透彻)。别人的结论不一定是正确的。

ps:感觉网络还行,图片又不大,就是上传图片上传不了。。。

你可能感兴趣的:(Jmeter--多个线程组顺序执行和并行执行)