• Locust学习笔记6——参数化


      引言

      前面一篇文章cust学习笔记5——登录接口参数关联,简单介绍了关联的使用方法,我们不管做接口功能测试还是接口性能测试,都涉及关联、参数化和检查点。那么现在介绍一下参数化。

      背景

      案例场景:所有并发虚拟用户共享同一份测试数据,并且保证虚拟用户使用的数据不重复。

      例如,模拟3用户并发注册账号,总共有9个账号,要求注册账号不重复,注册完毕后结束测试;加载示例如下表所示。

      

      数据准备

      虚拟用户可以在脚本里设置好,而测试数据可以提前写好。

      上面已经讲了背景,这里我要100个用户同时登录来测试系统的性能,相同的用户登录肯定不符合实际要求,此时我们可以考虑用参数化。

      Python的Queue模块中提供了同步的、线程安全的队列类,其中一个队列类就是FIFO(先入先出)队列Queue,用队列将有效用户生成出来put到对列中,在从队列中get出来,传给登录请求。

      法1:

    data = {
            "username": "test%04d",
            "password": "pwd%04d",
            "email": "test%04d@debugtalk.test",
            "phone": "186%08d"
            }
    result = [str(data) % (i,i,i,i) for i in range(100)]
    print(result)
    

      结果:

    ["{'username': 'test0000', 'password': 'pwd0000', 'email': 'test0000@debugtalk.test', 'phone': '18600000000'}", "{'username': 'test0001', 'password': 'pwd0001', 'email': 'test0001@debugtalk.test', 'phone': '18600000001'}", "{'username': 'test0002', 'password': 'pwd0002', 'email': 'test0002@debugtalk.test', 'phone': '18600000002'}", "{'username': 'test0003', 'password': 'pwd0003', 'email': 'test0003@debugtalk.test', 'phone': '18600000003'}", "{'username': 'test0004', 'password': 'pwd0004', 'email': 'test0004@debugtalk.test', 'phone': '18600000004'}", "{'username': 'test0005', 'password': 'pwd0005', 'email': 'test0005@debugtalk.test', 'phone': '18600000005'}", "{'username': 'test0006', 'password': 'pwd0006', 'email': 'test0006@debugtalk.test', 'phone': '18600000006'}", "{'username': 'test0007', 'password': 'pwd0007', 'email': 'test0007@debugtalk.test', 'phone': '18600000007'}", "{'username': 'test0008', 'password': 'pwd0008', 'email': 'test0008@debugtalk.test', 'phone': '18600000008'}", "{'username': 'test0009', 'password': 'pwd0009', 'email': 'test0009@debugtalk.test', 'phone': '18600000009'}", "{'username': 'test0010', 'password': 'pwd0010', 'email': 'test0010@debugtalk.test', 'phone': '18600000010'}", "{'username': 'test0011', 'password': 'pwd0011', 'email': 'test0011@debugtalk.test', 'phone': '18600000011'}", "{'username': 'test0012', 'password': 'pwd0012', 'email': 'test0012@debugtalk.test', 'phone': '18600000012'}", "{'username': 'test0013', 'password': 'pwd0013', 'email': 'test0013@debugtalk.test', 'phone': '18600000013'}", "{'username': 'test0014', 'password': 'pwd0014', 'email': 'test0014@debugtalk.test', 'phone': '18600000014'}", "{'username': 'test0015', 'password': 'pwd0015', 'email': 'test0015@debugtalk.test', 'phone': '18600000015'}", "{'username': 'test0016', 'password': 'pwd0016', 'email': 'test0016@debugtalk.test', 'phone': '18600000016'}", "{'username': 'test0017', 'password': 'pwd0017', 'email': 'test0017@debugtalk.test', 'phone': '18600000017'}", "{'username': 'test0018', 'password': 'pwd0018', 'email': 'test0018@debugtalk.test', 'phone': '18600000018'}", "{'username': 'test0019', 'password': 'pwd0019', 'email': 'test0019@debugtalk.test', 'phone': '18600000019'}", "{'username': 'test0020', 'password': 'pwd0020', 'email': 'test0020@debugtalk.test', 'phone': '18600000020'}", "{'username': 'test0021', 'password': 'pwd0021', 'email': 'test0021@debugtalk.test', 'phone': '18600000021'}", "{'username': 'test0022', 'password': 'pwd0022', 'email': 'test0022@debugtalk.test', 'phone': '18600000022'}", "{'username': 'test0023', 'password': 'pwd0023', 'email': 'test0023@debugtalk.test', 'phone': '18600000023'}", "{'username': 'test0024', 'password': 'pwd0024', 'email': 'test0024@debugtalk.test', 'phone': '18600000024'}", "{'username': 'test0025', 'password': 'pwd0025', 'email': 'test0025@debugtalk.test', 'phone': '18600000025'}", "{'username': 'test0026', 'password': 'pwd0026', 'email': 'test0026@debugtalk.test', 'phone': '18600000026'}", "{'username': 'test0027', 'password': 'pwd0027', 'email': 'test0027@debugtalk.test', 'phone': '18600000027'}", "{'username': 'test0028', 'password': 'pwd0028', 'email': 'test0028@debugtalk.test', 'phone': '18600000028'}", "{'username': 'test0029', 'password': 'pwd0029', 'email': 'test0029@debugtalk.test', 'phone': '18600000029'}", "{'username': 'test0030', 'password': 'pwd0030', 'email': 'test0030@debugtalk.test', 'phone': '18600000030'}", "{'username': 'test0031', 'password': 'pwd0031', 'email': 'test0031@debugtalk.test', 'phone': '18600000031'}", "{'username': 'test0032', 'password': 'pwd0032', 'email': 'test0032@debugtalk.test', 'phone': '18600000032'}", "{'username': 'test0033', 'password': 'pwd0033', 'email': 'test0033@debugtalk.test', 'phone': '18600000033'}", "{'username': 'test0034', 'password': 'pwd0034', 'email': 'test0034@debugtalk.test', 'phone': '18600000034'}", "{'username': 'test0035', 'password': 'pwd0035', 'email': 'test0035@debugtalk.test', 'phone': '18600000035'}", "{'username': 'test0036', 'password': 'pwd0036', 'email': 'test0036@debugtalk.test', 'phone': '18600000036'}", "{'username': 'test0037', 'password': 'pwd0037', 'email': 'test0037@debugtalk.test', 'phone': '18600000037'}", "{'username': 'test0038', 'password': 'pwd0038', 'email': 'test0038@debugtalk.test', 'phone': '18600000038'}", "{'username': 'test0039', 'password': 'pwd0039', 'email': 'test0039@debugtalk.test', 'phone': '18600000039'}", "{'username': 'test0040', 'password': 'pwd0040', 'email': 'test0040@debugtalk.test', 'phone': '18600000040'}", "{'username': 'test0041', 'password': 'pwd0041', 'email': 'test0041@debugtalk.test', 'phone': '18600000041'}", "{'username': 'test0042', 'password': 'pwd0042', 'email': 'test0042@debugtalk.test', 'phone': '18600000042'}", "{'username': 'test0043', 'password': 'pwd0043', 'email': 'test0043@debugtalk.test', 'phone': '18600000043'}", "{'username': 'test0044', 'password': 'pwd0044', 'email': 'test0044@debugtalk.test', 'phone': '18600000044'}", "{'username': 'test0045', 'password': 'pwd0045', 'email': 'test0045@debugtalk.test', 'phone': '18600000045'}", "{'username': 'test0046', 'password': 'pwd0046', 'email': 'test0046@debugtalk.test', 'phone': '18600000046'}", "{'username': 'test0047', 'password': 'pwd0047', 'email': 'test0047@debugtalk.test', 'phone': '18600000047'}", "{'username': 'test0048', 'password': 'pwd0048', 'email': 'test0048@debugtalk.test', 'phone': '18600000048'}", "{'username': 'test0049', 'password': 'pwd0049', 'email': 'test0049@debugtalk.test', 'phone': '18600000049'}", "{'username': 'test0050', 'password': 'pwd0050', 'email': 'test0050@debugtalk.test', 'phone': '18600000050'}", "{'username': 'test0051', 'password': 'pwd0051', 'email': 'test0051@debugtalk.test', 'phone': '18600000051'}", "{'username': 'test0052', 'password': 'pwd0052', 'email': 'test0052@debugtalk.test', 'phone': '18600000052'}", "{'username': 'test0053', 'password': 'pwd0053', 'email': 'test0053@debugtalk.test', 'phone': '18600000053'}", "{'username': 'test0054', 'password': 'pwd0054', 'email': 'test0054@debugtalk.test', 'phone': '18600000054'}", "{'username': 'test0055', 'password': 'pwd0055', 'email': 'test0055@debugtalk.test', 'phone': '18600000055'}", "{'username': 'test0056', 'password': 'pwd0056', 'email': 'test0056@debugtalk.test', 'phone': '18600000056'}", "{'username': 'test0057', 'password': 'pwd0057', 'email': 'test0057@debugtalk.test', 'phone': '18600000057'}", "{'username': 'test0058', 'password': 'pwd0058', 'email': 'test0058@debugtalk.test', 'phone': '18600000058'}", "{'username': 'test0059', 'password': 'pwd0059', 'email': 'test0059@debugtalk.test', 'phone': '18600000059'}", "{'username': 'test0060', 'password': 'pwd0060', 'email': 'test0060@debugtalk.test', 'phone': '18600000060'}", "{'username': 'test0061', 'password': 'pwd0061', 'email': 'test0061@debugtalk.test', 'phone': '18600000061'}", "{'username': 'test0062', 'password': 'pwd0062', 'email': 'test0062@debugtalk.test', 'phone': '18600000062'}", "{'username': 'test0063', 'password': 'pwd0063', 'email': 'test0063@debugtalk.test', 'phone': '18600000063'}", "{'username': 'test0064', 'password': 'pwd0064', 'email': 'test0064@debugtalk.test', 'phone': '18600000064'}", "{'username': 'test0065', 'password': 'pwd0065', 'email': 'test0065@debugtalk.test', 'phone': '18600000065'}", "{'username': 'test0066', 'password': 'pwd0066', 'email': 'test0066@debugtalk.test', 'phone': '18600000066'}", "{'username': 'test0067', 'password': 'pwd0067', 'email': 'test0067@debugtalk.test', 'phone': '18600000067'}", "{'username': 'test0068', 'password': 'pwd0068', 'email': 'test0068@debugtalk.test', 'phone': '18600000068'}", "{'username': 'test0069', 'password': 'pwd0069', 'email': 'test0069@debugtalk.test', 'phone': '18600000069'}", "{'username': 'test0070', 'password': 'pwd0070', 'email': 'test0070@debugtalk.test', 'phone': '18600000070'}", "{'username': 'test0071', 'password': 'pwd0071', 'email': 'test0071@debugtalk.test', 'phone': '18600000071'}", "{'username': 'test0072', 'password': 'pwd0072', 'email': 'test0072@debugtalk.test', 'phone': '18600000072'}", "{'username': 'test0073', 'password': 'pwd0073', 'email': 'test0073@debugtalk.test', 'phone': '18600000073'}", "{'username': 'test0074', 'password': 'pwd0074', 'email': 'test0074@debugtalk.test', 'phone': '18600000074'}", "{'username': 'test0075', 'password': 'pwd0075', 'email': 'test0075@debugtalk.test', 'phone': '18600000075'}", "{'username': 'test0076', 'password': 'pwd0076', 'email': 'test0076@debugtalk.test', 'phone': '18600000076'}", "{'username': 'test0077', 'password': 'pwd0077', 'email': 'test0077@debugtalk.test', 'phone': '18600000077'}", "{'username': 'test0078', 'password': 'pwd0078', 'email': 'test0078@debugtalk.test', 'phone': '18600000078'}", "{'username': 'test0079', 'password': 'pwd0079', 'email': 'test0079@debugtalk.test', 'phone': '18600000079'}", "{'username': 'test0080', 'password': 'pwd0080', 'email': 'test0080@debugtalk.test', 'phone': '18600000080'}", "{'username': 'test0081', 'password': 'pwd0081', 'email': 'test0081@debugtalk.test', 'phone': '18600000081'}", "{'username': 'test0082', 'password': 'pwd0082', 'email': 'test0082@debugtalk.test', 'phone': '18600000082'}", "{'username': 'test0083', 'password': 'pwd0083', 'email': 'test0083@debugtalk.test', 'phone': '18600000083'}", "{'username': 'test0084', 'password': 'pwd0084', 'email': 'test0084@debugtalk.test', 'phone': '18600000084'}", "{'username': 'test0085', 'password': 'pwd0085', 'email': 'test0085@debugtalk.test', 'phone': '18600000085'}", "{'username': 'test0086', 'password': 'pwd0086', 'email': 'test0086@debugtalk.test', 'phone': '18600000086'}", "{'username': 'test0087', 'password': 'pwd0087', 'email': 'test0087@debugtalk.test', 'phone': '18600000087'}", "{'username': 'test0088', 'password': 'pwd0088', 'email': 'test0088@debugtalk.test', 'phone': '18600000088'}", "{'username': 'test0089', 'password': 'pwd0089', 'email': 'test0089@debugtalk.test', 'phone': '18600000089'}", "{'username': 'test0090', 'password': 'pwd0090', 'email': 'test0090@debugtalk.test', 'phone': '18600000090'}", "{'username': 'test0091', 'password': 'pwd0091', 'email': 'test0091@debugtalk.test', 'phone': '18600000091'}", "{'username': 'test0092', 'password': 'pwd0092', 'email': 'test0092@debugtalk.test', 'phone': '18600000092'}", "{'username': 'test0093', 'password': 'pwd0093', 'email': 'test0093@debugtalk.test', 'phone': '18600000093'}", "{'username': 'test0094', 'password': 'pwd0094', 'email': 'test0094@debugtalk.test', 'phone': '18600000094'}", "{'username': 'test0095', 'password': 'pwd0095', 'email': 'test0095@debugtalk.test', 'phone': '18600000095'}", "{'username': 'test0096', 'password': 'pwd0096', 'email': 'test0096@debugtalk.test', 'phone': '18600000096'}", "{'username': 'test0097', 'password': 'pwd0097', 'email': 'test0097@debugtalk.test', 'phone': '18600000097'}", "{'username': 'test0098', 'password': 'pwd0098', 'email': 'test0098@debugtalk.test', 'phone': '18600000098'}", "{'username': 'test0099', 'password': 'pwd0099', 'email': 'test0099@debugtalk.test', 'phone': '18600000099'}"]
    
    Process finished with exit code 0
    

      法2:

    result_list = []
    for index in range(100):
        data = '''{
        "username": "test%04d",
        "password": "pwd%04d",
        "email": "test%04d@debugtalk.test",
        "phone": "186%08d",
        }'''%(index,index,index,index)
        result_list.append(data.replace(' ',''))
    print(result_list)
    clear_space =  [x.replace('
    ','') for x in result_list]
    print(clear_space)
    

      结果:

    ['{
    "username":"test0000",
    "password":"pwd0000",
    "email":"test0000@debugtalk.test",
    "phone":"18600000000",
    }', '{
    "username":"test0001",
    "password":"pwd0001",
    "email":"test0001@debugtalk.test",
    "phone":"18600000001",
    }', '{
    "username":"test0002",
    "password":"pwd0002",
    "email":"test0002@debugtalk.test",
    "phone":"18600000002",
    }', '{
    "username":"test0003",
    "password":"pwd0003",
    "email":"test0003@debugtalk.test",
    "phone":"18600000003",
    }', '{
    "username":"test0004",
    "password":"pwd0004",
    "email":"test0004@debugtalk.test",
    "phone":"18600000004",
    }', '{
    "username":"test0005",
    "password":"pwd0005",
    "email":"test0005@debugtalk.test",
    "phone":"18600000005",
    }', '{
    "username":"test0006",
    "password":"pwd0006",
    "email":"test0006@debugtalk.test",
    "phone":"18600000006",
    }', '{
    "username":"test0007",
    "password":"pwd0007",
    "email":"test0007@debugtalk.test",
    "phone":"18600000007",
    }', '{
    "username":"test0008",
    "password":"pwd0008",
    "email":"test0008@debugtalk.test",
    "phone":"18600000008",
    }', '{
    "username":"test0009",
    "password":"pwd0009",
    "email":"test0009@debugtalk.test",
    "phone":"18600000009",
    }', '{
    "username":"test0010",
    "password":"pwd0010",
    "email":"test0010@debugtalk.test",
    "phone":"18600000010",
    }', '{
    "username":"test0011",
    "password":"pwd0011",
    "email":"test0011@debugtalk.test",
    "phone":"18600000011",
    }', '{
    "username":"test0012",
    "password":"pwd0012",
    "email":"test0012@debugtalk.test",
    "phone":"18600000012",
    }', '{
    "username":"test0013",
    "password":"pwd0013",
    "email":"test0013@debugtalk.test",
    "phone":"18600000013",
    }', '{
    "username":"test0014",
    "password":"pwd0014",
    "email":"test0014@debugtalk.test",
    "phone":"18600000014",
    }', '{
    "username":"test0015",
    "password":"pwd0015",
    "email":"test0015@debugtalk.test",
    "phone":"18600000015",
    }', '{
    "username":"test0016",
    "password":"pwd0016",
    "email":"test0016@debugtalk.test",
    "phone":"18600000016",
    }', '{
    "username":"test0017",
    "password":"pwd0017",
    "email":"test0017@debugtalk.test",
    "phone":"18600000017",
    }', '{
    "username":"test0018",
    "password":"pwd0018",
    "email":"test0018@debugtalk.test",
    "phone":"18600000018",
    }', '{
    "username":"test0019",
    "password":"pwd0019",
    "email":"test0019@debugtalk.test",
    "phone":"18600000019",
    }', '{
    "username":"test0020",
    "password":"pwd0020",
    "email":"test0020@debugtalk.test",
    "phone":"18600000020",
    }', '{
    "username":"test0021",
    "password":"pwd0021",
    "email":"test0021@debugtalk.test",
    "phone":"18600000021",
    }', '{
    "username":"test0022",
    "password":"pwd0022",
    "email":"test0022@debugtalk.test",
    "phone":"18600000022",
    }', '{
    "username":"test0023",
    "password":"pwd0023",
    "email":"test0023@debugtalk.test",
    "phone":"18600000023",
    }', '{
    "username":"test0024",
    "password":"pwd0024",
    "email":"test0024@debugtalk.test",
    "phone":"18600000024",
    }', '{
    "username":"test0025",
    "password":"pwd0025",
    "email":"test0025@debugtalk.test",
    "phone":"18600000025",
    }', '{
    "username":"test0026",
    "password":"pwd0026",
    "email":"test0026@debugtalk.test",
    "phone":"18600000026",
    }', '{
    "username":"test0027",
    "password":"pwd0027",
    "email":"test0027@debugtalk.test",
    "phone":"18600000027",
    }', '{
    "username":"test0028",
    "password":"pwd0028",
    "email":"test0028@debugtalk.test",
    "phone":"18600000028",
    }', '{
    "username":"test0029",
    "password":"pwd0029",
    "email":"test0029@debugtalk.test",
    "phone":"18600000029",
    }', '{
    "username":"test0030",
    "password":"pwd0030",
    "email":"test0030@debugtalk.test",
    "phone":"18600000030",
    }', '{
    "username":"test0031",
    "password":"pwd0031",
    "email":"test0031@debugtalk.test",
    "phone":"18600000031",
    }', '{
    "username":"test0032",
    "password":"pwd0032",
    "email":"test0032@debugtalk.test",
    "phone":"18600000032",
    }', '{
    "username":"test0033",
    "password":"pwd0033",
    "email":"test0033@debugtalk.test",
    "phone":"18600000033",
    }', '{
    "username":"test0034",
    "password":"pwd0034",
    "email":"test0034@debugtalk.test",
    "phone":"18600000034",
    }', '{
    "username":"test0035",
    "password":"pwd0035",
    "email":"test0035@debugtalk.test",
    "phone":"18600000035",
    }', '{
    "username":"test0036",
    "password":"pwd0036",
    "email":"test0036@debugtalk.test",
    "phone":"18600000036",
    }', '{
    "username":"test0037",
    "password":"pwd0037",
    "email":"test0037@debugtalk.test",
    "phone":"18600000037",
    }', '{
    "username":"test0038",
    "password":"pwd0038",
    "email":"test0038@debugtalk.test",
    "phone":"18600000038",
    }', '{
    "username":"test0039",
    "password":"pwd0039",
    "email":"test0039@debugtalk.test",
    "phone":"18600000039",
    }', '{
    "username":"test0040",
    "password":"pwd0040",
    "email":"test0040@debugtalk.test",
    "phone":"18600000040",
    }', '{
    "username":"test0041",
    "password":"pwd0041",
    "email":"test0041@debugtalk.test",
    "phone":"18600000041",
    }', '{
    "username":"test0042",
    "password":"pwd0042",
    "email":"test0042@debugtalk.test",
    "phone":"18600000042",
    }', '{
    "username":"test0043",
    "password":"pwd0043",
    "email":"test0043@debugtalk.test",
    "phone":"18600000043",
    }', '{
    "username":"test0044",
    "password":"pwd0044",
    "email":"test0044@debugtalk.test",
    "phone":"18600000044",
    }', '{
    "username":"test0045",
    "password":"pwd0045",
    "email":"test0045@debugtalk.test",
    "phone":"18600000045",
    }', '{
    "username":"test0046",
    "password":"pwd0046",
    "email":"test0046@debugtalk.test",
    "phone":"18600000046",
    }', '{
    "username":"test0047",
    "password":"pwd0047",
    "email":"test0047@debugtalk.test",
    "phone":"18600000047",
    }', '{
    "username":"test0048",
    "password":"pwd0048",
    "email":"test0048@debugtalk.test",
    "phone":"18600000048",
    }', '{
    "username":"test0049",
    "password":"pwd0049",
    "email":"test0049@debugtalk.test",
    "phone":"18600000049",
    }', '{
    "username":"test0050",
    "password":"pwd0050",
    "email":"test0050@debugtalk.test",
    "phone":"18600000050",
    }', '{
    "username":"test0051",
    "password":"pwd0051",
    "email":"test0051@debugtalk.test",
    "phone":"18600000051",
    }', '{
    "username":"test0052",
    "password":"pwd0052",
    "email":"test0052@debugtalk.test",
    "phone":"18600000052",
    }', '{
    "username":"test0053",
    "password":"pwd0053",
    "email":"test0053@debugtalk.test",
    "phone":"18600000053",
    }', '{
    "username":"test0054",
    "password":"pwd0054",
    "email":"test0054@debugtalk.test",
    "phone":"18600000054",
    }', '{
    "username":"test0055",
    "password":"pwd0055",
    "email":"test0055@debugtalk.test",
    "phone":"18600000055",
    }', '{
    "username":"test0056",
    "password":"pwd0056",
    "email":"test0056@debugtalk.test",
    "phone":"18600000056",
    }', '{
    "username":"test0057",
    "password":"pwd0057",
    "email":"test0057@debugtalk.test",
    "phone":"18600000057",
    }', '{
    "username":"test0058",
    "password":"pwd0058",
    "email":"test0058@debugtalk.test",
    "phone":"18600000058",
    }', '{
    "username":"test0059",
    "password":"pwd0059",
    "email":"test0059@debugtalk.test",
    "phone":"18600000059",
    }', '{
    "username":"test0060",
    "password":"pwd0060",
    "email":"test0060@debugtalk.test",
    "phone":"18600000060",
    }', '{
    "username":"test0061",
    "password":"pwd0061",
    "email":"test0061@debugtalk.test",
    "phone":"18600000061",
    }', '{
    "username":"test0062",
    "password":"pwd0062",
    "email":"test0062@debugtalk.test",
    "phone":"18600000062",
    }', '{
    "username":"test0063",
    "password":"pwd0063",
    "email":"test0063@debugtalk.test",
    "phone":"18600000063",
    }', '{
    "username":"test0064",
    "password":"pwd0064",
    "email":"test0064@debugtalk.test",
    "phone":"18600000064",
    }', '{
    "username":"test0065",
    "password":"pwd0065",
    "email":"test0065@debugtalk.test",
    "phone":"18600000065",
    }', '{
    "username":"test0066",
    "password":"pwd0066",
    "email":"test0066@debugtalk.test",
    "phone":"18600000066",
    }', '{
    "username":"test0067",
    "password":"pwd0067",
    "email":"test0067@debugtalk.test",
    "phone":"18600000067",
    }', '{
    "username":"test0068",
    "password":"pwd0068",
    "email":"test0068@debugtalk.test",
    "phone":"18600000068",
    }', '{
    "username":"test0069",
    "password":"pwd0069",
    "email":"test0069@debugtalk.test",
    "phone":"18600000069",
    }', '{
    "username":"test0070",
    "password":"pwd0070",
    "email":"test0070@debugtalk.test",
    "phone":"18600000070",
    }', '{
    "username":"test0071",
    "password":"pwd0071",
    "email":"test0071@debugtalk.test",
    "phone":"18600000071",
    }', '{
    "username":"test0072",
    "password":"pwd0072",
    "email":"test0072@debugtalk.test",
    "phone":"18600000072",
    }', '{
    "username":"test0073",
    "password":"pwd0073",
    "email":"test0073@debugtalk.test",
    "phone":"18600000073",
    }', '{
    "username":"test0074",
    "password":"pwd0074",
    "email":"test0074@debugtalk.test",
    "phone":"18600000074",
    }', '{
    "username":"test0075",
    "password":"pwd0075",
    "email":"test0075@debugtalk.test",
    "phone":"18600000075",
    }', '{
    "username":"test0076",
    "password":"pwd0076",
    "email":"test0076@debugtalk.test",
    "phone":"18600000076",
    }', '{
    "username":"test0077",
    "password":"pwd0077",
    "email":"test0077@debugtalk.test",
    "phone":"18600000077",
    }', '{
    "username":"test0078",
    "password":"pwd0078",
    "email":"test0078@debugtalk.test",
    "phone":"18600000078",
    }', '{
    "username":"test0079",
    "password":"pwd0079",
    "email":"test0079@debugtalk.test",
    "phone":"18600000079",
    }', '{
    "username":"test0080",
    "password":"pwd0080",
    "email":"test0080@debugtalk.test",
    "phone":"18600000080",
    }', '{
    "username":"test0081",
    "password":"pwd0081",
    "email":"test0081@debugtalk.test",
    "phone":"18600000081",
    }', '{
    "username":"test0082",
    "password":"pwd0082",
    "email":"test0082@debugtalk.test",
    "phone":"18600000082",
    }', '{
    "username":"test0083",
    "password":"pwd0083",
    "email":"test0083@debugtalk.test",
    "phone":"18600000083",
    }', '{
    "username":"test0084",
    "password":"pwd0084",
    "email":"test0084@debugtalk.test",
    "phone":"18600000084",
    }', '{
    "username":"test0085",
    "password":"pwd0085",
    "email":"test0085@debugtalk.test",
    "phone":"18600000085",
    }', '{
    "username":"test0086",
    "password":"pwd0086",
    "email":"test0086@debugtalk.test",
    "phone":"18600000086",
    }', '{
    "username":"test0087",
    "password":"pwd0087",
    "email":"test0087@debugtalk.test",
    "phone":"18600000087",
    }', '{
    "username":"test0088",
    "password":"pwd0088",
    "email":"test0088@debugtalk.test",
    "phone":"18600000088",
    }', '{
    "username":"test0089",
    "password":"pwd0089",
    "email":"test0089@debugtalk.test",
    "phone":"18600000089",
    }', '{
    "username":"test0090",
    "password":"pwd0090",
    "email":"test0090@debugtalk.test",
    "phone":"18600000090",
    }', '{
    "username":"test0091",
    "password":"pwd0091",
    "email":"test0091@debugtalk.test",
    "phone":"18600000091",
    }', '{
    "username":"test0092",
    "password":"pwd0092",
    "email":"test0092@debugtalk.test",
    "phone":"18600000092",
    }', '{
    "username":"test0093",
    "password":"pwd0093",
    "email":"test0093@debugtalk.test",
    "phone":"18600000093",
    }', '{
    "username":"test0094",
    "password":"pwd0094",
    "email":"test0094@debugtalk.test",
    "phone":"18600000094",
    }', '{
    "username":"test0095",
    "password":"pwd0095",
    "email":"test0095@debugtalk.test",
    "phone":"18600000095",
    }', '{
    "username":"test0096",
    "password":"pwd0096",
    "email":"test0096@debugtalk.test",
    "phone":"18600000096",
    }', '{
    "username":"test0097",
    "password":"pwd0097",
    "email":"test0097@debugtalk.test",
    "phone":"18600000097",
    }', '{
    "username":"test0098",
    "password":"pwd0098",
    "email":"test0098@debugtalk.test",
    "phone":"18600000098",
    }', '{
    "username":"test0099",
    "password":"pwd0099",
    "email":"test0099@debugtalk.test",
    "phone":"18600000099",
    }']
    ['{"username":"test0000","password":"pwd0000","email":"test0000@debugtalk.test","phone":"18600000000",}', '{"username":"test0001","password":"pwd0001","email":"test0001@debugtalk.test","phone":"18600000001",}', '{"username":"test0002","password":"pwd0002","email":"test0002@debugtalk.test","phone":"18600000002",}', '{"username":"test0003","password":"pwd0003","email":"test0003@debugtalk.test","phone":"18600000003",}', '{"username":"test0004","password":"pwd0004","email":"test0004@debugtalk.test","phone":"18600000004",}', '{"username":"test0005","password":"pwd0005","email":"test0005@debugtalk.test","phone":"18600000005",}', '{"username":"test0006","password":"pwd0006","email":"test0006@debugtalk.test","phone":"18600000006",}', '{"username":"test0007","password":"pwd0007","email":"test0007@debugtalk.test","phone":"18600000007",}', '{"username":"test0008","password":"pwd0008","email":"test0008@debugtalk.test","phone":"18600000008",}', '{"username":"test0009","password":"pwd0009","email":"test0009@debugtalk.test","phone":"18600000009",}', '{"username":"test0010","password":"pwd0010","email":"test0010@debugtalk.test","phone":"18600000010",}', '{"username":"test0011","password":"pwd0011","email":"test0011@debugtalk.test","phone":"18600000011",}', '{"username":"test0012","password":"pwd0012","email":"test0012@debugtalk.test","phone":"18600000012",}', '{"username":"test0013","password":"pwd0013","email":"test0013@debugtalk.test","phone":"18600000013",}', '{"username":"test0014","password":"pwd0014","email":"test0014@debugtalk.test","phone":"18600000014",}', '{"username":"test0015","password":"pwd0015","email":"test0015@debugtalk.test","phone":"18600000015",}', '{"username":"test0016","password":"pwd0016","email":"test0016@debugtalk.test","phone":"18600000016",}', '{"username":"test0017","password":"pwd0017","email":"test0017@debugtalk.test","phone":"18600000017",}', '{"username":"test0018","password":"pwd0018","email":"test0018@debugtalk.test","phone":"18600000018",}', '{"username":"test0019","password":"pwd0019","email":"test0019@debugtalk.test","phone":"18600000019",}', '{"username":"test0020","password":"pwd0020","email":"test0020@debugtalk.test","phone":"18600000020",}', '{"username":"test0021","password":"pwd0021","email":"test0021@debugtalk.test","phone":"18600000021",}', '{"username":"test0022","password":"pwd0022","email":"test0022@debugtalk.test","phone":"18600000022",}', '{"username":"test0023","password":"pwd0023","email":"test0023@debugtalk.test","phone":"18600000023",}', '{"username":"test0024","password":"pwd0024","email":"test0024@debugtalk.test","phone":"18600000024",}', '{"username":"test0025","password":"pwd0025","email":"test0025@debugtalk.test","phone":"18600000025",}', '{"username":"test0026","password":"pwd0026","email":"test0026@debugtalk.test","phone":"18600000026",}', '{"username":"test0027","password":"pwd0027","email":"test0027@debugtalk.test","phone":"18600000027",}', '{"username":"test0028","password":"pwd0028","email":"test0028@debugtalk.test","phone":"18600000028",}', '{"username":"test0029","password":"pwd0029","email":"test0029@debugtalk.test","phone":"18600000029",}', '{"username":"test0030","password":"pwd0030","email":"test0030@debugtalk.test","phone":"18600000030",}', '{"username":"test0031","password":"pwd0031","email":"test0031@debugtalk.test","phone":"18600000031",}', '{"username":"test0032","password":"pwd0032","email":"test0032@debugtalk.test","phone":"18600000032",}', '{"username":"test0033","password":"pwd0033","email":"test0033@debugtalk.test","phone":"18600000033",}', '{"username":"test0034","password":"pwd0034","email":"test0034@debugtalk.test","phone":"18600000034",}', '{"username":"test0035","password":"pwd0035","email":"test0035@debugtalk.test","phone":"18600000035",}', '{"username":"test0036","password":"pwd0036","email":"test0036@debugtalk.test","phone":"18600000036",}', '{"username":"test0037","password":"pwd0037","email":"test0037@debugtalk.test","phone":"18600000037",}', '{"username":"test0038","password":"pwd0038","email":"test0038@debugtalk.test","phone":"18600000038",}', '{"username":"test0039","password":"pwd0039","email":"test0039@debugtalk.test","phone":"18600000039",}', '{"username":"test0040","password":"pwd0040","email":"test0040@debugtalk.test","phone":"18600000040",}', '{"username":"test0041","password":"pwd0041","email":"test0041@debugtalk.test","phone":"18600000041",}', '{"username":"test0042","password":"pwd0042","email":"test0042@debugtalk.test","phone":"18600000042",}', '{"username":"test0043","password":"pwd0043","email":"test0043@debugtalk.test","phone":"18600000043",}', '{"username":"test0044","password":"pwd0044","email":"test0044@debugtalk.test","phone":"18600000044",}', '{"username":"test0045","password":"pwd0045","email":"test0045@debugtalk.test","phone":"18600000045",}', '{"username":"test0046","password":"pwd0046","email":"test0046@debugtalk.test","phone":"18600000046",}', '{"username":"test0047","password":"pwd0047","email":"test0047@debugtalk.test","phone":"18600000047",}', '{"username":"test0048","password":"pwd0048","email":"test0048@debugtalk.test","phone":"18600000048",}', '{"username":"test0049","password":"pwd0049","email":"test0049@debugtalk.test","phone":"18600000049",}', '{"username":"test0050","password":"pwd0050","email":"test0050@debugtalk.test","phone":"18600000050",}', '{"username":"test0051","password":"pwd0051","email":"test0051@debugtalk.test","phone":"18600000051",}', '{"username":"test0052","password":"pwd0052","email":"test0052@debugtalk.test","phone":"18600000052",}', '{"username":"test0053","password":"pwd0053","email":"test0053@debugtalk.test","phone":"18600000053",}', '{"username":"test0054","password":"pwd0054","email":"test0054@debugtalk.test","phone":"18600000054",}', '{"username":"test0055","password":"pwd0055","email":"test0055@debugtalk.test","phone":"18600000055",}', '{"username":"test0056","password":"pwd0056","email":"test0056@debugtalk.test","phone":"18600000056",}', '{"username":"test0057","password":"pwd0057","email":"test0057@debugtalk.test","phone":"18600000057",}', '{"username":"test0058","password":"pwd0058","email":"test0058@debugtalk.test","phone":"18600000058",}', '{"username":"test0059","password":"pwd0059","email":"test0059@debugtalk.test","phone":"18600000059",}', '{"username":"test0060","password":"pwd0060","email":"test0060@debugtalk.test","phone":"18600000060",}', '{"username":"test0061","password":"pwd0061","email":"test0061@debugtalk.test","phone":"18600000061",}', '{"username":"test0062","password":"pwd0062","email":"test0062@debugtalk.test","phone":"18600000062",}', '{"username":"test0063","password":"pwd0063","email":"test0063@debugtalk.test","phone":"18600000063",}', '{"username":"test0064","password":"pwd0064","email":"test0064@debugtalk.test","phone":"18600000064",}', '{"username":"test0065","password":"pwd0065","email":"test0065@debugtalk.test","phone":"18600000065",}', '{"username":"test0066","password":"pwd0066","email":"test0066@debugtalk.test","phone":"18600000066",}', '{"username":"test0067","password":"pwd0067","email":"test0067@debugtalk.test","phone":"18600000067",}', '{"username":"test0068","password":"pwd0068","email":"test0068@debugtalk.test","phone":"18600000068",}', '{"username":"test0069","password":"pwd0069","email":"test0069@debugtalk.test","phone":"18600000069",}', '{"username":"test0070","password":"pwd0070","email":"test0070@debugtalk.test","phone":"18600000070",}', '{"username":"test0071","password":"pwd0071","email":"test0071@debugtalk.test","phone":"18600000071",}', '{"username":"test0072","password":"pwd0072","email":"test0072@debugtalk.test","phone":"18600000072",}', '{"username":"test0073","password":"pwd0073","email":"test0073@debugtalk.test","phone":"18600000073",}', '{"username":"test0074","password":"pwd0074","email":"test0074@debugtalk.test","phone":"18600000074",}', '{"username":"test0075","password":"pwd0075","email":"test0075@debugtalk.test","phone":"18600000075",}', '{"username":"test0076","password":"pwd0076","email":"test0076@debugtalk.test","phone":"18600000076",}', '{"username":"test0077","password":"pwd0077","email":"test0077@debugtalk.test","phone":"18600000077",}', '{"username":"test0078","password":"pwd0078","email":"test0078@debugtalk.test","phone":"18600000078",}', '{"username":"test0079","password":"pwd0079","email":"test0079@debugtalk.test","phone":"18600000079",}', '{"username":"test0080","password":"pwd0080","email":"test0080@debugtalk.test","phone":"18600000080",}', '{"username":"test0081","password":"pwd0081","email":"test0081@debugtalk.test","phone":"18600000081",}', '{"username":"test0082","password":"pwd0082","email":"test0082@debugtalk.test","phone":"18600000082",}', '{"username":"test0083","password":"pwd0083","email":"test0083@debugtalk.test","phone":"18600000083",}', '{"username":"test0084","password":"pwd0084","email":"test0084@debugtalk.test","phone":"18600000084",}', '{"username":"test0085","password":"pwd0085","email":"test0085@debugtalk.test","phone":"18600000085",}', '{"username":"test0086","password":"pwd0086","email":"test0086@debugtalk.test","phone":"18600000086",}', '{"username":"test0087","password":"pwd0087","email":"test0087@debugtalk.test","phone":"18600000087",}', '{"username":"test0088","password":"pwd0088","email":"test0088@debugtalk.test","phone":"18600000088",}', '{"username":"test0089","password":"pwd0089","email":"test0089@debugtalk.test","phone":"18600000089",}', '{"username":"test0090","password":"pwd0090","email":"test0090@debugtalk.test","phone":"18600000090",}', '{"username":"test0091","password":"pwd0091","email":"test0091@debugtalk.test","phone":"18600000091",}', '{"username":"test0092","password":"pwd0092","email":"test0092@debugtalk.test","phone":"18600000092",}', '{"username":"test0093","password":"pwd0093","email":"test0093@debugtalk.test","phone":"18600000093",}', '{"username":"test0094","password":"pwd0094","email":"test0094@debugtalk.test","phone":"18600000094",}', '{"username":"test0095","password":"pwd0095","email":"test0095@debugtalk.test","phone":"18600000095",}', '{"username":"test0096","password":"pwd0096","email":"test0096@debugtalk.test","phone":"18600000096",}', '{"username":"test0097","password":"pwd0097","email":"test0097@debugtalk.test","phone":"18600000097",}', '{"username":"test0098","password":"pwd0098","email":"test0098@debugtalk.test","phone":"18600000098",}', '{"username":"test0099","password":"pwd0099","email":"test0099@debugtalk.test","phone":"18600000099",}']
    
    Process finished with exit code 0
    

      法3:

    result_list = []
    for index in range(100):
        data = {
                "username": "test%04d" % index,
                "password": "pwd%04d" % index,
                "email": "test%04d@debugtalk.test" % index,
                "phone": "186%08d" % index,
            }
        result_list.append(data)
    print(result_list)
    

      结果:

    [{'username': 'test0000', 'password': 'pwd0000', 'email': 'test0000@debugtalk.test', 'phone': '18600000000'}, {'username': 'test0001', 'password': 'pwd0001', 'email': 'test0001@debugtalk.test', 'phone': '18600000001'}, {'username': 'test0002', 'password': 'pwd0002', 'email': 'test0002@debugtalk.test', 'phone': '18600000002'}, {'username': 'test0003', 'password': 'pwd0003', 'email': 'test0003@debugtalk.test', 'phone': '18600000003'}, {'username': 'test0004', 'password': 'pwd0004', 'email': 'test0004@debugtalk.test', 'phone': '18600000004'}, {'username': 'test0005', 'password': 'pwd0005', 'email': 'test0005@debugtalk.test', 'phone': '18600000005'}, {'username': 'test0006', 'password': 'pwd0006', 'email': 'test0006@debugtalk.test', 'phone': '18600000006'}, {'username': 'test0007', 'password': 'pwd0007', 'email': 'test0007@debugtalk.test', 'phone': '18600000007'}, {'username': 'test0008', 'password': 'pwd0008', 'email': 'test0008@debugtalk.test', 'phone': '18600000008'}, {'username': 'test0009', 'password': 'pwd0009', 'email': 'test0009@debugtalk.test', 'phone': '18600000009'}, {'username': 'test0010', 'password': 'pwd0010', 'email': 'test0010@debugtalk.test', 'phone': '18600000010'}, {'username': 'test0011', 'password': 'pwd0011', 'email': 'test0011@debugtalk.test', 'phone': '18600000011'}, {'username': 'test0012', 'password': 'pwd0012', 'email': 'test0012@debugtalk.test', 'phone': '18600000012'}, {'username': 'test0013', 'password': 'pwd0013', 'email': 'test0013@debugtalk.test', 'phone': '18600000013'}, {'username': 'test0014', 'password': 'pwd0014', 'email': 'test0014@debugtalk.test', 'phone': '18600000014'}, {'username': 'test0015', 'password': 'pwd0015', 'email': 'test0015@debugtalk.test', 'phone': '18600000015'}, {'username': 'test0016', 'password': 'pwd0016', 'email': 'test0016@debugtalk.test', 'phone': '18600000016'}, {'username': 'test0017', 'password': 'pwd0017', 'email': 'test0017@debugtalk.test', 'phone': '18600000017'}, {'username': 'test0018', 'password': 'pwd0018', 'email': 'test0018@debugtalk.test', 'phone': '18600000018'}, {'username': 'test0019', 'password': 'pwd0019', 'email': 'test0019@debugtalk.test', 'phone': '18600000019'}, {'username': 'test0020', 'password': 'pwd0020', 'email': 'test0020@debugtalk.test', 'phone': '18600000020'}, {'username': 'test0021', 'password': 'pwd0021', 'email': 'test0021@debugtalk.test', 'phone': '18600000021'}, {'username': 'test0022', 'password': 'pwd0022', 'email': 'test0022@debugtalk.test', 'phone': '18600000022'}, {'username': 'test0023', 'password': 'pwd0023', 'email': 'test0023@debugtalk.test', 'phone': '18600000023'}, {'username': 'test0024', 'password': 'pwd0024', 'email': 'test0024@debugtalk.test', 'phone': '18600000024'}, {'username': 'test0025', 'password': 'pwd0025', 'email': 'test0025@debugtalk.test', 'phone': '18600000025'}, {'username': 'test0026', 'password': 'pwd0026', 'email': 'test0026@debugtalk.test', 'phone': '18600000026'}, {'username': 'test0027', 'password': 'pwd0027', 'email': 'test0027@debugtalk.test', 'phone': '18600000027'}, {'username': 'test0028', 'password': 'pwd0028', 'email': 'test0028@debugtalk.test', 'phone': '18600000028'}, {'username': 'test0029', 'password': 'pwd0029', 'email': 'test0029@debugtalk.test', 'phone': '18600000029'}, {'username': 'test0030', 'password': 'pwd0030', 'email': 'test0030@debugtalk.test', 'phone': '18600000030'}, {'username': 'test0031', 'password': 'pwd0031', 'email': 'test0031@debugtalk.test', 'phone': '18600000031'}, {'username': 'test0032', 'password': 'pwd0032', 'email': 'test0032@debugtalk.test', 'phone': '18600000032'}, {'username': 'test0033', 'password': 'pwd0033', 'email': 'test0033@debugtalk.test', 'phone': '18600000033'}, {'username': 'test0034', 'password': 'pwd0034', 'email': 'test0034@debugtalk.test', 'phone': '18600000034'}, {'username': 'test0035', 'password': 'pwd0035', 'email': 'test0035@debugtalk.test', 'phone': '18600000035'}, {'username': 'test0036', 'password': 'pwd0036', 'email': 'test0036@debugtalk.test', 'phone': '18600000036'}, {'username': 'test0037', 'password': 'pwd0037', 'email': 'test0037@debugtalk.test', 'phone': '18600000037'}, {'username': 'test0038', 'password': 'pwd0038', 'email': 'test0038@debugtalk.test', 'phone': '18600000038'}, {'username': 'test0039', 'password': 'pwd0039', 'email': 'test0039@debugtalk.test', 'phone': '18600000039'}, {'username': 'test0040', 'password': 'pwd0040', 'email': 'test0040@debugtalk.test', 'phone': '18600000040'}, {'username': 'test0041', 'password': 'pwd0041', 'email': 'test0041@debugtalk.test', 'phone': '18600000041'}, {'username': 'test0042', 'password': 'pwd0042', 'email': 'test0042@debugtalk.test', 'phone': '18600000042'}, {'username': 'test0043', 'password': 'pwd0043', 'email': 'test0043@debugtalk.test', 'phone': '18600000043'}, {'username': 'test0044', 'password': 'pwd0044', 'email': 'test0044@debugtalk.test', 'phone': '18600000044'}, {'username': 'test0045', 'password': 'pwd0045', 'email': 'test0045@debugtalk.test', 'phone': '18600000045'}, {'username': 'test0046', 'password': 'pwd0046', 'email': 'test0046@debugtalk.test', 'phone': '18600000046'}, {'username': 'test0047', 'password': 'pwd0047', 'email': 'test0047@debugtalk.test', 'phone': '18600000047'}, {'username': 'test0048', 'password': 'pwd0048', 'email': 'test0048@debugtalk.test', 'phone': '18600000048'}, {'username': 'test0049', 'password': 'pwd0049', 'email': 'test0049@debugtalk.test', 'phone': '18600000049'}, {'username': 'test0050', 'password': 'pwd0050', 'email': 'test0050@debugtalk.test', 'phone': '18600000050'}, {'username': 'test0051', 'password': 'pwd0051', 'email': 'test0051@debugtalk.test', 'phone': '18600000051'}, {'username': 'test0052', 'password': 'pwd0052', 'email': 'test0052@debugtalk.test', 'phone': '18600000052'}, {'username': 'test0053', 'password': 'pwd0053', 'email': 'test0053@debugtalk.test', 'phone': '18600000053'}, {'username': 'test0054', 'password': 'pwd0054', 'email': 'test0054@debugtalk.test', 'phone': '18600000054'}, {'username': 'test0055', 'password': 'pwd0055', 'email': 'test0055@debugtalk.test', 'phone': '18600000055'}, {'username': 'test0056', 'password': 'pwd0056', 'email': 'test0056@debugtalk.test', 'phone': '18600000056'}, {'username': 'test0057', 'password': 'pwd0057', 'email': 'test0057@debugtalk.test', 'phone': '18600000057'}, {'username': 'test0058', 'password': 'pwd0058', 'email': 'test0058@debugtalk.test', 'phone': '18600000058'}, {'username': 'test0059', 'password': 'pwd0059', 'email': 'test0059@debugtalk.test', 'phone': '18600000059'}, {'username': 'test0060', 'password': 'pwd0060', 'email': 'test0060@debugtalk.test', 'phone': '18600000060'}, {'username': 'test0061', 'password': 'pwd0061', 'email': 'test0061@debugtalk.test', 'phone': '18600000061'}, {'username': 'test0062', 'password': 'pwd0062', 'email': 'test0062@debugtalk.test', 'phone': '18600000062'}, {'username': 'test0063', 'password': 'pwd0063', 'email': 'test0063@debugtalk.test', 'phone': '18600000063'}, {'username': 'test0064', 'password': 'pwd0064', 'email': 'test0064@debugtalk.test', 'phone': '18600000064'}, {'username': 'test0065', 'password': 'pwd0065', 'email': 'test0065@debugtalk.test', 'phone': '18600000065'}, {'username': 'test0066', 'password': 'pwd0066', 'email': 'test0066@debugtalk.test', 'phone': '18600000066'}, {'username': 'test0067', 'password': 'pwd0067', 'email': 'test0067@debugtalk.test', 'phone': '18600000067'}, {'username': 'test0068', 'password': 'pwd0068', 'email': 'test0068@debugtalk.test', 'phone': '18600000068'}, {'username': 'test0069', 'password': 'pwd0069', 'email': 'test0069@debugtalk.test', 'phone': '18600000069'}, {'username': 'test0070', 'password': 'pwd0070', 'email': 'test0070@debugtalk.test', 'phone': '18600000070'}, {'username': 'test0071', 'password': 'pwd0071', 'email': 'test0071@debugtalk.test', 'phone': '18600000071'}, {'username': 'test0072', 'password': 'pwd0072', 'email': 'test0072@debugtalk.test', 'phone': '18600000072'}, {'username': 'test0073', 'password': 'pwd0073', 'email': 'test0073@debugtalk.test', 'phone': '18600000073'}, {'username': 'test0074', 'password': 'pwd0074', 'email': 'test0074@debugtalk.test', 'phone': '18600000074'}, {'username': 'test0075', 'password': 'pwd0075', 'email': 'test0075@debugtalk.test', 'phone': '18600000075'}, {'username': 'test0076', 'password': 'pwd0076', 'email': 'test0076@debugtalk.test', 'phone': '18600000076'}, {'username': 'test0077', 'password': 'pwd0077', 'email': 'test0077@debugtalk.test', 'phone': '18600000077'}, {'username': 'test0078', 'password': 'pwd0078', 'email': 'test0078@debugtalk.test', 'phone': '18600000078'}, {'username': 'test0079', 'password': 'pwd0079', 'email': 'test0079@debugtalk.test', 'phone': '18600000079'}, {'username': 'test0080', 'password': 'pwd0080', 'email': 'test0080@debugtalk.test', 'phone': '18600000080'}, {'username': 'test0081', 'password': 'pwd0081', 'email': 'test0081@debugtalk.test', 'phone': '18600000081'}, {'username': 'test0082', 'password': 'pwd0082', 'email': 'test0082@debugtalk.test', 'phone': '18600000082'}, {'username': 'test0083', 'password': 'pwd0083', 'email': 'test0083@debugtalk.test', 'phone': '18600000083'}, {'username': 'test0084', 'password': 'pwd0084', 'email': 'test0084@debugtalk.test', 'phone': '18600000084'}, {'username': 'test0085', 'password': 'pwd0085', 'email': 'test0085@debugtalk.test', 'phone': '18600000085'}, {'username': 'test0086', 'password': 'pwd0086', 'email': 'test0086@debugtalk.test', 'phone': '18600000086'}, {'username': 'test0087', 'password': 'pwd0087', 'email': 'test0087@debugtalk.test', 'phone': '18600000087'}, {'username': 'test0088', 'password': 'pwd0088', 'email': 'test0088@debugtalk.test', 'phone': '18600000088'}, {'username': 'test0089', 'password': 'pwd0089', 'email': 'test0089@debugtalk.test', 'phone': '18600000089'}, {'username': 'test0090', 'password': 'pwd0090', 'email': 'test0090@debugtalk.test', 'phone': '18600000090'}, {'username': 'test0091', 'password': 'pwd0091', 'email': 'test0091@debugtalk.test', 'phone': '18600000091'}, {'username': 'test0092', 'password': 'pwd0092', 'email': 'test0092@debugtalk.test', 'phone': '18600000092'}, {'username': 'test0093', 'password': 'pwd0093', 'email': 'test0093@debugtalk.test', 'phone': '18600000093'}, {'username': 'test0094', 'password': 'pwd0094', 'email': 'test0094@debugtalk.test', 'phone': '18600000094'}, {'username': 'test0095', 'password': 'pwd0095', 'email': 'test0095@debugtalk.test', 'phone': '18600000095'}, {'username': 'test0096', 'password': 'pwd0096', 'email': 'test0096@debugtalk.test', 'phone': '18600000096'}, {'username': 'test0097', 'password': 'pwd0097', 'email': 'test0097@debugtalk.test', 'phone': '18600000097'}, {'username': 'test0098', 'password': 'pwd0098', 'email': 'test0098@debugtalk.test', 'phone': '18600000098'}, {'username': 'test0099', 'password': 'pwd0099', 'email': 'test0099@debugtalk.test', 'phone': '18600000099'}]
    
    Process finished with exit code 0
    

      这里我写了三种方法,推荐第三种,至于为啥写这么多,权当复习一下python的语法。

      测试数据准备好了,可以添加到队列中:

      法1:

    result_list = []
    for index in range(100):
        data = {
                "username": "test%04d" % index,
                "password": "pwd%04d" % index,
                "email": "test%04d@debugtalk.test" % index,
                "phone": "186%08d" % index,
            }
        result_list.append(data)
    # print(result_list)
    
    
    user_data_queue = queue.Queue()
    for index in result_list:
        user_data_queue.put_nowait(index)
        print(index)
        print(user_data_queue.get())
    

      结果:

    {'username': 'test0000', 'password': 'pwd0000', 'email': 'test0000@debugtalk.test', 'phone': '18600000000'}
    {'username': 'test0000', 'password': 'pwd0000', 'email': 'test0000@debugtalk.test', 'phone': '18600000000'}
    {'username': 'test0001', 'password': 'pwd0001', 'email': 'test0001@debugtalk.test', 'phone': '18600000001'}
    {'username': 'test0001', 'password': 'pwd0001', 'email': 'test0001@debugtalk.test', 'phone': '18600000001'}
    {'username': 'test0002', 'password': 'pwd0002', 'email': 'test0002@debugtalk.test', 'phone': '18600000002'}
    {'username': 'test0002', 'password': 'pwd0002', 'email': 'test0002@debugtalk.test', 'phone': '18600000002'}
    {'username': 'test0003', 'password': 'pwd0003', 'email': 'test0003@debugtalk.test', 'phone': '18600000003'}
    {'username': 'test0003', 'password': 'pwd0003', 'email': 'test0003@debugtalk.test', 'phone': '18600000003'}
    {'username': 'test0004', 'password': 'pwd0004', 'email': 'test0004@debugtalk.test', 'phone': '18600000004'}
    {'username': 'test0004', 'password': 'pwd0004', 'email': 'test0004@debugtalk.test', 'phone': '18600000004'}
    {'username': 'test0005', 'password': 'pwd0005', 'email': 'test0005@debugtalk.test', 'phone': '18600000005'}
    {'username': 'test0005', 'password': 'pwd0005', 'email': 'test0005@debugtalk.test', 'phone': '18600000005'}
    {'username': 'test0006', 'password': 'pwd0006', 'email': 'test0006@debugtalk.test', 'phone': '18600000006'}
    {'username': 'test0006', 'password': 'pwd0006', 'email': 'test0006@debugtalk.test', 'phone': '18600000006'}
    {'username': 'test0007', 'password': 'pwd0007', 'email': 'test0007@debugtalk.test', 'phone': '18600000007'}
    {'username': 'test0007', 'password': 'pwd0007', 'email': 'test0007@debugtalk.test', 'phone': '18600000007'}
    {'username': 'test0008', 'password': 'pwd0008', 'email': 'test0008@debugtalk.test', 'phone': '18600000008'}
    {'username': 'test0008', 'password': 'pwd0008', 'email': 'test0008@debugtalk.test', 'phone': '18600000008'}
    {'username': 'test0009', 'password': 'pwd0009', 'email': 'test0009@debugtalk.test', 'phone': '18600000009'}
    {'username': 'test0009', 'password': 'pwd0009', 'email': 'test0009@debugtalk.test', 'phone': '18600000009'}
    {'username': 'test0010', 'password': 'pwd0010', 'email': 'test0010@debugtalk.test', 'phone': '18600000010'}
    {'username': 'test0010', 'password': 'pwd0010', 'email': 'test0010@debugtalk.test', 'phone': '18600000010'}
    {'username': 'test0011', 'password': 'pwd0011', 'email': 'test0011@debugtalk.test', 'phone': '18600000011'}
    {'username': 'test0011', 'password': 'pwd0011', 'email': 'test0011@debugtalk.test', 'phone': '18600000011'}
    {'username': 'test0012', 'password': 'pwd0012', 'email': 'test0012@debugtalk.test', 'phone': '18600000012'}
    {'username': 'test0012', 'password': 'pwd0012', 'email': 'test0012@debugtalk.test', 'phone': '18600000012'}
    {'username': 'test0013', 'password': 'pwd0013', 'email': 'test0013@debugtalk.test', 'phone': '18600000013'}
    {'username': 'test0013', 'password': 'pwd0013', 'email': 'test0013@debugtalk.test', 'phone': '18600000013'}
    {'username': 'test0014', 'password': 'pwd0014', 'email': 'test0014@debugtalk.test', 'phone': '18600000014'}
    {'username': 'test0014', 'password': 'pwd0014', 'email': 'test0014@debugtalk.test', 'phone': '18600000014'}
    {'username': 'test0015', 'password': 'pwd0015', 'email': 'test0015@debugtalk.test', 'phone': '18600000015'}
    {'username': 'test0015', 'password': 'pwd0015', 'email': 'test0015@debugtalk.test', 'phone': '18600000015'}
    {'username': 'test0016', 'password': 'pwd0016', 'email': 'test0016@debugtalk.test', 'phone': '18600000016'}
    {'username': 'test0016', 'password': 'pwd0016', 'email': 'test0016@debugtalk.test', 'phone': '18600000016'}
    {'username': 'test0017', 'password': 'pwd0017', 'email': 'test0017@debugtalk.test', 'phone': '18600000017'}
    {'username': 'test0017', 'password': 'pwd0017', 'email': 'test0017@debugtalk.test', 'phone': '18600000017'}
    {'username': 'test0018', 'password': 'pwd0018', 'email': 'test0018@debugtalk.test', 'phone': '18600000018'}
    {'username': 'test0018', 'password': 'pwd0018', 'email': 'test0018@debugtalk.test', 'phone': '18600000018'}
    {'username': 'test0019', 'password': 'pwd0019', 'email': 'test0019@debugtalk.test', 'phone': '18600000019'}
    {'username': 'test0019', 'password': 'pwd0019', 'email': 'test0019@debugtalk.test', 'phone': '18600000019'}
    {'username': 'test0020', 'password': 'pwd0020', 'email': 'test0020@debugtalk.test', 'phone': '18600000020'}
    {'username': 'test0020', 'password': 'pwd0020', 'email': 'test0020@debugtalk.test', 'phone': '18600000020'}
    {'username': 'test0021', 'password': 'pwd0021', 'email': 'test0021@debugtalk.test', 'phone': '18600000021'}
    {'username': 'test0021', 'password': 'pwd0021', 'email': 'test0021@debugtalk.test', 'phone': '18600000021'}
    {'username': 'test0022', 'password': 'pwd0022', 'email': 'test0022@debugtalk.test', 'phone': '18600000022'}
    {'username': 'test0022', 'password': 'pwd0022', 'email': 'test0022@debugtalk.test', 'phone': '18600000022'}
    {'username': 'test0023', 'password': 'pwd0023', 'email': 'test0023@debugtalk.test', 'phone': '18600000023'}
    {'username': 'test0023', 'password': 'pwd0023', 'email': 'test0023@debugtalk.test', 'phone': '18600000023'}
    {'username': 'test0024', 'password': 'pwd0024', 'email': 'test0024@debugtalk.test', 'phone': '18600000024'}
    {'username': 'test0024', 'password': 'pwd0024', 'email': 'test0024@debugtalk.test', 'phone': '18600000024'}
    {'username': 'test0025', 'password': 'pwd0025', 'email': 'test0025@debugtalk.test', 'phone': '18600000025'}
    {'username': 'test0025', 'password': 'pwd0025', 'email': 'test0025@debugtalk.test', 'phone': '18600000025'}
    {'username': 'test0026', 'password': 'pwd0026', 'email': 'test0026@debugtalk.test', 'phone': '18600000026'}
    {'username': 'test0026', 'password': 'pwd0026', 'email': 'test0026@debugtalk.test', 'phone': '18600000026'}
    {'username': 'test0027', 'password': 'pwd0027', 'email': 'test0027@debugtalk.test', 'phone': '18600000027'}
    {'username': 'test0027', 'password': 'pwd0027', 'email': 'test0027@debugtalk.test', 'phone': '18600000027'}
    {'username': 'test0028', 'password': 'pwd0028', 'email': 'test0028@debugtalk.test', 'phone': '18600000028'}
    {'username': 'test0028', 'password': 'pwd0028', 'email': 'test0028@debugtalk.test', 'phone': '18600000028'}
    {'username': 'test0029', 'password': 'pwd0029', 'email': 'test0029@debugtalk.test', 'phone': '18600000029'}
    {'username': 'test0029', 'password': 'pwd0029', 'email': 'test0029@debugtalk.test', 'phone': '18600000029'}
    {'username': 'test0030', 'password': 'pwd0030', 'email': 'test0030@debugtalk.test', 'phone': '18600000030'}
    {'username': 'test0030', 'password': 'pwd0030', 'email': 'test0030@debugtalk.test', 'phone': '18600000030'}
    {'username': 'test0031', 'password': 'pwd0031', 'email': 'test0031@debugtalk.test', 'phone': '18600000031'}
    {'username': 'test0031', 'password': 'pwd0031', 'email': 'test0031@debugtalk.test', 'phone': '18600000031'}
    {'username': 'test0032', 'password': 'pwd0032', 'email': 'test0032@debugtalk.test', 'phone': '18600000032'}
    {'username': 'test0032', 'password': 'pwd0032', 'email': 'test0032@debugtalk.test', 'phone': '18600000032'}
    {'username': 'test0033', 'password': 'pwd0033', 'email': 'test0033@debugtalk.test', 'phone': '18600000033'}
    {'username': 'test0033', 'password': 'pwd0033', 'email': 'test0033@debugtalk.test', 'phone': '18600000033'}
    {'username': 'test0034', 'password': 'pwd0034', 'email': 'test0034@debugtalk.test', 'phone': '18600000034'}
    {'username': 'test0034', 'password': 'pwd0034', 'email': 'test0034@debugtalk.test', 'phone': '18600000034'}
    {'username': 'test0035', 'password': 'pwd0035', 'email': 'test0035@debugtalk.test', 'phone': '18600000035'}
    {'username': 'test0035', 'password': 'pwd0035', 'email': 'test0035@debugtalk.test', 'phone': '18600000035'}
    {'username': 'test0036', 'password': 'pwd0036', 'email': 'test0036@debugtalk.test', 'phone': '18600000036'}
    {'username': 'test0036', 'password': 'pwd0036', 'email': 'test0036@debugtalk.test', 'phone': '18600000036'}
    {'username': 'test0037', 'password': 'pwd0037', 'email': 'test0037@debugtalk.test', 'phone': '18600000037'}
    {'username': 'test0037', 'password': 'pwd0037', 'email': 'test0037@debugtalk.test', 'phone': '18600000037'}
    {'username': 'test0038', 'password': 'pwd0038', 'email': 'test0038@debugtalk.test', 'phone': '18600000038'}
    {'username': 'test0038', 'password': 'pwd0038', 'email': 'test0038@debugtalk.test', 'phone': '18600000038'}
    {'username': 'test0039', 'password': 'pwd0039', 'email': 'test0039@debugtalk.test', 'phone': '18600000039'}
    {'username': 'test0039', 'password': 'pwd0039', 'email': 'test0039@debugtalk.test', 'phone': '18600000039'}
    {'username': 'test0040', 'password': 'pwd0040', 'email': 'test0040@debugtalk.test', 'phone': '18600000040'}
    {'username': 'test0040', 'password': 'pwd0040', 'email': 'test0040@debugtalk.test', 'phone': '18600000040'}
    {'username': 'test0041', 'password': 'pwd0041', 'email': 'test0041@debugtalk.test', 'phone': '18600000041'}
    {'username': 'test0041', 'password': 'pwd0041', 'email': 'test0041@debugtalk.test', 'phone': '18600000041'}
    {'username': 'test0042', 'password': 'pwd0042', 'email': 'test0042@debugtalk.test', 'phone': '18600000042'}
    {'username': 'test0042', 'password': 'pwd0042', 'email': 'test0042@debugtalk.test', 'phone': '18600000042'}
    {'username': 'test0043', 'password': 'pwd0043', 'email': 'test0043@debugtalk.test', 'phone': '18600000043'}
    {'username': 'test0043', 'password': 'pwd0043', 'email': 'test0043@debugtalk.test', 'phone': '18600000043'}
    {'username': 'test0044', 'password': 'pwd0044', 'email': 'test0044@debugtalk.test', 'phone': '18600000044'}
    {'username': 'test0044', 'password': 'pwd0044', 'email': 'test0044@debugtalk.test', 'phone': '18600000044'}
    {'username': 'test0045', 'password': 'pwd0045', 'email': 'test0045@debugtalk.test', 'phone': '18600000045'}
    {'username': 'test0045', 'password': 'pwd0045', 'email': 'test0045@debugtalk.test', 'phone': '18600000045'}
    {'username': 'test0046', 'password': 'pwd0046', 'email': 'test0046@debugtalk.test', 'phone': '18600000046'}
    {'username': 'test0046', 'password': 'pwd0046', 'email': 'test0046@debugtalk.test', 'phone': '18600000046'}
    {'username': 'test0047', 'password': 'pwd0047', 'email': 'test0047@debugtalk.test', 'phone': '18600000047'}
    {'username': 'test0047', 'password': 'pwd0047', 'email': 'test0047@debugtalk.test', 'phone': '18600000047'}
    {'username': 'test0048', 'password': 'pwd0048', 'email': 'test0048@debugtalk.test', 'phone': '18600000048'}
    {'username': 'test0048', 'password': 'pwd0048', 'email': 'test0048@debugtalk.test', 'phone': '18600000048'}
    {'username': 'test0049', 'password': 'pwd0049', 'email': 'test0049@debugtalk.test', 'phone': '18600000049'}
    {'username': 'test0049', 'password': 'pwd0049', 'email': 'test0049@debugtalk.test', 'phone': '18600000049'}
    {'username': 'test0050', 'password': 'pwd0050', 'email': 'test0050@debugtalk.test', 'phone': '18600000050'}
    {'username': 'test0050', 'password': 'pwd0050', 'email': 'test0050@debugtalk.test', 'phone': '18600000050'}
    {'username': 'test0051', 'password': 'pwd0051', 'email': 'test0051@debugtalk.test', 'phone': '18600000051'}
    {'username': 'test0051', 'password': 'pwd0051', 'email': 'test0051@debugtalk.test', 'phone': '18600000051'}
    {'username': 'test0052', 'password': 'pwd0052', 'email': 'test0052@debugtalk.test', 'phone': '18600000052'}
    {'username': 'test0052', 'password': 'pwd0052', 'email': 'test0052@debugtalk.test', 'phone': '18600000052'}
    {'username': 'test0053', 'password': 'pwd0053', 'email': 'test0053@debugtalk.test', 'phone': '18600000053'}
    {'username': 'test0053', 'password': 'pwd0053', 'email': 'test0053@debugtalk.test', 'phone': '18600000053'}
    {'username': 'test0054', 'password': 'pwd0054', 'email': 'test0054@debugtalk.test', 'phone': '18600000054'}
    {'username': 'test0054', 'password': 'pwd0054', 'email': 'test0054@debugtalk.test', 'phone': '18600000054'}
    {'username': 'test0055', 'password': 'pwd0055', 'email': 'test0055@debugtalk.test', 'phone': '18600000055'}
    {'username': 'test0055', 'password': 'pwd0055', 'email': 'test0055@debugtalk.test', 'phone': '18600000055'}
    {'username': 'test0056', 'password': 'pwd0056', 'email': 'test0056@debugtalk.test', 'phone': '18600000056'}
    {'username': 'test0056', 'password': 'pwd0056', 'email': 'test0056@debugtalk.test', 'phone': '18600000056'}
    {'username': 'test0057', 'password': 'pwd0057', 'email': 'test0057@debugtalk.test', 'phone': '18600000057'}
    {'username': 'test0057', 'password': 'pwd0057', 'email': 'test0057@debugtalk.test', 'phone': '18600000057'}
    {'username': 'test0058', 'password': 'pwd0058', 'email': 'test0058@debugtalk.test', 'phone': '18600000058'}
    {'username': 'test0058', 'password': 'pwd0058', 'email': 'test0058@debugtalk.test', 'phone': '18600000058'}
    {'username': 'test0059', 'password': 'pwd0059', 'email': 'test0059@debugtalk.test', 'phone': '18600000059'}
    {'username': 'test0059', 'password': 'pwd0059', 'email': 'test0059@debugtalk.test', 'phone': '18600000059'}
    {'username': 'test0060', 'password': 'pwd0060', 'email': 'test0060@debugtalk.test', 'phone': '18600000060'}
    {'username': 'test0060', 'password': 'pwd0060', 'email': 'test0060@debugtalk.test', 'phone': '18600000060'}
    {'username': 'test0061', 'password': 'pwd0061', 'email': 'test0061@debugtalk.test', 'phone': '18600000061'}
    {'username': 'test0061', 'password': 'pwd0061', 'email': 'test0061@debugtalk.test', 'phone': '18600000061'}
    {'username': 'test0062', 'password': 'pwd0062', 'email': 'test0062@debugtalk.test', 'phone': '18600000062'}
    {'username': 'test0062', 'password': 'pwd0062', 'email': 'test0062@debugtalk.test', 'phone': '18600000062'}
    {'username': 'test0063', 'password': 'pwd0063', 'email': 'test0063@debugtalk.test', 'phone': '18600000063'}
    {'username': 'test0063', 'password': 'pwd0063', 'email': 'test0063@debugtalk.test', 'phone': '18600000063'}
    {'username': 'test0064', 'password': 'pwd0064', 'email': 'test0064@debugtalk.test', 'phone': '18600000064'}
    {'username': 'test0064', 'password': 'pwd0064', 'email': 'test0064@debugtalk.test', 'phone': '18600000064'}
    {'username': 'test0065', 'password': 'pwd0065', 'email': 'test0065@debugtalk.test', 'phone': '18600000065'}
    {'username': 'test0065', 'password': 'pwd0065', 'email': 'test0065@debugtalk.test', 'phone': '18600000065'}
    {'username': 'test0066', 'password': 'pwd0066', 'email': 'test0066@debugtalk.test', 'phone': '18600000066'}
    {'username': 'test0066', 'password': 'pwd0066', 'email': 'test0066@debugtalk.test', 'phone': '18600000066'}
    {'username': 'test0067', 'password': 'pwd0067', 'email': 'test0067@debugtalk.test', 'phone': '18600000067'}
    {'username': 'test0067', 'password': 'pwd0067', 'email': 'test0067@debugtalk.test', 'phone': '18600000067'}
    {'username': 'test0068', 'password': 'pwd0068', 'email': 'test0068@debugtalk.test', 'phone': '18600000068'}
    {'username': 'test0068', 'password': 'pwd0068', 'email': 'test0068@debugtalk.test', 'phone': '18600000068'}
    {'username': 'test0069', 'password': 'pwd0069', 'email': 'test0069@debugtalk.test', 'phone': '18600000069'}
    {'username': 'test0069', 'password': 'pwd0069', 'email': 'test0069@debugtalk.test', 'phone': '18600000069'}
    {'username': 'test0070', 'password': 'pwd0070', 'email': 'test0070@debugtalk.test', 'phone': '18600000070'}
    {'username': 'test0070', 'password': 'pwd0070', 'email': 'test0070@debugtalk.test', 'phone': '18600000070'}
    {'username': 'test0071', 'password': 'pwd0071', 'email': 'test0071@debugtalk.test', 'phone': '18600000071'}
    {'username': 'test0071', 'password': 'pwd0071', 'email': 'test0071@debugtalk.test', 'phone': '18600000071'}
    {'username': 'test0072', 'password': 'pwd0072', 'email': 'test0072@debugtalk.test', 'phone': '18600000072'}
    {'username': 'test0072', 'password': 'pwd0072', 'email': 'test0072@debugtalk.test', 'phone': '18600000072'}
    {'username': 'test0073', 'password': 'pwd0073', 'email': 'test0073@debugtalk.test', 'phone': '18600000073'}
    {'username': 'test0073', 'password': 'pwd0073', 'email': 'test0073@debugtalk.test', 'phone': '18600000073'}
    {'username': 'test0074', 'password': 'pwd0074', 'email': 'test0074@debugtalk.test', 'phone': '18600000074'}
    {'username': 'test0074', 'password': 'pwd0074', 'email': 'test0074@debugtalk.test', 'phone': '18600000074'}
    {'username': 'test0075', 'password': 'pwd0075', 'email': 'test0075@debugtalk.test', 'phone': '18600000075'}
    {'username': 'test0075', 'password': 'pwd0075', 'email': 'test0075@debugtalk.test', 'phone': '18600000075'}
    {'username': 'test0076', 'password': 'pwd0076', 'email': 'test0076@debugtalk.test', 'phone': '18600000076'}
    {'username': 'test0076', 'password': 'pwd0076', 'email': 'test0076@debugtalk.test', 'phone': '18600000076'}
    {'username': 'test0077', 'password': 'pwd0077', 'email': 'test0077@debugtalk.test', 'phone': '18600000077'}
    {'username': 'test0077', 'password': 'pwd0077', 'email': 'test0077@debugtalk.test', 'phone': '18600000077'}
    {'username': 'test0078', 'password': 'pwd0078', 'email': 'test0078@debugtalk.test', 'phone': '18600000078'}
    {'username': 'test0078', 'password': 'pwd0078', 'email': 'test0078@debugtalk.test', 'phone': '18600000078'}
    {'username': 'test0079', 'password': 'pwd0079', 'email': 'test0079@debugtalk.test', 'phone': '18600000079'}
    {'username': 'test0079', 'password': 'pwd0079', 'email': 'test0079@debugtalk.test', 'phone': '18600000079'}
    {'username': 'test0080', 'password': 'pwd0080', 'email': 'test0080@debugtalk.test', 'phone': '18600000080'}
    {'username': 'test0080', 'password': 'pwd0080', 'email': 'test0080@debugtalk.test', 'phone': '18600000080'}
    {'username': 'test0081', 'password': 'pwd0081', 'email': 'test0081@debugtalk.test', 'phone': '18600000081'}
    {'username': 'test0081', 'password': 'pwd0081', 'email': 'test0081@debugtalk.test', 'phone': '18600000081'}
    {'username': 'test0082', 'password': 'pwd0082', 'email': 'test0082@debugtalk.test', 'phone': '18600000082'}
    {'username': 'test0082', 'password': 'pwd0082', 'email': 'test0082@debugtalk.test', 'phone': '18600000082'}
    {'username': 'test0083', 'password': 'pwd0083', 'email': 'test0083@debugtalk.test', 'phone': '18600000083'}
    {'username': 'test0083', 'password': 'pwd0083', 'email': 'test0083@debugtalk.test', 'phone': '18600000083'}
    {'username': 'test0084', 'password': 'pwd0084', 'email': 'test0084@debugtalk.test', 'phone': '18600000084'}
    {'username': 'test0084', 'password': 'pwd0084', 'email': 'test0084@debugtalk.test', 'phone': '18600000084'}
    {'username': 'test0085', 'password': 'pwd0085', 'email': 'test0085@debugtalk.test', 'phone': '18600000085'}
    {'username': 'test0085', 'password': 'pwd0085', 'email': 'test0085@debugtalk.test', 'phone': '18600000085'}
    {'username': 'test0086', 'password': 'pwd0086', 'email': 'test0086@debugtalk.test', 'phone': '18600000086'}
    {'username': 'test0086', 'password': 'pwd0086', 'email': 'test0086@debugtalk.test', 'phone': '18600000086'}
    {'username': 'test0087', 'password': 'pwd0087', 'email': 'test0087@debugtalk.test', 'phone': '18600000087'}
    {'username': 'test0087', 'password': 'pwd0087', 'email': 'test0087@debugtalk.test', 'phone': '18600000087'}
    {'username': 'test0088', 'password': 'pwd0088', 'email': 'test0088@debugtalk.test', 'phone': '18600000088'}
    {'username': 'test0088', 'password': 'pwd0088', 'email': 'test0088@debugtalk.test', 'phone': '18600000088'}
    {'username': 'test0089', 'password': 'pwd0089', 'email': 'test0089@debugtalk.test', 'phone': '18600000089'}
    {'username': 'test0089', 'password': 'pwd0089', 'email': 'test0089@debugtalk.test', 'phone': '18600000089'}
    {'username': 'test0090', 'password': 'pwd0090', 'email': 'test0090@debugtalk.test', 'phone': '18600000090'}
    {'username': 'test0090', 'password': 'pwd0090', 'email': 'test0090@debugtalk.test', 'phone': '18600000090'}
    {'username': 'test0091', 'password': 'pwd0091', 'email': 'test0091@debugtalk.test', 'phone': '18600000091'}
    {'username': 'test0091', 'password': 'pwd0091', 'email': 'test0091@debugtalk.test', 'phone': '18600000091'}
    {'username': 'test0092', 'password': 'pwd0092', 'email': 'test0092@debugtalk.test', 'phone': '18600000092'}
    {'username': 'test0092', 'password': 'pwd0092', 'email': 'test0092@debugtalk.test', 'phone': '18600000092'}
    {'username': 'test0093', 'password': 'pwd0093', 'email': 'test0093@debugtalk.test', 'phone': '18600000093'}
    {'username': 'test0093', 'password': 'pwd0093', 'email': 'test0093@debugtalk.test', 'phone': '18600000093'}
    {'username': 'test0094', 'password': 'pwd0094', 'email': 'test0094@debugtalk.test', 'phone': '18600000094'}
    {'username': 'test0094', 'password': 'pwd0094', 'email': 'test0094@debugtalk.test', 'phone': '18600000094'}
    {'username': 'test0095', 'password': 'pwd0095', 'email': 'test0095@debugtalk.test', 'phone': '18600000095'}
    {'username': 'test0095', 'password': 'pwd0095', 'email': 'test0095@debugtalk.test', 'phone': '18600000095'}
    {'username': 'test0096', 'password': 'pwd0096', 'email': 'test0096@debugtalk.test', 'phone': '18600000096'}
    {'username': 'test0096', 'password': 'pwd0096', 'email': 'test0096@debugtalk.test', 'phone': '18600000096'}
    {'username': 'test0097', 'password': 'pwd0097', 'email': 'test0097@debugtalk.test', 'phone': '18600000097'}
    {'username': 'test0097', 'password': 'pwd0097', 'email': 'test0097@debugtalk.test', 'phone': '18600000097'}
    {'username': 'test0098', 'password': 'pwd0098', 'email': 'test0098@debugtalk.test', 'phone': '18600000098'}
    {'username': 'test0098', 'password': 'pwd0098', 'email': 'test0098@debugtalk.test', 'phone': '18600000098'}
    {'username': 'test0099', 'password': 'pwd0099', 'email': 'test0099@debugtalk.test', 'phone': '18600000099'}
    {'username': 'test0099', 'password': 'pwd0099', 'email': 'test0099@debugtalk.test', 'phone': '18600000099'}
    
    Process finished with exit code 0
    

      

      显然这样写有点啰嗦,改一下:

    user_data_queue = queue.Queue()
    for index in range(100):
        data = '''{
            "username": "test%04d",
            "password": "pwd%04d",
            "email": "test%04d@debugtalk.test",
            "phone": "186%08d",
        }'''%(index,index,index ,index)
        user_data_queue.put_nowait(data.replace(' ','').replace('
    ',''))
        print(user_data_queue.get())
    

      结果:

    {"username":"test0000","password":"pwd0000","email":"test0000@debugtalk.test","phone":"18600000000",}
    {"username":"test0001","password":"pwd0001","email":"test0001@debugtalk.test","phone":"18600000001",}
    {"username":"test0002","password":"pwd0002","email":"test0002@debugtalk.test","phone":"18600000002",}
    {"username":"test0003","password":"pwd0003","email":"test0003@debugtalk.test","phone":"18600000003",}
    {"username":"test0004","password":"pwd0004","email":"test0004@debugtalk.test","phone":"18600000004",}
    {"username":"test0005","password":"pwd0005","email":"test0005@debugtalk.test","phone":"18600000005",}
    {"username":"test0006","password":"pwd0006","email":"test0006@debugtalk.test","phone":"18600000006",}
    {"username":"test0007","password":"pwd0007","email":"test0007@debugtalk.test","phone":"18600000007",}
    {"username":"test0008","password":"pwd0008","email":"test0008@debugtalk.test","phone":"18600000008",}
    {"username":"test0009","password":"pwd0009","email":"test0009@debugtalk.test","phone":"18600000009",}
    {"username":"test0010","password":"pwd0010","email":"test0010@debugtalk.test","phone":"18600000010",}
    {"username":"test0011","password":"pwd0011","email":"test0011@debugtalk.test","phone":"18600000011",}
    {"username":"test0012","password":"pwd0012","email":"test0012@debugtalk.test","phone":"18600000012",}
    {"username":"test0013","password":"pwd0013","email":"test0013@debugtalk.test","phone":"18600000013",}
    {"username":"test0014","password":"pwd0014","email":"test0014@debugtalk.test","phone":"18600000014",}
    {"username":"test0015","password":"pwd0015","email":"test0015@debugtalk.test","phone":"18600000015",}
    {"username":"test0016","password":"pwd0016","email":"test0016@debugtalk.test","phone":"18600000016",}
    {"username":"test0017","password":"pwd0017","email":"test0017@debugtalk.test","phone":"18600000017",}
    {"username":"test0018","password":"pwd0018","email":"test0018@debugtalk.test","phone":"18600000018",}
    {"username":"test0019","password":"pwd0019","email":"test0019@debugtalk.test","phone":"18600000019",}
    {"username":"test0020","password":"pwd0020","email":"test0020@debugtalk.test","phone":"18600000020",}
    {"username":"test0021","password":"pwd0021","email":"test0021@debugtalk.test","phone":"18600000021",}
    {"username":"test0022","password":"pwd0022","email":"test0022@debugtalk.test","phone":"18600000022",}
    {"username":"test0023","password":"pwd0023","email":"test0023@debugtalk.test","phone":"18600000023",}
    {"username":"test0024","password":"pwd0024","email":"test0024@debugtalk.test","phone":"18600000024",}
    {"username":"test0025","password":"pwd0025","email":"test0025@debugtalk.test","phone":"18600000025",}
    {"username":"test0026","password":"pwd0026","email":"test0026@debugtalk.test","phone":"18600000026",}
    {"username":"test0027","password":"pwd0027","email":"test0027@debugtalk.test","phone":"18600000027",}
    {"username":"test0028","password":"pwd0028","email":"test0028@debugtalk.test","phone":"18600000028",}
    {"username":"test0029","password":"pwd0029","email":"test0029@debugtalk.test","phone":"18600000029",}
    {"username":"test0030","password":"pwd0030","email":"test0030@debugtalk.test","phone":"18600000030",}
    {"username":"test0031","password":"pwd0031","email":"test0031@debugtalk.test","phone":"18600000031",}
    {"username":"test0032","password":"pwd0032","email":"test0032@debugtalk.test","phone":"18600000032",}
    {"username":"test0033","password":"pwd0033","email":"test0033@debugtalk.test","phone":"18600000033",}
    {"username":"test0034","password":"pwd0034","email":"test0034@debugtalk.test","phone":"18600000034",}
    {"username":"test0035","password":"pwd0035","email":"test0035@debugtalk.test","phone":"18600000035",}
    {"username":"test0036","password":"pwd0036","email":"test0036@debugtalk.test","phone":"18600000036",}
    {"username":"test0037","password":"pwd0037","email":"test0037@debugtalk.test","phone":"18600000037",}
    {"username":"test0038","password":"pwd0038","email":"test0038@debugtalk.test","phone":"18600000038",}
    {"username":"test0039","password":"pwd0039","email":"test0039@debugtalk.test","phone":"18600000039",}
    {"username":"test0040","password":"pwd0040","email":"test0040@debugtalk.test","phone":"18600000040",}
    {"username":"test0041","password":"pwd0041","email":"test0041@debugtalk.test","phone":"18600000041",}
    {"username":"test0042","password":"pwd0042","email":"test0042@debugtalk.test","phone":"18600000042",}
    {"username":"test0043","password":"pwd0043","email":"test0043@debugtalk.test","phone":"18600000043",}
    {"username":"test0044","password":"pwd0044","email":"test0044@debugtalk.test","phone":"18600000044",}
    {"username":"test0045","password":"pwd0045","email":"test0045@debugtalk.test","phone":"18600000045",}
    {"username":"test0046","password":"pwd0046","email":"test0046@debugtalk.test","phone":"18600000046",}
    {"username":"test0047","password":"pwd0047","email":"test0047@debugtalk.test","phone":"18600000047",}
    {"username":"test0048","password":"pwd0048","email":"test0048@debugtalk.test","phone":"18600000048",}
    {"username":"test0049","password":"pwd0049","email":"test0049@debugtalk.test","phone":"18600000049",}
    {"username":"test0050","password":"pwd0050","email":"test0050@debugtalk.test","phone":"18600000050",}
    {"username":"test0051","password":"pwd0051","email":"test0051@debugtalk.test","phone":"18600000051",}
    {"username":"test0052","password":"pwd0052","email":"test0052@debugtalk.test","phone":"18600000052",}
    {"username":"test0053","password":"pwd0053","email":"test0053@debugtalk.test","phone":"18600000053",}
    {"username":"test0054","password":"pwd0054","email":"test0054@debugtalk.test","phone":"18600000054",}
    {"username":"test0055","password":"pwd0055","email":"test0055@debugtalk.test","phone":"18600000055",}
    {"username":"test0056","password":"pwd0056","email":"test0056@debugtalk.test","phone":"18600000056",}
    {"username":"test0057","password":"pwd0057","email":"test0057@debugtalk.test","phone":"18600000057",}
    {"username":"test0058","password":"pwd0058","email":"test0058@debugtalk.test","phone":"18600000058",}
    {"username":"test0059","password":"pwd0059","email":"test0059@debugtalk.test","phone":"18600000059",}
    {"username":"test0060","password":"pwd0060","email":"test0060@debugtalk.test","phone":"18600000060",}
    {"username":"test0061","password":"pwd0061","email":"test0061@debugtalk.test","phone":"18600000061",}
    {"username":"test0062","password":"pwd0062","email":"test0062@debugtalk.test","phone":"18600000062",}
    {"username":"test0063","password":"pwd0063","email":"test0063@debugtalk.test","phone":"18600000063",}
    {"username":"test0064","password":"pwd0064","email":"test0064@debugtalk.test","phone":"18600000064",}
    {"username":"test0065","password":"pwd0065","email":"test0065@debugtalk.test","phone":"18600000065",}
    {"username":"test0066","password":"pwd0066","email":"test0066@debugtalk.test","phone":"18600000066",}
    {"username":"test0067","password":"pwd0067","email":"test0067@debugtalk.test","phone":"18600000067",}
    {"username":"test0068","password":"pwd0068","email":"test0068@debugtalk.test","phone":"18600000068",}
    {"username":"test0069","password":"pwd0069","email":"test0069@debugtalk.test","phone":"18600000069",}
    {"username":"test0070","password":"pwd0070","email":"test0070@debugtalk.test","phone":"18600000070",}
    {"username":"test0071","password":"pwd0071","email":"test0071@debugtalk.test","phone":"18600000071",}
    {"username":"test0072","password":"pwd0072","email":"test0072@debugtalk.test","phone":"18600000072",}
    {"username":"test0073","password":"pwd0073","email":"test0073@debugtalk.test","phone":"18600000073",}
    {"username":"test0074","password":"pwd0074","email":"test0074@debugtalk.test","phone":"18600000074",}
    {"username":"test0075","password":"pwd0075","email":"test0075@debugtalk.test","phone":"18600000075",}
    {"username":"test0076","password":"pwd0076","email":"test0076@debugtalk.test","phone":"18600000076",}
    {"username":"test0077","password":"pwd0077","email":"test0077@debugtalk.test","phone":"18600000077",}
    {"username":"test0078","password":"pwd0078","email":"test0078@debugtalk.test","phone":"18600000078",}
    {"username":"test0079","password":"pwd0079","email":"test0079@debugtalk.test","phone":"18600000079",}
    {"username":"test0080","password":"pwd0080","email":"test0080@debugtalk.test","phone":"18600000080",}
    {"username":"test0081","password":"pwd0081","email":"test0081@debugtalk.test","phone":"18600000081",}
    {"username":"test0082","password":"pwd0082","email":"test0082@debugtalk.test","phone":"18600000082",}
    {"username":"test0083","password":"pwd0083","email":"test0083@debugtalk.test","phone":"18600000083",}
    {"username":"test0084","password":"pwd0084","email":"test0084@debugtalk.test","phone":"18600000084",}
    {"username":"test0085","password":"pwd0085","email":"test0085@debugtalk.test","phone":"18600000085",}
    {"username":"test0086","password":"pwd0086","email":"test0086@debugtalk.test","phone":"18600000086",}
    {"username":"test0087","password":"pwd0087","email":"test0087@debugtalk.test","phone":"18600000087",}
    {"username":"test0088","password":"pwd0088","email":"test0088@debugtalk.test","phone":"18600000088",}
    {"username":"test0089","password":"pwd0089","email":"test0089@debugtalk.test","phone":"18600000089",}
    {"username":"test0090","password":"pwd0090","email":"test0090@debugtalk.test","phone":"18600000090",}
    {"username":"test0091","password":"pwd0091","email":"test0091@debugtalk.test","phone":"18600000091",}
    {"username":"test0092","password":"pwd0092","email":"test0092@debugtalk.test","phone":"18600000092",}
    {"username":"test0093","password":"pwd0093","email":"test0093@debugtalk.test","phone":"18600000093",}
    {"username":"test0094","password":"pwd0094","email":"test0094@debugtalk.test","phone":"18600000094",}
    {"username":"test0095","password":"pwd0095","email":"test0095@debugtalk.test","phone":"18600000095",}
    {"username":"test0096","password":"pwd0096","email":"test0096@debugtalk.test","phone":"18600000096",}
    {"username":"test0097","password":"pwd0097","email":"test0097@debugtalk.test","phone":"18600000097",}
    {"username":"test0098","password":"pwd0098","email":"test0098@debugtalk.test","phone":"18600000098",}
    {"username":"test0099","password":"pwd0099","email":"test0099@debugtalk.test","phone":"18600000099",}
    
    Process finished with exit code 0
    

      

      到此,我们压测注册账号的测试数据已经准备完成,接下来就是压测脚本的编写。

      批量注册账号1(测试数据唯一性,不循环取数)

      场景:模拟多个用户并发注册,比如100个虚拟用户共享同一份测试数据,保证虚拟用户使用的数据不重复(唯一),并且数据取完,测试结束。

    __author__ = 'Leo'
    
    from locust import HttpLocust,task,TaskSet,between
    import queue
    
    class UserRegister(TaskSet):
    
        @task
        def test_register(self):
            # get_nowait() 取不到数据直接崩溃,直接跳到except; get() 取不到数据会一直等待
            try:
                # 从队列中取出数据
                data = eval(self.locust.user_data_queue.get_nowait())
                print("测试数据:%s"%data)
            # 使用get_nowait()方法,取不到数据,就进入这里
            except queue.Empty:
                print("测试数据已用完,结束!")
                exit(0)
            print('注册的用户账号: {}, 密码: {}' 
                  .format(data['username'], data['password']))
            payload = {
                'username': data['username'],
                'password': data['password']
    
            }
            self.client.post('/register',data=payload)
    
    
    class WebSiteUser(HttpLocust):
        host = 'https://www.testregister.com'
        task_set = UserRegister
        # 创建队列,先进先出
        user_data_queue = queue.Queue()
        # 循环加入队列
        for index in range(100):
            data = '''{
                "username": "test%04d",
                "password": "pwd%04d",
                "email": "test%04d@testregister.test",
                "phone": "186%08d"
            }''' % (index, index, index, index)
            # 将data存入队列中
            user_data_queue.put_nowait(data.replace(' ', '').replace('
    ', ''))
            # print(user_data_queue.get())
    
        wait_time = between(1,1)
    if __name__ == '__main__':
        import os
        os.system('locust -f locust_register.py')
    

      运行结果:

    [2020-06-27 11:01:32,723] WIN10-804191526/INFO/locust.main: Starting web monitor at http://*:8089
    [2020-06-27 11:01:32,724] WIN10-804191526/INFO/locust.main: Starting Locust 0.14.6
    [2020-06-27 11:01:36,216] WIN10-804191526/INFO/locust.runners: Hatching and swarming 1 users at the rate 1 users/s (0 users already running)...
    [2020-06-27 11:01:36,216] WIN10-804191526/INFO/locust.runners: All locusts hatched: WebSiteUser: 1 (0 already running)
    [2020-06-27 11:01:36,216] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0000', 'password': 'pwd0000', 'email': 'test0000@testregister.test', 'phone': '18600000000'}
    [2020-06-27 11:01:36,217] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:36,217] WIN10-804191526/INFO/stdout: 注册的用户账号: test0000, 密码: pwd0000
    [2020-06-27 11:01:36,217] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:40,693] WIN10-804191526/INFO/locust.runners: Hatching and swarming 100 users at the rate 1 users/s (0 users already running)...
    [2020-06-27 11:01:40,693] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0001', 'password': 'pwd0001', 'email': 'test0001@testregister.test', 'phone': '18600000001'}
    [2020-06-27 11:01:40,693] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:40,693] WIN10-804191526/INFO/stdout: 注册的用户账号: test0001, 密码: pwd0001
    [2020-06-27 11:01:40,694] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:41,695] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0002', 'password': 'pwd0002', 'email': 'test0002@testregister.test', 'phone': '18600000002'}
    [2020-06-27 11:01:41,695] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:41,695] WIN10-804191526/INFO/stdout: 注册的用户账号: test0002, 密码: pwd0002
    [2020-06-27 11:01:41,695] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:42,695] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0003', 'password': 'pwd0003', 'email': 'test0003@testregister.test', 'phone': '18600000003'}
    [2020-06-27 11:01:42,696] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:42,696] WIN10-804191526/INFO/stdout: 注册的用户账号: test0003, 密码: pwd0003
    [2020-06-27 11:01:42,696] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:43,696] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0004', 'password': 'pwd0004', 'email': 'test0004@testregister.test', 'phone': '18600000004'}
    [2020-06-27 11:01:43,696] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:43,696] WIN10-804191526/INFO/stdout: 注册的用户账号: test0004, 密码: pwd0004
    [2020-06-27 11:01:43,696] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:44,697] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0005', 'password': 'pwd0005', 'email': 'test0005@testregister.test', 'phone': '18600000005'}
    [2020-06-27 11:01:44,697] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:44,697] WIN10-804191526/INFO/stdout: 注册的用户账号: test0005, 密码: pwd0005
    [2020-06-27 11:01:44,697] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:45,698] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0006', 'password': 'pwd0006', 'email': 'test0006@testregister.test', 'phone': '18600000006'}
    [2020-06-27 11:01:45,698] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:45,698] WIN10-804191526/INFO/stdout: 注册的用户账号: test0006, 密码: pwd0006
    [2020-06-27 11:01:45,698] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:46,699] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0007', 'password': 'pwd0007', 'email': 'test0007@testregister.test', 'phone': '18600000007'}
    [2020-06-27 11:01:46,699] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:46,699] WIN10-804191526/INFO/stdout: 注册的用户账号: test0007, 密码: pwd0007
    [2020-06-27 11:01:46,699] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:47,700] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0008', 'password': 'pwd0008', 'email': 'test0008@testregister.test', 'phone': '18600000008'}
    [2020-06-27 11:01:47,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:47,700] WIN10-804191526/INFO/stdout: 注册的用户账号: test0008, 密码: pwd0008
    [2020-06-27 11:01:47,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:48,700] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0009', 'password': 'pwd0009', 'email': 'test0009@testregister.test', 'phone': '18600000009'}
    [2020-06-27 11:01:48,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:48,700] WIN10-804191526/INFO/stdout: 注册的用户账号: test0009, 密码: pwd0009
    [2020-06-27 11:01:48,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:49,701] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0010', 'password': 'pwd0010', 'email': 'test0010@testregister.test', 'phone': '18600000010'}
    [2020-06-27 11:01:49,701] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:49,701] WIN10-804191526/INFO/stdout: 注册的用户账号: test0010, 密码: pwd0010
    [2020-06-27 11:01:49,701] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:50,702] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0011', 'password': 'pwd0011', 'email': 'test0011@testregister.test', 'phone': '18600000011'}
    [2020-06-27 11:01:50,702] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:50,702] WIN10-804191526/INFO/stdout: 注册的用户账号: test0011, 密码: pwd0011
    [2020-06-27 11:01:50,702] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:51,703] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0012', 'password': 'pwd0012', 'email': 'test0012@testregister.test', 'phone': '18600000012'}
    [2020-06-27 11:01:51,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:51,703] WIN10-804191526/INFO/stdout: 注册的用户账号: test0012, 密码: pwd0012
    [2020-06-27 11:01:51,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:52,703] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0013', 'password': 'pwd0013', 'email': 'test0013@testregister.test', 'phone': '18600000013'}
    [2020-06-27 11:01:52,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:52,703] WIN10-804191526/INFO/stdout: 注册的用户账号: test0013, 密码: pwd0013
    [2020-06-27 11:01:52,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:53,704] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0014', 'password': 'pwd0014', 'email': 'test0014@testregister.test', 'phone': '18600000014'}
    [2020-06-27 11:01:53,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:53,704] WIN10-804191526/INFO/stdout: 注册的用户账号: test0014, 密码: pwd0014
    [2020-06-27 11:01:53,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:54,705] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0015', 'password': 'pwd0015', 'email': 'test0015@testregister.test', 'phone': '18600000015'}
    [2020-06-27 11:01:54,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:54,705] WIN10-804191526/INFO/stdout: 注册的用户账号: test0015, 密码: pwd0015
    [2020-06-27 11:01:54,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:55,705] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0016', 'password': 'pwd0016', 'email': 'test0016@testregister.test', 'phone': '18600000016'}
    [2020-06-27 11:01:55,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:55,705] WIN10-804191526/INFO/stdout: 注册的用户账号: test0016, 密码: pwd0016
    [2020-06-27 11:01:55,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:56,706] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0017', 'password': 'pwd0017', 'email': 'test0017@testregister.test', 'phone': '18600000017'}
    [2020-06-27 11:01:56,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:56,706] WIN10-804191526/INFO/stdout: 注册的用户账号: test0017, 密码: pwd0017
    [2020-06-27 11:01:56,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:57,707] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0018', 'password': 'pwd0018', 'email': 'test0018@testregister.test', 'phone': '18600000018'}
    [2020-06-27 11:01:57,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:57,707] WIN10-804191526/INFO/stdout: 注册的用户账号: test0018, 密码: pwd0018
    [2020-06-27 11:01:57,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:58,707] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0019', 'password': 'pwd0019', 'email': 'test0019@testregister.test', 'phone': '18600000019'}
    [2020-06-27 11:01:58,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:58,707] WIN10-804191526/INFO/stdout: 注册的用户账号: test0019, 密码: pwd0019
    [2020-06-27 11:01:58,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:59,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0020', 'password': 'pwd0020', 'email': 'test0020@testregister.test', 'phone': '18600000020'}
    [2020-06-27 11:01:59,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:01:59,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0020, 密码: pwd0020
    [2020-06-27 11:01:59,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:00,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0021', 'password': 'pwd0021', 'email': 'test0021@testregister.test', 'phone': '18600000021'}
    [2020-06-27 11:02:00,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:00,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0021, 密码: pwd0021
    [2020-06-27 11:02:00,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:01,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0022', 'password': 'pwd0022', 'email': 'test0022@testregister.test', 'phone': '18600000022'}
    [2020-06-27 11:02:01,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:01,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0022, 密码: pwd0022
    [2020-06-27 11:02:01,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:02,700] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0023', 'password': 'pwd0023', 'email': 'test0023@testregister.test', 'phone': '18600000023'}
    [2020-06-27 11:02:02,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:02,700] WIN10-804191526/INFO/stdout: 注册的用户账号: test0023, 密码: pwd0023
    [2020-06-27 11:02:02,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:02,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0024', 'password': 'pwd0024', 'email': 'test0024@testregister.test', 'phone': '18600000024'}
    [2020-06-27 11:02:02,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:02,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0024, 密码: pwd0024
    [2020-06-27 11:02:02,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:03,703] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0025', 'password': 'pwd0025', 'email': 'test0025@testregister.test', 'phone': '18600000025'}
    [2020-06-27 11:02:03,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:03,703] WIN10-804191526/INFO/stdout: 注册的用户账号: test0025, 密码: pwd0025
    [2020-06-27 11:02:03,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:03,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0026', 'password': 'pwd0026', 'email': 'test0026@testregister.test', 'phone': '18600000026'}
    [2020-06-27 11:02:03,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:03,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0026, 密码: pwd0026
    [2020-06-27 11:02:03,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:04,700] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0027', 'password': 'pwd0027', 'email': 'test0027@testregister.test', 'phone': '18600000027'}
    [2020-06-27 11:02:04,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:04,700] WIN10-804191526/INFO/stdout: 注册的用户账号: test0027, 密码: pwd0027
    [2020-06-27 11:02:04,700] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:04,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0028', 'password': 'pwd0028', 'email': 'test0028@testregister.test', 'phone': '18600000028'}
    [2020-06-27 11:02:04,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:04,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0028, 密码: pwd0028
    [2020-06-27 11:02:04,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:05,701] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0029', 'password': 'pwd0029', 'email': 'test0029@testregister.test', 'phone': '18600000029'}
    [2020-06-27 11:02:05,701] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:05,701] WIN10-804191526/INFO/stdout: 注册的用户账号: test0029, 密码: pwd0029
    [2020-06-27 11:02:05,701] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:05,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0030', 'password': 'pwd0030', 'email': 'test0030@testregister.test', 'phone': '18600000030'}
    [2020-06-27 11:02:05,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:05,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0030, 密码: pwd0030
    [2020-06-27 11:02:05,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:06,704] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0031', 'password': 'pwd0031', 'email': 'test0031@testregister.test', 'phone': '18600000031'}
    [2020-06-27 11:02:06,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:06,704] WIN10-804191526/INFO/stdout: 注册的用户账号: test0031, 密码: pwd0031
    [2020-06-27 11:02:06,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:06,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0032', 'password': 'pwd0032', 'email': 'test0032@testregister.test', 'phone': '18600000032'}
    [2020-06-27 11:02:06,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:06,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0032, 密码: pwd0032
    [2020-06-27 11:02:06,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:07,703] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0033', 'password': 'pwd0033', 'email': 'test0033@testregister.test', 'phone': '18600000033'}
    [2020-06-27 11:02:07,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:07,703] WIN10-804191526/INFO/stdout: 注册的用户账号: test0033, 密码: pwd0033
    [2020-06-27 11:02:07,703] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:07,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0034', 'password': 'pwd0034', 'email': 'test0034@testregister.test', 'phone': '18600000034'}
    [2020-06-27 11:02:07,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:07,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0034, 密码: pwd0034
    [2020-06-27 11:02:07,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:08,705] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0035', 'password': 'pwd0035', 'email': 'test0035@testregister.test', 'phone': '18600000035'}
    [2020-06-27 11:02:08,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:08,706] WIN10-804191526/INFO/stdout: 注册的用户账号: test0035, 密码: pwd0035
    [2020-06-27 11:02:08,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:08,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0036', 'password': 'pwd0036', 'email': 'test0036@testregister.test', 'phone': '18600000036'}
    [2020-06-27 11:02:08,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:08,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0036, 密码: pwd0036
    [2020-06-27 11:02:08,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:09,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0037', 'password': 'pwd0037', 'email': 'test0037@testregister.test', 'phone': '18600000037'}
    [2020-06-27 11:02:09,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:09,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0037, 密码: pwd0037
    [2020-06-27 11:02:09,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:09,711] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0038', 'password': 'pwd0038', 'email': 'test0038@testregister.test', 'phone': '18600000038'}
    [2020-06-27 11:02:09,711] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:09,711] WIN10-804191526/INFO/stdout: 注册的用户账号: test0038, 密码: pwd0038
    [2020-06-27 11:02:09,711] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:10,704] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0039', 'password': 'pwd0039', 'email': 'test0039@testregister.test', 'phone': '18600000039'}
    [2020-06-27 11:02:10,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:10,704] WIN10-804191526/INFO/stdout: 注册的用户账号: test0039, 密码: pwd0039
    [2020-06-27 11:02:10,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:10,711] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0040', 'password': 'pwd0040', 'email': 'test0040@testregister.test', 'phone': '18600000040'}
    [2020-06-27 11:02:10,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:10,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0040, 密码: pwd0040
    [2020-06-27 11:02:10,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:11,706] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0041', 'password': 'pwd0041', 'email': 'test0041@testregister.test', 'phone': '18600000041'}
    [2020-06-27 11:02:11,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:11,706] WIN10-804191526/INFO/stdout: 注册的用户账号: test0041, 密码: pwd0041
    [2020-06-27 11:02:11,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:11,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0042', 'password': 'pwd0042', 'email': 'test0042@testregister.test', 'phone': '18600000042'}
    [2020-06-27 11:02:11,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:11,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0042, 密码: pwd0042
    [2020-06-27 11:02:11,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:12,706] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0043', 'password': 'pwd0043', 'email': 'test0043@testregister.test', 'phone': '18600000043'}
    [2020-06-27 11:02:12,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:12,706] WIN10-804191526/INFO/stdout: 注册的用户账号: test0043, 密码: pwd0043
    [2020-06-27 11:02:12,706] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:12,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0044', 'password': 'pwd0044', 'email': 'test0044@testregister.test', 'phone': '18600000044'}
    [2020-06-27 11:02:12,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:12,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0044, 密码: pwd0044
    [2020-06-27 11:02:12,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:13,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0045', 'password': 'pwd0045', 'email': 'test0045@testregister.test', 'phone': '18600000045'}
    [2020-06-27 11:02:13,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:13,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0045, 密码: pwd0045
    [2020-06-27 11:02:13,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:13,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0046', 'password': 'pwd0046', 'email': 'test0046@testregister.test', 'phone': '18600000046'}
    [2020-06-27 11:02:13,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:13,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0046, 密码: pwd0046
    [2020-06-27 11:02:13,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:14,707] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0047', 'password': 'pwd0047', 'email': 'test0047@testregister.test', 'phone': '18600000047'}
    [2020-06-27 11:02:14,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:14,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0047, 密码: pwd0047
    [2020-06-27 11:02:14,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:14,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0048', 'password': 'pwd0048', 'email': 'test0048@testregister.test', 'phone': '18600000048'}
    [2020-06-27 11:02:14,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:14,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0048, 密码: pwd0048
    [2020-06-27 11:02:14,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:15,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0049', 'password': 'pwd0049', 'email': 'test0049@testregister.test', 'phone': '18600000049'}
    [2020-06-27 11:02:15,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:15,710] WIN10-804191526/INFO/stdout: 注册的用户账号: test0049, 密码: pwd0049
    [2020-06-27 11:02:15,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:15,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0050', 'password': 'pwd0050', 'email': 'test0050@testregister.test', 'phone': '18600000050'}
    [2020-06-27 11:02:15,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:15,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0050, 密码: pwd0050
    [2020-06-27 11:02:15,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:16,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0051', 'password': 'pwd0051', 'email': 'test0051@testregister.test', 'phone': '18600000051'}
    [2020-06-27 11:02:16,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:16,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0051, 密码: pwd0051
    [2020-06-27 11:02:16,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:16,714] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0052', 'password': 'pwd0052', 'email': 'test0052@testregister.test', 'phone': '18600000052'}
    [2020-06-27 11:02:16,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:16,714] WIN10-804191526/INFO/stdout: 注册的用户账号: test0052, 密码: pwd0052
    [2020-06-27 11:02:16,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:17,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0053', 'password': 'pwd0053', 'email': 'test0053@testregister.test', 'phone': '18600000053'}
    [2020-06-27 11:02:17,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:17,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0053, 密码: pwd0053
    [2020-06-27 11:02:17,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:17,714] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0054', 'password': 'pwd0054', 'email': 'test0054@testregister.test', 'phone': '18600000054'}
    [2020-06-27 11:02:17,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:17,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0054, 密码: pwd0054
    [2020-06-27 11:02:17,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:18,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0055', 'password': 'pwd0055', 'email': 'test0055@testregister.test', 'phone': '18600000055'}
    [2020-06-27 11:02:18,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:18,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0055, 密码: pwd0055
    [2020-06-27 11:02:18,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:18,714] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0056', 'password': 'pwd0056', 'email': 'test0056@testregister.test', 'phone': '18600000056'}
    [2020-06-27 11:02:18,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:18,714] WIN10-804191526/INFO/stdout: 注册的用户账号: test0056, 密码: pwd0056
    [2020-06-27 11:02:18,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:19,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0057', 'password': 'pwd0057', 'email': 'test0057@testregister.test', 'phone': '18600000057'}
    [2020-06-27 11:02:19,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:19,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0057, 密码: pwd0057
    [2020-06-27 11:02:19,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:19,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0058', 'password': 'pwd0058', 'email': 'test0058@testregister.test', 'phone': '18600000058'}
    [2020-06-27 11:02:19,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:19,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0058, 密码: pwd0058
    [2020-06-27 11:02:19,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:20,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0059', 'password': 'pwd0059', 'email': 'test0059@testregister.test', 'phone': '18600000059'}
    [2020-06-27 11:02:20,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:20,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0059, 密码: pwd0059
    [2020-06-27 11:02:20,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:20,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0060', 'password': 'pwd0060', 'email': 'test0060@testregister.test', 'phone': '18600000060'}
    [2020-06-27 11:02:20,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:20,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0060, 密码: pwd0060
    [2020-06-27 11:02:20,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:21,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0061', 'password': 'pwd0061', 'email': 'test0061@testregister.test', 'phone': '18600000061'}
    [2020-06-27 11:02:21,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:21,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0061, 密码: pwd0061
    [2020-06-27 11:02:21,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:21,714] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0062', 'password': 'pwd0062', 'email': 'test0062@testregister.test', 'phone': '18600000062'}
    [2020-06-27 11:02:21,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:21,714] WIN10-804191526/INFO/stdout: 注册的用户账号: test0062, 密码: pwd0062
    [2020-06-27 11:02:21,714] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:22,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0063', 'password': 'pwd0063', 'email': 'test0063@testregister.test', 'phone': '18600000063'}
    [2020-06-27 11:02:22,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:22,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0063, 密码: pwd0063
    [2020-06-27 11:02:22,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:22,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0064', 'password': 'pwd0064', 'email': 'test0064@testregister.test', 'phone': '18600000064'}
    [2020-06-27 11:02:22,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:22,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0064, 密码: pwd0064
    [2020-06-27 11:02:22,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:23,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0065', 'password': 'pwd0065', 'email': 'test0065@testregister.test', 'phone': '18600000065'}
    [2020-06-27 11:02:23,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:23,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0065, 密码: pwd0065
    [2020-06-27 11:02:23,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:23,719] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0066', 'password': 'pwd0066', 'email': 'test0066@testregister.test', 'phone': '18600000066'}
    [2020-06-27 11:02:23,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:23,719] WIN10-804191526/INFO/stdout: 注册的用户账号: test0066, 密码: pwd0066
    [2020-06-27 11:02:23,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,705] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0067', 'password': 'pwd0067', 'email': 'test0067@testregister.test', 'phone': '18600000067'}
    [2020-06-27 11:02:24,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,705] WIN10-804191526/INFO/stdout: 注册的用户账号: test0067, 密码: pwd0067
    [2020-06-27 11:02:24,705] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0068', 'password': 'pwd0068', 'email': 'test0068@testregister.test', 'phone': '18600000068'}
    [2020-06-27 11:02:24,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0068, 密码: pwd0068
    [2020-06-27 11:02:24,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0069', 'password': 'pwd0069', 'email': 'test0069@testregister.test', 'phone': '18600000069'}
    [2020-06-27 11:02:24,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:24,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0069, 密码: pwd0069
    [2020-06-27 11:02:24,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0070', 'password': 'pwd0070', 'email': 'test0070@testregister.test', 'phone': '18600000070'}
    [2020-06-27 11:02:25,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,709] WIN10-804191526/INFO/stdout: 注册的用户账号: test0070, 密码: pwd0070
    [2020-06-27 11:02:25,709] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0071', 'password': 'pwd0071', 'email': 'test0071@testregister.test', 'phone': '18600000071'}
    [2020-06-27 11:02:25,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,716] WIN10-804191526/INFO/stdout: 注册的用户账号: test0071, 密码: pwd0071
    [2020-06-27 11:02:25,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,717] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0072', 'password': 'pwd0072', 'email': 'test0072@testregister.test', 'phone': '18600000072'}
    [2020-06-27 11:02:25,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:25,717] WIN10-804191526/INFO/stdout: 注册的用户账号: test0072, 密码: pwd0072
    [2020-06-27 11:02:25,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,704] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0073', 'password': 'pwd0073', 'email': 'test0073@testregister.test', 'phone': '18600000073'}
    [2020-06-27 11:02:26,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,704] WIN10-804191526/INFO/stdout: 注册的用户账号: test0073, 密码: pwd0073
    [2020-06-27 11:02:26,704] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0074', 'password': 'pwd0074', 'email': 'test0074@testregister.test', 'phone': '18600000074'}
    [2020-06-27 11:02:26,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0074, 密码: pwd0074
    [2020-06-27 11:02:26,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,716] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0075', 'password': 'pwd0075', 'email': 'test0075@testregister.test', 'phone': '18600000075'}
    [2020-06-27 11:02:26,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:26,716] WIN10-804191526/INFO/stdout: 注册的用户账号: test0075, 密码: pwd0075
    [2020-06-27 11:02:26,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,707] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0076', 'password': 'pwd0076', 'email': 'test0076@testregister.test', 'phone': '18600000076'}
    [2020-06-27 11:02:27,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,707] WIN10-804191526/INFO/stdout: 注册的用户账号: test0076, 密码: pwd0076
    [2020-06-27 11:02:27,707] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0077', 'password': 'pwd0077', 'email': 'test0077@testregister.test', 'phone': '18600000077'}
    [2020-06-27 11:02:27,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0077, 密码: pwd0077
    [2020-06-27 11:02:27,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,716] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0078', 'password': 'pwd0078', 'email': 'test0078@testregister.test', 'phone': '18600000078'}
    [2020-06-27 11:02:27,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:27,716] WIN10-804191526/INFO/stdout: 注册的用户账号: test0078, 密码: pwd0078
    [2020-06-27 11:02:27,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,709] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0079', 'password': 'pwd0079', 'email': 'test0079@testregister.test', 'phone': '18600000079'}
    [2020-06-27 11:02:28,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,710] WIN10-804191526/INFO/stdout: 注册的用户账号: test0079, 密码: pwd0079
    [2020-06-27 11:02:28,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0080', 'password': 'pwd0080', 'email': 'test0080@testregister.test', 'phone': '18600000080'}
    [2020-06-27 11:02:28,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,715] WIN10-804191526/INFO/stdout: 注册的用户账号: test0080, 密码: pwd0080
    [2020-06-27 11:02:28,715] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,716] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0081', 'password': 'pwd0081', 'email': 'test0081@testregister.test', 'phone': '18600000081'}
    [2020-06-27 11:02:28,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:28,717] WIN10-804191526/INFO/stdout: 注册的用户账号: test0081, 密码: pwd0081
    [2020-06-27 11:02:28,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,708] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0082', 'password': 'pwd0082', 'email': 'test0082@testregister.test', 'phone': '18600000082'}
    [2020-06-27 11:02:29,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,708] WIN10-804191526/INFO/stdout: 注册的用户账号: test0082, 密码: pwd0082
    [2020-06-27 11:02:29,708] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0083', 'password': 'pwd0083', 'email': 'test0083@testregister.test', 'phone': '18600000083'}
    [2020-06-27 11:02:29,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0083, 密码: pwd0083
    [2020-06-27 11:02:29,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,717] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0084', 'password': 'pwd0084', 'email': 'test0084@testregister.test', 'phone': '18600000084'}
    [2020-06-27 11:02:29,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:29,718] WIN10-804191526/INFO/stdout: 注册的用户账号: test0084, 密码: pwd0084
    [2020-06-27 11:02:29,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,713] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0085', 'password': 'pwd0085', 'email': 'test0085@testregister.test', 'phone': '18600000085'}
    [2020-06-27 11:02:30,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,713] WIN10-804191526/INFO/stdout: 注册的用户账号: test0085, 密码: pwd0085
    [2020-06-27 11:02:30,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,715] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0086', 'password': 'pwd0086', 'email': 'test0086@testregister.test', 'phone': '18600000086'}
    [2020-06-27 11:02:30,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,716] WIN10-804191526/INFO/stdout: 注册的用户账号: test0086, 密码: pwd0086
    [2020-06-27 11:02:30,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,718] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0087', 'password': 'pwd0087', 'email': 'test0087@testregister.test', 'phone': '18600000087'}
    [2020-06-27 11:02:30,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:30,719] WIN10-804191526/INFO/stdout: 注册的用户账号: test0087, 密码: pwd0087
    [2020-06-27 11:02:30,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,717] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0088', 'password': 'pwd0088', 'email': 'test0088@testregister.test', 'phone': '18600000088'}
    [2020-06-27 11:02:31,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,717] WIN10-804191526/INFO/stdout: 注册的用户账号: test0088, 密码: pwd0088
    [2020-06-27 11:02:31,717] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,719] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0089', 'password': 'pwd0089', 'email': 'test0089@testregister.test', 'phone': '18600000089'}
    [2020-06-27 11:02:31,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,719] WIN10-804191526/INFO/stdout: 注册的用户账号: test0089, 密码: pwd0089
    [2020-06-27 11:02:31,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,721] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0090', 'password': 'pwd0090', 'email': 'test0090@testregister.test', 'phone': '18600000090'}
    [2020-06-27 11:02:31,721] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:31,721] WIN10-804191526/INFO/stdout: 注册的用户账号: test0090, 密码: pwd0090
    [2020-06-27 11:02:31,721] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,710] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0091', 'password': 'pwd0091', 'email': 'test0091@testregister.test', 'phone': '18600000091'}
    [2020-06-27 11:02:32,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,710] WIN10-804191526/INFO/stdout: 注册的用户账号: test0091, 密码: pwd0091
    [2020-06-27 11:02:32,711] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,716] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0092', 'password': 'pwd0092', 'email': 'test0092@testregister.test', 'phone': '18600000092'}
    [2020-06-27 11:02:32,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,716] WIN10-804191526/INFO/stdout: 注册的用户账号: test0092, 密码: pwd0092
    [2020-06-27 11:02:32,716] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,719] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0093', 'password': 'pwd0093', 'email': 'test0093@testregister.test', 'phone': '18600000093'}
    [2020-06-27 11:02:32,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:32,719] WIN10-804191526/INFO/stdout: 注册的用户账号: test0093, 密码: pwd0093
    [2020-06-27 11:02:32,720] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,710] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0094', 'password': 'pwd0094', 'email': 'test0094@testregister.test', 'phone': '18600000094'}
    [2020-06-27 11:02:33,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,710] WIN10-804191526/INFO/stdout: 注册的用户账号: test0094, 密码: pwd0094
    [2020-06-27 11:02:33,710] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,718] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0095', 'password': 'pwd0095', 'email': 'test0095@testregister.test', 'phone': '18600000095'}
    [2020-06-27 11:02:33,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,719] WIN10-804191526/INFO/stdout: 注册的用户账号: test0095, 密码: pwd0095
    [2020-06-27 11:02:33,719] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,720] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0096', 'password': 'pwd0096', 'email': 'test0096@testregister.test', 'phone': '18600000096'}
    [2020-06-27 11:02:33,720] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:33,720] WIN10-804191526/INFO/stdout: 注册的用户账号: test0096, 密码: pwd0096
    [2020-06-27 11:02:33,720] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,712] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0097', 'password': 'pwd0097', 'email': 'test0097@testregister.test', 'phone': '18600000097'}
    [2020-06-27 11:02:34,712] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,712] WIN10-804191526/INFO/stdout: 注册的用户账号: test0097, 密码: pwd0097
    [2020-06-27 11:02:34,713] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,718] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0098', 'password': 'pwd0098', 'email': 'test0098@testregister.test', 'phone': '18600000098'}
    [2020-06-27 11:02:34,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,718] WIN10-804191526/INFO/stdout: 注册的用户账号: test0098, 密码: pwd0098
    [2020-06-27 11:02:34,718] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,720] WIN10-804191526/INFO/stdout: 测试数据:{'username': 'test0099', 'password': 'pwd0099', 'email': 'test0099@testregister.test', 'phone': '18600000099'}
    [2020-06-27 11:02:34,720] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:34,720] WIN10-804191526/INFO/stdout: 注册的用户账号: test0099, 密码: pwd0099
    [2020-06-27 11:02:34,720] WIN10-804191526/INFO/stdout: 
    [2020-06-27 11:02:35,715] WIN10-804191526/INFO/stdout: 测试数据已用完,结束!
    [2020-06-27 11:02:35,715] WIN10-804191526/INFO/stdout: 
    
    Process finished with exit code 0
    

      界面:

      修改脚本:

      

      使用get()方法从队列取数,得到的结果:

      批量注册账号2(测试数据唯一性,循环取数)

       场景:模拟多个用户并发注册,比如100个虚拟用户共享同一份测试数据,保证虚拟用户使用的数据不重复(唯一),并且数据取完,可以重复使用。

      

       该种场景的实现方式与上一种场景基本相同,唯一的差异在于,每次使用完数据后,需要再将数据放入队列中。

    __author__ = 'Leo'
    
    from locust import HttpLocust,task,TaskSet,between
    import queue
    
    class UserRegister(TaskSet):
    
        @task
        def test_register(self):
            # get_nowait() 取不到数据直接崩溃,直接跳到except; get() 取不到数据会一直等待
            try:
                # 从队列中取出数据
                data = eval(self.locust.user_data_queue.get())
                print("测试数据:%s"%data)
            # 使用get_nowait()方法,取不到数据,就进入这里
            except queue.Empty:
                print("测试数据已用完,结束!")
                exit(0)
            print('注册的用户账号: {}, 密码: {}' 
                  .format(data['username'], data['password']))
            payload = {
                'username': data['username'],
                'password': data['password']
    
            }
            self.client.post('/register',data=payload)
            self.locust.user_data_queue.put_nowait(str(data))
    
    
    class WebSiteUser(HttpLocust):
        host = 'https://www.baidu.com'
        task_set = UserRegister
        # 创建队列,先进先出
        user_data_queue = queue.Queue()
        # 循环加入队列
        for index in range(100):
            data = '''{
                "username": "test%04d",
                "password": "pwd%04d",
                "email": "test%04d@testregister.test",
                "phone": "186%08d"
            }''' % (index, index, index, index)
            # 将data存入队列中
            user_data_queue.put_nowait(data.replace(' ', '').replace('
    ', ''))
            # print(user_data_queue.get())
    
        wait_time = between(1,3)
    if __name__ == '__main__':
        import os
        os.system('locust -f locust_register.py')
    

      结果:

       因为循环取数,所以脚本不会停下来,为了演示,截图看看界面,此界面没有跑完:

      这种模式就是测试数据循环使用,但并不同时使用。

      批量注册账号3(测试数据重复使用,循环取数)

      所有并发虚拟用户共享同一份测试数据,各虚拟用户在数据列表中循环取值。

      例如,模拟3用户并发请求网页,总共有100个URL地址,每个虚拟用户都会依次循环加载这100个URL地址;加载示例如下表所示。

       

       下面我设置的场景是,2个用户并发请求5个URL,每个虚拟用户都会依次请求这5个URL,demo如下:

    __author__ = 'Leo'
    from locust import TaskSet, task, HttpLocust,between
    
    class UserBehavior(TaskSet):
        def on_start(self):
            self.index = 0
    
    
        @task
        def test_visit(self):
            url = self.locust.share_data[self.index]
            print('visit url: %s' % url)
            self.index = (self.index + 1) % len(self.locust.share_data)  # 一个数除以另一个数,要是比另一个数小,商数就是0,余数就是它自己。
            self.client.get('/register')
    
    class WebsiteUser(HttpLocust):
        host = 'https://www.baidu.com'
        task_set = UserBehavior
        share_data = ['url1', 'url2', 'url3', 'url4', 'url5']
        wait_time = between(1,3)
        
    if __name__ == '__main__':
        import os
        os.system('locust -f locust_batch_data.py')
    

      结果:

    [2020-06-27 17:50:10,104] WIN10-804191526/INFO/locust.main: Starting web monitor at http://*:8089
    [2020-06-27 17:50:10,104] WIN10-804191526/INFO/locust.main: Starting Locust 0.14.6
    [2020-06-27 17:50:13,768] WIN10-804191526/INFO/locust.runners: Hatching and swarming 2 users at the rate 1 users/s (0 users already running)...
    [2020-06-27 17:50:13,768] WIN10-804191526/INFO/stdout: visit url: url1
    [2020-06-27 17:50:13,768] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:14,769] WIN10-804191526/INFO/locust.runners: All locusts hatched: WebsiteUser: 2 (0 already running)
    [2020-06-27 17:50:14,769] WIN10-804191526/INFO/stdout: visit url: url1
    [2020-06-27 17:50:14,769] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:16,161] WIN10-804191526/INFO/stdout: visit url: url2
    [2020-06-27 17:50:16,161] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:16,749] WIN10-804191526/INFO/stdout: visit url: url2
    [2020-06-27 17:50:16,749] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:17,547] WIN10-804191526/INFO/stdout: visit url: url3
    [2020-06-27 17:50:17,547] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:18,619] WIN10-804191526/INFO/stdout: visit url: url3
    [2020-06-27 17:50:18,619] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:19,187] WIN10-804191526/INFO/stdout: visit url: url4
    [2020-06-27 17:50:19,187] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:20,854] WIN10-804191526/INFO/stdout: visit url: url5
    [2020-06-27 17:50:20,854] WIN10-804191526/INFO/stdout: 
    [2020-06-27 17:50:21,425] WIN10-804191526/INFO/stdout: visit url: url4

      总结

      自此,Locust参数化介绍完,有兴趣的可以深入学习一下。如果有对测试、测试开发、性能测试等领域感兴趣的,有独到见解的可以加入QQ群,一起学习和进步。

  • 相关阅读:
    王道考研复习-操作系统-进程管理(二)
    王道考研复习-操作系统-计算机系统概述(一)
    Understanding Undefined Behavior
    iOS开发需要掌握的命令
    LLDB命令速查
    Flutter简介
    poj 2115 C Looooops 扩展欧几里得算法
    poj 2635 The Embarrassed Cryptographer ??/Java??(???)
    poj 3292 Semi-prime H-numbers 筛素数(简单题)
    poj 1019 Number Sequence 数学
  • 原文地址:https://www.cnblogs.com/liudinglong/p/13197017.html
Copyright © 2020-2023  润新知