Software testing skills, JMeter stress testing tutorial, login parameterized CSV data file settings (5)

Table of contents

foreword

1. Scenarios

2. Login interface

3. Test data preparation

4. CSV data file settings

Five, view the results


foreword

When we pressure test the login interface, if we only use one account to set up concurrent pressure testing, such a result is obviously unreasonable, and one concurrent user cannot simulate the real situation.

If you want to stress test the login interface, you must prepare hundreds or even thousands of accounts to log in, so that the test results can be referenced

1. Scenarios

I now have a login interface, the basic information of the interface login interface document

Access URL: http://127.0.0.1:8000/api/v1/login/
Request Type: POST
Request Header: Content-Type: application/json
Request Parameters: {"username":"test", "password": "123456"}

I want to pressure test this login interface now, and I need to set the concurrency number of 30, 50, 80, 100, so I need to prepare at least 100 accounts and passwords

2. Login interface

First ensure that an account and password can be successfully requested
to add an HTTP header manager, and add a post request type Content-Type: application/json
to view the results

3. Test data preparation

The single user above can request successfully, and then prepare the test data, and register a batch of account numbers and passwords by yourself, here I take 10 account numbers and passwords as an example

The account number and password are in the following format, separated by commas, and saved as login_user_psw.txt

test1,123456
test2,123456
test3,123456
test4,123456
test5,123456
test6,123456
test7,123456
test8,123456
test9,123456
test10,123456

4. CSV data file settings

Add configuration components, CSV data file settings to
import txt data files, use 2 variables user and psw The middle parameters are separated by commas by default, and
then change the account and password references to variables

CSV data file setting parameter description:
file name: import the absolute path of your txt file

File encoding: generally choose UTF-8

Variable name: The variable you set yourself. If there is only one variable, write only one. When there are multiple variables, separate them with English commas

Ignore the first line: If your first line is the test account, the default is False, if the first line is the title column, set True to ignore

Delimiter: that is, the match of the parameters in your txt file, generally use English commas

Whether to run with quotes: generally do not need to change, the default is Fasle

Loop when encountering the end of the file: it will loop to get values ​​from the txt file. If you want to continue after all the fetches, it will be True. If you want the file to end when the data is used up, for example, the registration cannot be reused, then set False

Thread sharing mode: all threads are fine by default

Five, view the results

For example, if I set the number of threads to 3, one thread number represents one user

Looking at the structure tree, there will be 3 results returned by the request, and they have logged in with different accounts.


              [The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled]


1. From entry to mastery of Python programming

2. Interface automation project actual combat

3. Actual Combat of Web Automation Project


4. Actual Combat of App Automation Project

5. Resume of first-tier manufacturers


6. Test and develop DevOps system

7. Commonly used automated testing tools


Eight, JMeter performance test

9. Summary (little surprise at the end)

life is long so add oil. Every effort will not be let down, as long as you persevere, there will be rewards in the end. Cherish your time and pursue your dreams. Don't forget the original intention, forge ahead. Your future is in your hands!

Life is short, time is precious, we cannot predict what will happen in the future, but we can grasp the present moment. Cherish every day and work hard to make yourself stronger and better. Firm belief, persistent pursuit, success will eventually belong to you!

Only by constantly challenging yourself can you constantly surpass yourself. Persist in pursuing your dreams and move forward bravely, and you will find that the process of struggle is so beautiful and worthwhile. Believe in yourself, you can do it!

Information acquisition method:
This document and video information should be the most comprehensive and complete preparation warehouse for friends who want to engage in [software testing]. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. Hope Can help you too! All of the above can be shared, click the small card below to enter the group to receive.

Guess you like

Origin blog.csdn.net/NHB456789/article/details/131326800