A method and system for quickly generating message center jmeter interface test scripts

By impersonating the user to log in to the backend system to obtain message templates and account information, generating request messages and replacing JMX file content, it solves the problem of time-consuming and labor-intensive manual refining of message fields in the existing technology, and improves the generation efficiency and user experience of jmeter interface test scripts.

CN114138655BActive Publication Date: 2025-05-23SHANGHAI ZHONGTONGJI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111475771.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2025-05-23
Estimated Expiration
2041-12-06

AI Technical Summary

Technical Problem

In the prior art, due to the time-consuming and labor-intensive refining of the message center jmeter interface test script, the writing efficiency of the message center jmeter interface is low.

Method used

By simulating the user's single sign-in backend system, the background system interface is called to find the account that accesses the message scenario, obtain the message template, account password and account key, generate the request message key, and extract the message fields or content from the message template or historical sending record according to the message type, generate the request message, replace the content in the JMX file, and generate a new JMX file.

Benefits of technology

It improves the generation efficiency of the message center jmeter interface test script, reduces the complexity and time-consuming of user operations, and improves user experience and satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114138655B_ABST
    Figure CN114138655B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for quickly generating a jmeter interface test script for a message center. The method comprises the following steps: determining a request message type to be generated, simulating a user single-point login to a background system, calling a background system interface to search for an account for accessing a message scene, obtaining a message template, a message sending account password, and a message sending account key according to the account, generating a request message key according to the message sending account password and the message sending account key, extracting a message field from a message template or extracting a message content from a historical sending record according to the request message type to be generated, generating a request message by combining the message field with the request message key, or generating a request message by combining the message content with the request message key, determining content to be replaced in a JMX file, replacing the content to be replaced in the JMX file with the generated request message, and saving the file as a new JMX file as a jmeter interface test script.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated testing technology, and in particular to a method and system for rapidly generating a message center jmeter interface test script. Background Art

[0002] At present, the jmeter interface test script of the message center is mainly generated manually. The corresponding message template, the account code and the account key of the message are found according to the message scenario number in the message center background, and the fields in the message are extracted from the message template. On the test tool platform, the key in the message is generated by the account code and the account key of the message. A request template is added in the jmeter tool, and the relevant content of the interface request is filled in and saved to generate a jmx file.

[0003] The existing technology of manually generating jmeter interface test scripts for message centers has the following disadvantages: 1. The message template is a long string, and part of the content in the string is the fields required in the message. Therefore, it is time-consuming and easy to miss to extract the required fields from a long string; 2. Some message scenarios correspond to multiple templates, and the complexity of manually extracting the required fields in the message is higher; 3. The key in the message needs to first find the account connected to the scenario through the message scenario, and then find the account Code and Key of the message through the account, and finally open another test tool platform to enter the information on the platform. The above needs to be operated in multiple pages of two systems, which increases the user's effort; 4. It is necessary to fill in the interface request related content in the jmeter tool and save the generated jmx file. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method and system for quickly generating a message center jmeter interface test script, so as to solve the problem of low script writing efficiency caused by time-consuming and labor-intensive manual extraction of message fields in the prior art.

[0005] According to a first aspect of an embodiment of the present invention, a method for quickly generating a message center jmeter interface test script is provided, comprising:

[0006] Determine the type of request message to be generated;

[0007] Simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scenario, and obtain the message template, the account password for sending messages, and the account key for sending messages based on the account;

[0008] Generate a request message key based on the account password and the account key of the message sending;

[0009] According to the type of request message to be generated, extract message fields from the message template or extract message content from historical sending records;

[0010] Generate a request message by combining the message field with a request message key, or generate a request message by combining the message content with a request message key;

[0011] Determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

[0012] Preferably, the determining of the type of request message to be generated is specifically:

[0013] Determine the type of request message to be generated based on the parameter value passed by the user to the backend system interface;

[0014] If the parameter value is 1, it is determined that the type of request message to be generated is to generate a new request message;

[0015] If the parameter value is 2, it is determined that the type of the request message to be generated is a request message for which a successful sending record has been already provided in the system.

[0016] Preferably, the request message key is generated according to the account password and the account key of the message sending, specifically:

[0017] Generate the request message key using a regular expression based on the account password and key of the account sending the message.

[0018] Preferably, extracting message fields from the message template or extracting message content from historical sending records according to the type of request message to be generated includes:

[0019] If the type of the request message to be generated is to generate a new request message, extract the message field from the message template;

[0020] If the type of the request message to be generated is a request message for which a successful sending record already exists in the system, the message content is extracted from the historical sending record.

[0021] Preferably, the extracting of the message field from the message template is specifically:

[0022] The string in the message template is passed into the preset processing model to extract the message fields.

[0023] Preferably, extracting the message content from the historical sending record is specifically:

[0024] Call the query sending record interface to retrieve the sending records within the specified time period, find a successfully sent record through traversal, and extract the message content.

