当前位置:网站首页>The company has only one test, but the leader asked me to operate 1000 mobile numbers at the same time

The company has only one test, but the leader asked me to operate 1000 mobile numbers at the same time

2022-06-23 14:10:00 Software testing

 Insert picture description here
A lot now APP Or websites need to log in with a mobile number , When logging in with your mobile number , It is necessary to “ cell-phone number + SMS verification code ” Before you can log in successfully .

During the actual test , Testers usually have only one mobile phone number , Then you need to test multiple mobile phone numbers to get the information you need to log in through the SMS interface service “ SMS verification code ”, So how to solve the problem of multiple mobile phone numbers ?

  • Collect the personal mobile phone numbers of other colleagues in the company
  • Use Jmeter Provide random function , Generate the middle four digits of the mobile phone number

This paper focuses on the interface function of obtaining SMS verification code , Therefore, there is no need to check the format of each number segment of the mobile phone number , So choose the second one above “ use Jmeter The random number + Fixed number ” that will do . If you need a more realistic simulation ( For example, check whether the mobile phone number is legal, etc ), Other methods can be used to generate 11 Cell phone number , For example, generate legal mobile phone numbers through regular expressions .

01 Interface Analysis

Before starting an interface test or interface stress test task , You need to obtain the following relevant information from the interface documents provided by the development :

domain name (IP)

Address (path)

Request mode (post/get)

Enter the reference : Mobile phone number and other information

This article focuses on “ How to use Jmeter The random number generated by the random function of ” Combine into different mobile phone numbers , In order to pass “ Get SMS verification code ” The interface obtains the verification code required for login .

02 utilize Jmeter Generate four bit random number

utilize Jmeter The random function of _Random, Four digit random numbers can be generated :

  1. choice Jmeter Self contained random function

  2. Define the minimum value of a four digit random number

  3. Define the maximum value of a four digit random number

  4. Finally, the random function expression is generated :${__Random(0000,9999,)}

 picture

03 Splice phone numbers

Use random functions and fixed numbers to form a mobile phone number , The domestic mobile phone number is 11 position :

Top three :152( This article is an example of the fixed number segment of mobile phone number )

The middle four : Use random function expressions “${__Random(0000,9999,)}”

The last four :5208( This article is an example of a mobile phone number with a fixed tail number )

Joining together the results :152XXXX5208, In the middle of it “XXXX” Represents a four digit random number .

Sum up , The mobile phone number of the SMS interface "mobile":

"152${__Random(0000,9999,)}5208"

04 Simulate SMS interface request

Menu path :

stay Thread Group Right click —sample-HTTP Request

JMeter add to HTTP Request Configure the domain name requested by the interface 、 route 、 Request mode 、 Enter the level , Here's the picture :

 picture

05 Add listening tree

Menu path :

stay Thread Group Right click - lisener - View Results Tree

 picture

The listening tree report configuration remains the default configuration ( All request logs are displayed by default ) that will do , If you need to simulate 1000 Or more , You can choose to display only the error log :

 picture

06 Set the number of script runs

If you need to simulate 1000 Concurrent users , It can be set as follows :

Number of threads(users):1000

Ramp-up period(in seconds):0

Loop Count:1

The above configuration indicates 1000 Multiple users initiate to obtain the verification code at the same time , And each user executes .

 picture

If interval is required 1s In order to 1000 Users send SMS verification code , You need to set... On the thread group Loop Count=1000

 picture

07 Running results

Because... Is set on the thread group Loop Count=1000, So the script runs 1000 Time , Each time, the random function will generate a random four digit number and a fixed number, which will be spliced into different mobile phone numbers .

The running result of the script is shown in the figure below :

Click each request to see that the participating mobile phone numbers are different

 picture

Mobile number login process :

Use your mobile number to get the verification code

Use cell phone number + Login with verification code

This paper implements the first stage of the login process ~, If you need to log in at the same time , The login interface request can be added after obtaining the verification code .

Tips:

During the test , The test environment generally needs to add SMS white list before users can really receive SMS verification code , So don't worry that the verification code will actually be sent to the mobile phone of the head of the mobile phone number , And there will be no SMS deduction .

Friends who like software testing , If my blog helps you 、 If you like my blog content , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One button, three links !


Good article recommends

Why is the test post a giant pit ?10 The tester told you not to be fooled

Interview must ask Linux The order will help you tidy up …

The man who leaves work on time , Promoted before me …

Bubble share price 、 Delivery boy is going to lose his job ? Whether the tester will join the meituan ? One article will show you the truth behind it

In outsourcing ! There was a trough 5 Years of time makes my annual salary close to 100W… I don't give up , Let me see the most beautiful tomorrow …

Two ordinary books , I've been to Alibaba , Up to now, annual salary 40W+ Senior Test Engineer , My two-year career change experience …
 Insert picture description here

原网站

版权声明
本文为[Software testing]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211726396965.html