使用CSV文件从中读取测试数据 [英] Using CSV file to read test data from

查看:836
本文介绍了使用CSV文件从中读取测试数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要与100个用户一起测试站点的各种链接(无需登录),并使用JMeter对其进行多次循环.我想将这些链接放在"CSV文件"中,以便从文件中读取所有要测试的链接.

I need to test a various links of a site (no need to login) with 100's of users and loop it for some number of times using JMeter. I want to put those links in a "CSV file", so that all the links to be tested are read from file.

我如何完成此任务?

推荐答案

至少使用以下参数,准备一种带有测试参数列表的csv文件,并将其用于参数化您的测试采样器:

Prepare kind of csv-file with list of your test-params and use it to parametrize your test-samplers, using at least the following:

  1. CSV数据集配置

查看以下链接以获取详细信息:

Look into the following links for details:

如何获取Jmeter以将CSV数据用于GET参数?
使用jmeter测试多个网站
在jmeter httprequest路径中使用csv参数
在使用CSV数据集配置时强制线程使用同一输入行

How to get Jmeter to use CSV data for GET parameters?
Use jmeter to test multiple Websites
use csv parameters in jmeter httprequest path
Force a thread to use same input line when using CSV Data Set Config

Jmeter函数:

  • __CSVRead,
  • __StringFromFile.

CSV变量来自


1..在csv文件中准备测试网址,例如格式如下:


1. Prepare your test-urls in csv-file, e.g. in the following format:

    url1
    url2
    ...
    urlN

确保测试URL不包含http://前缀(按照 HTTP请求参数->服务器).

Ensure that test-URLs don't contain http:// prefix (as per HTTP Request params -> Server).

2..为脚本使用架构,如下所示:

2. Use schema for your script as below:

    CSV Data Set Config:
    Filename: [path to your csv-file with test-urls]
    Variable Names: testURL
    Recycle on EOF?: True
    Stop thread on EOF?: False
    Sharing mode: Current thread

    Thread Group:
    Number of Threads: N
    Loop Count: M
            HTTP Request // your http call
            Server Name or IP: ${testURL} // use variable with extracted URL

这将启动N个用户,每个用户将从test-url列表中读取M个条目.如果M>测试网址列表中的条目数,则用户将在EOF上回收列表.

This will start N users, each users will read M entries from list of test-urls. If M > number of entries in list of test-urls then user will recycle the list on EOF.

这篇关于使用CSV文件从中读取测试数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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