Performance Test: Jmeter pressure measured during the verification code read messages

Background problem

Now most of the domestic software or web applications, prevalent use of text messaging services, such as login, registration and specific business notification.

For these operations, the use Jmeter performance testing process, will automatically obtain and fill in the required SMS verification code, otherwise the performance of the process can not continue.

Since the vast majority of its SMS verification code system and the interface will not return, so how to obtain SMS verification code is a problem.

The simplest approach is to allow developers to code in a test environment to write dead, fixed using static code string in the testing process.

But also for the purpose of 求人不如求己 - as close to the real user scenarios, a more appropriate approach is to dynamically obtain and fill out the SMS verification code through technical means.

 

Solutions

SMS verification code to most applications are sent by third-party service, such as previously stated is generally not returned through a local interface.

But whenever the system should be designed to cross the border SMS verification code will be retained in the database which remain at the end and backup.

So we can go through the database connector Jmeter, and obtain the corresponding codes reasonable logic.

Usually we use Jmeter more of a test HTTP and FTP protocols, but in fact, in addition to these, Jmeter also supports many other kinds of agreements, JDBC is a common one.

Therefore, these requirements should be fully able to implement.

 

Implementation

1. Establish a JDBC connection

In Jmeter test plan, adding configure -JDBC element connection configuration (JDBC Connection Configuration), for managing a database connection.

 

2. Request codes using JDBC

In the thread group, add the sampler -JDBC request, database query.

 

 

 

To take the results:

 

 

3. Use positive verification code will be extracted and used

Above extracted database record, only 969,386 is what we need verification codes, and therefore need to use a regular expression extractor to extract him out:

 

 

 

This, subsequent requests to use $ {mcode} can be used to obtain the codes to continue testing.

Guess you like

Origin www.cnblogs.com/dayu2019/p/11685756.html