[0025] Preferably, the determining of the content to be replaced in the JMX file is specifically:

[0026] Use regular expressions to find the content that needs to be replaced in the JMX file.

[0027] According to a second aspect of an embodiment of the present invention, a system for quickly generating a message center jmeter interface test script is provided, comprising:

[0028] A determination module, used to determine the type of request message to be generated;

[0029] The calling module is used to simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scene, and obtain the message template, the account password for sending the message, and the account key for sending the message according to the account;

[0030] A generation module, used to generate a request message key according to the account password and the account key of the message sending;

[0031] It is also used to extract message fields from the message template or extract message content from historical sending records according to the type of request message to be generated;

[0032] It is also used to generate a request message by combining the message field with a request message key, or to generate a request message by combining the message content with a request message key;

[0033] It is also used to determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

[0034] The technical solution provided by the embodiments of the present invention may have the following beneficial effects:

[0035] By determining the type of request message to be generated, simulating the user's single-point login to the background system, calling the background system interface to find the account for accessing the message scenario, and obtaining the message template, the account password for sending the message, and the account key for sending the message according to the account, generating the request message key according to the account password for sending the message and the account key for sending the message, extracting the message field from the message template or extracting the message content from the historical sending record according to the type of request message to be generated, generating the request message by combining the message field with the request message key, or generating the request message by combining the message content with the request message key, determining the content to be replaced in the JMX file, replacing the content to be replaced in the JMX file with the generated request message, and saving it as a new JMX file as a jmeter interface test script, thereby solving the problem of low script writing efficiency caused by time-consuming and labor-intensive manual extraction of message fields in the prior art, improving the user experience, and providing a good user experience and high satisfaction.

[0036] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0038] Figure 1 The present invention is a flowchart showing a method for quickly generating a message center jmeter interface test script according to an exemplary embodiment.

[0039] Figure 2 The present invention is a schematic block diagram of a system for quickly generating a message center jmeter interface test script according to an exemplary embodiment. DETAILED DESCRIPTION

[0040] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0041] Embodiment 1

[0042] Figure 1 is a flowchart of a method for quickly generating a message center jmeter interface test script according to an exemplary embodiment. Figure 1 As shown, the method includes:

[0043] Step S11, determining the type of request message to be generated;

[0044] Step S12: Simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scenario, and obtain the message template, the account password for sending the message, and the account key for sending the message according to the account;

[0045] Step S13: Generate a request message key according to the account password and the account key of the message sending;

[0046] Step S14: extracting message fields from the message template or extracting message content from historical sending records according to the type of request message to be generated;

[0047] Step S15: Generate a request message by combining the message field with a request message key, or generate a request message by combining the message content with a request message key;

[0048] Step S16: determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

[0049] In specific practice, the determination of the type of request message to be generated is specifically:

[0050] Determine the type of request message to be generated based on the parameter value passed by the user to the backend system interface;

[0051] If the parameter value is 1, it is determined that the type of request message to be generated is to generate a new request message;

[0052] If the parameter value is 2, it is determined that the type of the request message to be generated is a request message for which a successful sending record has been already provided in the system.

[0053] In specific practice, the simulated user single-point login backend system calls the backend system interface to find the account for accessing the message scene, and obtains the message template, the account password for sending the message, and the account key for sending the message according to the account, specifically:

[0054] Use Python to simulate the user's single sign-on to the backend system;

[0055] Call the backend system interface through Python to obtain the account for accessing the message scenario.

[0056] In specific practice, the request message key is generated according to the account password and the account key of the message sending, specifically:

[0057] The interface of the test tool platform is called through Python, and the request message key is generated using regular expressions according to the account password and account key of the message sending.

[0058] In specific practice, the extracting of message fields from the message template or extracting message content from historical sending records according to the type of request message to be generated includes:

[0059] If the type of the request message to be generated is to generate a new request message, extract the message field from the message template;

[0060] If the type of the request message to be generated is a request message for which a successful sending record already exists in the system, the message content is extracted from the historical sending record.

[0061] In specific practice, the extraction of message fields from the message template is specifically as follows:

[0062] The string in the message template is passed into the preset processing model to extract the message fields.

[0063] In specific practice, extracting the message content from the historical sending records is specifically as follows:

[0064] Call the query sending record interface to retrieve the sending records within the specified time period, find a successfully sent record through traversal, and extract the message content.

[0065] In specific practice, the content that needs to be replaced in the JMX file is determined as follows:

[0066] Read the prepared jmx file through python, and use regular expressions to find the content that needs to be replaced in the JMX file.

