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

查看:52
本文介绍了使用 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 数据集配置时强制线程使用相同的输入行

Jmeter 函数:

来自 CSV 的变量 采样器来自 jmeter-plugins.

<小时>

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 > test-url 列表中的条目数,则用户将在 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天全站免登陆