[0067] It can be understood that the technical solution provided in this embodiment, by determining the type of request message to be generated, simulates the user's single-point login to the background system, calls the background system interface to find the account for accessing the message scenario, and obtains the message template, the account password for sending the message, and the account key for sending the message according to the account, generates a request message key according to the account password for sending the message and the account key for sending the message, extracts the message field from the message template or extracts the message content from the historical sending record according to the type of request message to be generated, generates a request message by combining the message field with the request message key, or generates a request message by combining the message content with the request message key, determines the content that needs to be replaced in the JMX file, replaces the content that needs to be replaced in the JMX file with the generated request message, and saves it as a new JMX file as a jmeter interface test script, thereby solving the problem of low script writing efficiency caused by time-consuming and labor-intensive manual extraction of message fields in the prior art, improving user experience, and providing good user experience and high satisfaction.

[0068] Embodiment 2

[0069] Figure 2 is a schematic block diagram of a system 100 for quickly generating a message center jmeter interface test script according to an exemplary embodiment. Figure 2 As shown, the system 100 includes:

[0070] Determination module 101, used to determine the type of request message to be generated;

[0071] The calling module 102 is used to simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scene, and obtain the message template, the account password for sending the message, and the account key for sending the message according to the account;

[0072] A generating module 103, configured to generate a request message key according to the account password and the account key of the sending message;

[0073] It is also used to extract message fields from the message template or extract message content from historical sending records according to the type of request message to be generated;

[0074] It is also used to generate a request message by combining the message field with a request message key, or to generate a request message by combining the message content with a request message key;

[0075] It is also used to determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

[0076] It can be understood that the technical solution provided in this embodiment, by determining the type of request message to be generated, simulates the user's single-point login to the background system, calls the background system interface to find the account for accessing the message scenario, and obtains the message template, the account password for sending the message, and the account key for sending the message according to the account, generates a request message key according to the account password for sending the message and the account key for sending the message, extracts the message field from the message template or extracts the message content from the historical sending record according to the type of request message to be generated, generates a request message by combining the message field with the request message key, or generates a request message by combining the message content with the request message key, determines the content that needs to be replaced in the JMX file, replaces the content that needs to be replaced in the JMX file with the generated request message, and saves it as a new JMX file as a jmeter interface test script, thereby solving the problem of low script writing efficiency caused by time-consuming and labor-intensive manual extraction of message fields in the prior art, improving user experience, and providing good user experience and high satisfaction.

[0077] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.

[0078] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" refers to at least two.

[0079] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0080] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0081] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0082] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0083] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0084] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0085] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A method for quickly generating jmeter interface test scripts for a message center. It is characterized in that include: Determine the type of request message to be generated; Simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scenario, and obtain the message template, the account password for sending messages, and the account key for sending messages based on the account; Generate a request message key based on the account password and the account key of the message sending; According to the type of request message to be generated, extract message fields from the message template or extract message content from historical sending records; Generate a request message by combining the message field with a request message key, or generate a request message by combining the message content with a request message key; Determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

2. The method according to claim 1, It is characterized in that The determination of the request message type to be generated is specifically: Determine the type of request message to be generated based on the parameter value passed by the user to the backend system interface; If the parameter value is 1, it is determined that the type of request message to be generated is to generate a new request message; If the parameter value is 2, it is determined that the type of the request message to be generated is a request message for which a successful sending record has been already provided in the system.

3. The method according to claim 1, It is characterized in that The request message key is generated according to the account password and the account key of the message sending, specifically: Generate the request message key using a regular expression based on the account password and key of the account sending the message.

4. The method according to claim 2, It is characterized in that The step of extracting message fields from the message template or extracting message contents from historical sending records according to the type of the request message to be generated includes: If the type of the request message to be generated is to generate a new request message, extract the message field from the message template; If the type of the request message to be generated is a request message for which a successful sending record already exists in the system, the message content is extracted from the historical sending record.

5. The method according to claim 4, It is characterized in that The extracting of the message field from the message template is specifically: The string in the message template is passed into the preset processing model to extract the message fields.

6. The method according to claim 4, It is characterized in that The message content is extracted from the historical sending records, specifically: Call the query sending record interface to retrieve the sending records within the specified time period, find a successfully sent record through traversal, and extract the message content.

7. The method according to claim 1, It is characterized in that The content that needs to be replaced in the JMX file is determined as follows: Use regular expressions to find the content that needs to be replaced in the JMX file.

8. A system for quickly generating jmeter interface test scripts for a message center. It is characterized in that include: A determination module, used to determine the type of request message to be generated; The calling module is used to simulate the user's single sign-on to the backend system to call the backend system interface to find the account for accessing the message scene, and obtain the message template, the account password for sending the message, and the account key for sending the message according to the account; A generation module, used to generate a request message key according to the account password and the account key of the message sending; It is also used to extract message fields from the message template or extract message content from historical sending records according to the type of request message to be generated; It is also used to generate a request message by combining the message field with a request message key, or to generate a request message by combining the message content with a request message key; It is also used to determine the content that needs to be replaced in the JMX file, replace the content that needs to be replaced in the JMX file with the generated request message, and save it as a new JMX file as a jmeter interface test script.

Citation Information

Patent Citations

  • Automatic interface test method and device, equipment and storage medium

    CN108415832A

  • A test script generation method and system

    CN109885498A