Test data generation method, apparatus, test method, and storage medium

CN115495379BActive Publication Date: 2026-08-14SHANGHAI PINWEI INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-17
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]本申请的目的旨在至少能解决上述的技术缺陷之一,特别是现有技术中生成测试数据时效率较低的技术缺陷

Benefits of technology

[0034]基于上述任一实施例,在第一测试平台需要对待测试软件的目标项目进行测试时,从服务器上已经构建过的第二测试平台中选择目标第二测试平台,目标第二测试平台可以生成测试目标项目所需的目标测试数据,通过调用目标第二测试平台的目标测试数据生成模块生成目标测试数据。该方法在需要测试数据时,无需重写生成测试数据的代码,而是通过复用历史代码,提高了代码复用性,减少了测试人员的重复性工作,大大提高了测试效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115495379B_ABST
    Figure CN115495379B_ABST
Patent Text Reader

Abstract

This application provides a test data generation method, apparatus, testing method, storage medium, and computer equipment. The generation method includes: receiving a test data acquisition request from a first testing platform; the first testing platform does not integrate a target test data generation module, which is used to generate target test data for testing a target project; determining a target second testing platform from multiple second testing platforms based on the test data acquisition request; the target second testing platform integrates the target test data generation module; calling the target test data generation module of the target second testing platform to generate target test data; and sending the target test data to the first testing platform. This method eliminates the need to rewrite the code for generating test data when needed, instead reusing historical code, improving code reusability, reducing repetitive work for testers, and significantly improving testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, and in particular to a test data generation method, apparatus, testing method and storage medium, and computer equipment. Background Technology

[0002] Test data is the foundation of software testing, and the ability to quickly construct test data that matches business scenarios is a crucial aspect of improving testing efficiency. In traditional technologies, when developing new software, the module for generating test data needs to be rewritten within the software's testing platform. This results in developers performing a significant amount of repetitive work, leading to decreased testing efficiency. Summary of the Invention

[0003] The purpose of this application is to address at least one of the aforementioned technical deficiencies, particularly the inefficiency in generating test data in the prior art.

[0004] In a first aspect, embodiments of this application provide a test data generation method, applied to a server, the method comprising:

[0005] Receive test data acquisition request from the first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing the target project;

[0006] Based on the test data acquisition request, a target second test platform is determined from multiple second test platforms; the target second test platform integrates a target test data generation module.

[0007] The target test data is generated by calling the target test data generation module of the second target test platform.

[0008] Send the target test data to the first test platform.

[0009] In one embodiment, determining a target second test platform from a plurality of second test platforms based on a test data acquisition request includes:

[0010] Obtain the test items corresponding to the test data generation module of each second test platform;

[0011] Based on the test data acquisition request, determine the target project;

[0012] The second test platform whose test data generation module corresponds to the same test item as the target test item is designated as the target second test platform.

[0013] In one embodiment, the process of generating target test data by calling the target test data generation module of the target second test platform further includes:

[0014] The runtime logs of the target test data generation module of the target second test platform will be synchronized to the front end of the first test platform via asynchronous communication.

[0015] In one embodiment, asynchronous communication methods include:

[0016] Asynchronous communication is achieved through the WebSocket protocol.

[0017] Secondly, embodiments of this application provide a testing method applied to a first testing platform, the method comprising:

[0018] A test data retrieval request is sent to the server; the server is configured to execute the test data generation method in any of the above embodiments.

[0019] Receive the target test data sent by the server;

[0020] Input the target test data into the software to be tested.

[0021] Thirdly, embodiments of this application provide a test data generation apparatus, applied to a server, the apparatus comprising:

[0022] The request receiving module is used to receive test data acquisition requests from the first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing the target project;

[0023] The request processing module is used to obtain requests based on test data and determine the target second test platform from multiple second test platforms; the target second test platform integrates a target test data generation module;

[0024] The calling module is used to call the target test data generation module of the target second test platform to generate target test data;

[0025] The data sending module is used to send the target test data to the first test platform.

[0026] In one embodiment, the request processing module includes a test item acquisition unit, a target item determination unit, and a target second test platform determination unit;

[0027] The test items are used to obtain the test items corresponding to the test data generation modules of each second test platform obtained by the unit;

[0028] The target project determination unit is used to determine the target project based on the request obtained from the test data;

[0029] The target second test platform determination unit uses the second test platform whose test data generation module has the same test items as the target items as the target test platform as the target second test platform.

[0030] In one embodiment, the apparatus further includes a log synchronization module, which is used to synchronize the running logs of the target test data generation module of the target second test platform to the front end of the first test platform via asynchronous communication.

[0031] Fourthly, embodiments of this application provide a computer device including one or more processors and a memory storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, they perform the steps of the test data generation method or test method as described in any of the above embodiments.

[0032] Fifthly, embodiments of this application provide a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the test data generation method or test method as described in any of the above embodiments.

[0033] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0034] Based on any of the above embodiments, when the first testing platform needs to test the target project of the software to be tested, a target second testing platform is selected from the second testing platforms that have already been built on the server. The target second testing platform can generate the target test data required for testing the target project by calling the target test data generation module of the target second testing platform. This method does not require rewriting the code for generating test data when test data is needed. Instead, it improves code reusability by reusing historical code, reduces repetitive work for testers, and greatly improves testing efficiency. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 A flowchart illustrating the test data generation method provided in this application embodiment;

[0037] Figure 2 A flowchart illustrating the testing method provided in the embodiments of this application;

[0038] Figure 3 A module structure diagram of the test data generation device provided in the embodiments of this application;

[0039] Figure 4 This is an internal structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation

[0040] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0041] Firstly, this application provides a test data generation method, applied to a server; please refer to [link to relevant documentation]. Figure 1 The method includes steps S102 to S108.

[0042] S102, Receive test data acquisition request from the first test platform.

[0043] The first test platform does not integrate a target test data generation module. This module is used to generate target test data for testing target items. It can be understood that when testing different software, a corresponding test platform is built for that software. The first test platform is the test platform for the software to be tested. The target test data can then be used to test the target items on the first test platform. This embodiment considers that different software may have the same target items that need to be tested, and these target items also require the same test data. Therefore, the target test data generation module on the existing test platform can be reused to generate the test data required for newly developed software.

[0044] For example, both financial platform software and shopping software require user account logins. Testing these two software programs necessitates testing their login functionality. Therefore, it's necessary to generate non-existent usernames and passwords as test data to evaluate the login capabilities. This study focuses on testing the code related to the login function. Assuming the shopping software is already developed and deployed, and its testing platform includes a target test data generation module relevant to this project, the same module can be reused to generate the corresponding target test data for the financial platform software during testing.

[0045] S104, Based on the test data acquisition request, determine the target second test platform from multiple second test platforms.

[0046] The target second testing platform integrates a target test data generation module. It can be understood that the second testing platform is the testing platform corresponding to the software that has already undergone software testing on the server. The target second testing platform is the second testing platform capable of generating target test data. Continuing with the above example, let's take the testing platform corresponding to the financial platform as the first testing platform and the testing platform corresponding to the shopping software as the second testing platform.

[0047] S106, call the target test data generation module of the target second test platform to generate target test data.

[0048] Understandably, during the research process, it was discovered that due to the different configurations of the project files for the first and second test platforms, directly porting the code of the target test data generation module of the second test platform to the project file of the first test platform would be incompatible and would often result in errors. To avoid the time and effort spent debugging or rewriting existing code and affecting testing efficiency, the target test data generation module of the second test platform can be directly called to generate the target test data.

[0049] S108 sends the target test data to the first test platform.

[0050] The first testing platform can test the target function using the target test data.

[0051] Based on the test data generation method in this embodiment, when the first test platform needs to test the target project of the software to be tested, a target second test platform is selected from the second test platforms that have been built on the server. The target second test platform can generate the target test data required for the target project by calling the target test data generation module of the target second test platform. This method does not require rewriting the code for generating test data when test data is needed; instead, it improves code reusability by reusing historical code, reduces repetitive work for testers, and greatly improves testing efficiency.

[0052] In one embodiment, determining the second test platform corresponding to the test data acquisition request based on the test data acquisition request includes:

[0053] 1) Obtain the test items corresponding to the test data generation module of each second test platform.

[0054] It can be understood that test projects are those tested by the second testing platform during the development of its corresponding software. When writing test cases on the second testing platform, a correspondence is established between each test data generation module and the test project. For example, if the first test project is testing the login function-related code, the first test data generation module is used to generate the test data required for the first test project. If the second test project is testing the shopping function-related code, the second test data generation module is used to generate the test data required for the second test project. The correspondence between the test data generation modules and the test projects can be obtained based on the development records of each second testing platform.

[0055] 2) Based on the test data acquisition request, determine the target project.

[0056] The test data acquisition request can include relevant information about the target project. The first test platform informs the server of the target project through the test data acquisition request, so that the server can select a target second test platform for the first test platform.

[0057] 3) The second test platform whose test data generation module corresponds to the same test item as the target test item is the target second test platform.

[0058] That is, a second test platform with the ability to generate target test data is selected from multiple second test platforms as the target second test platform. If the test project corresponding to the test data generation module of the second test platform is the same as the target project, then the second test platform has the ability to generate target test data.

[0059] In one embodiment, the process of generating target test data using the test data generation module of the second test platform corresponding to the test data acquisition request further includes:

[0060] The runtime logs of the test data generation module of the second test platform being invoked are synchronized to the front end of the first test platform via asynchronous communication. It can be understood that communication between the server and client can be divided into asynchronous and synchronous communication. Synchronous communication means that when a process executes a request, it waits for a response until it receives the information before continuing execution. HTTP is a common example of synchronous communication. Asynchronous communication, on the other hand, means that the process does not need to wait indefinitely but continues to execute its operations regardless of the status of other processes. When information is returned, the process is notified to process it, thus improving execution efficiency. Since the call is made on the server side, and testers perform tests through operations on the front end of the first test platform, high real-time communication is required to facilitate testers' understanding of the target test data generation progress and to facilitate timely resolution of problems that arise during the target test data generation process. For scenarios requiring real-time log synchronization, frequent communication between the client and server is necessary. Synchronous communication relies on polling, which places extremely high demands on server performance, consumes a lot of unnecessary bandwidth and traffic, and has poor real-time performance, impacting efficiency. Asynchronous communication can greatly improve real-time communication, so this embodiment uses asynchronous communication for log synchronization. The WebSocket protocol is a relatively mature asynchronous communication protocol. By establishing a WebSocket connection between the front-end and server of the first test platform, bidirectional real-time communication can be achieved between them.

[0061] Secondly, this application provides a testing method applied to a first testing platform. Please refer to [link to relevant documentation]. Figure 2 The method includes steps S202 to S206.

[0062] S202, Send a test data retrieval request to the server.

[0063] The server is configured to execute the test data generation method in any of the above embodiments. For a detailed description of the test data generation method, please refer to the above text. When the first test platform needs to test the target project, since it does not integrate a target test data generation module, it can send a test data retrieval request to the server to obtain the target test data.

[0064] S204, Receive target test data sent by the server.

[0065] The server is configured to select a target second test platform to generate target test data for the first test platform based on the test data acquisition request. After the server successfully generates the target test data by calling the target second test platform, it will send the target test data required by the first test platform back to the first test platform.

[0066] S206, Input the target test data into the software under test for testing.

[0067] Once the first testing platform receives the target test data, it can begin testing the target project of the software to be tested.

[0068] Thirdly, this application provides a test data generation device applied to a server; please refer to [link to relevant documentation]. Figure 3 The device includes a request receiving module 301, a request processing module 302, a calling module 303, and a data sending module 304.

[0069] The request receiving module 301 receives test data acquisition requests from the first test platform. The first test platform does not integrate a target test data generation module; the target test data generation module generates target test data for testing the target project. The request processing module 302 determines a target second test platform from multiple second test platforms based on the test data acquisition request; the target second test platform integrates a target test data generation module. The invocation module 303 invokes the target test data generation module of the target second test platform to generate the target test data. The data sending module 304 sends the target test data to the first test platform.

[0070] In one embodiment, the request processing module 302 includes a test item acquisition unit, a target item determination unit, and a target second test platform determination unit. The test item acquisition unit acquires the test items corresponding to the test data generation modules of each second test platform. The target item determination unit determines the target item based on the test data acquisition request. The target second test platform determination unit selects the second test platform whose test data generation module corresponds to the same test item as the target item as the target second test platform.

[0071] In one embodiment, the apparatus further includes a log synchronization module, which is used to synchronize the running logs of the target test data generation module of the target second test platform to the front end of the first test platform via asynchronous communication.

[0072] Fourthly, embodiments of this application provide a computer device, including one or more processors and a memory. The memory stores computer-readable instructions, which, when executed by one or more processors, perform the following: receiving a test data acquisition request from a first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing a target item; determining a target second test platform from a plurality of second test platforms according to the test data acquisition request; the target second test platform integrates a target test data generation module; calling the target test data generation module of the target second test platform to generate target test data; and sending the target test data to the first test platform.

[0073] In one embodiment, when the computer-readable instructions are executed by one or more processors, the following are performed: obtaining the test items corresponding to the test data generation modules of each second test platform; determining the target item according to the test data acquisition request; and selecting the second test platform whose test data generation modules of each second test platform have the same test items as the target item as the target second test platform.

[0074] In one embodiment, when the computer-readable instructions are executed by one or more processors, the following is performed: the runtime log of the target test data generation module of the target second test platform to be invoked is synchronized to the front end of the first test platform via asynchronous communication.

[0075] In one embodiment, when the computer-readable instructions are executed by one or more processors, they perform the following: sending a test data acquisition request to a server; configuring the server to perform the test data generation method in any of the above embodiments; receiving target test data sent by the server; and inputting the target test data into the software under test for testing.

[0076] Fifthly, embodiments of this application provide a storage medium storing computer-readable instructions. When executed by one or more processors, the computer-readable instructions cause the one or more processors to perform the following: receiving a test data acquisition request from a first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing a target item; determining a target second test platform from a plurality of second test platforms based on the test data acquisition request; the target second test platform integrates a target test data generation module; calling the target test data generation module of the target second test platform to generate target test data; and sending the target test data to the first test platform.

[0077] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors perform the following: acquiring the test items corresponding to the test data generation modules of each second test platform; determining the target item based on the test data acquisition request; and selecting the second test platform whose test items corresponding to the test data generation modules of each second test platform are the same as the target item as the target second test platform.

[0078] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors perform the following: synchronize the runtime log of the target test data generation module of the target second test platform to the front end of the first test platform via asynchronous communication.

[0079] In one embodiment, when the computer-readable instructions are executed by one or more processors, the one or more processors cause the processors to: send a test data acquisition request to a server; configure the server to perform the test data generation method in any of the above embodiments; receive target test data sent by the server; and input the target test data into the software under test for testing.

[0080] Indicatively, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device 400 provided in an embodiment of this application. The computer device 400 can be provided as a server. (Refer to...) Figure 4 The computer device 400 includes a processing component 402, which further includes one or more processors, and memory resources represented by memory 401 for storing instructions, such as application programs, that can be executed by the processing component 402. The application programs stored in memory 401 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 402 is configured to execute instructions to perform the test data generation method or test method of any of the above embodiments.

[0081] The computer device 400 may also include a power supply component 403 configured to perform power management of the computer device 400, a wired or wireless network interface 404 configured to connect the computer device 400 to a network, and an input / output (I / O) interface 405. The computer device 400 may operate on an operating system stored in memory 401, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0082] Those skilled in the art will understand that Figure 4The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0083] Sixthly, embodiments of this application provide a testing apparatus applied to a first testing platform. The testing apparatus includes a request sending module, a data receiving module, and a test data input module.

[0084] The request sending module is used to send a test data acquisition request to the server; the server is configured to execute the test data generation method in any of the above embodiments. The data receiving module is used to receive the target test data sent by the server. The test data input module is used to input the target test data into the software under test for testing.

[0085] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0086] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0087] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating test data, characterized in that, Applied to a server, the method includes: Receive test data acquisition request from the first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing the target project; Based on the test data acquisition request, a target second test platform is determined from multiple second test platforms; the target second test platform integrates the target test data generation module; the second test platform is the test platform corresponding to the software that has already undergone software testing on the server; the configurations of the project files for the first test platform and the second test platform are different; The target test data is generated by directly calling the target test data generation module of the target second test platform; The target test data is sent to the first test platform; The step of determining the target second test platform from multiple second test platforms based on the test data acquisition request includes: Obtain the test items corresponding to the test data generation modules of each of the second test platforms, wherein the test items are the items that the second test platform has tested during the development process of its corresponding software. When writing test cases on the second test platform, establish the correspondence between each test data generation module and the test items in the second test platform; obtain the correspondence between the test data generation modules and the test items according to the development records of each second test platform. The target project is determined based on the test data acquisition request; The second test platform whose test data generation module corresponds to the same test item as the target item is designated as the target second test platform, wherein the second test platform with the ability to generate target test data is selected from multiple second test platforms as the target second test platform.

2. The method according to claim 1, characterized in that, The process of generating the target test data by calling the target test data generation module of the target second test platform also includes: The running logs of the target test data generation module of the target second test platform to be invoked are synchronized to the front end of the first test platform through asynchronous communication.

3. The method according to claim 2, characterized in that, The asynchronous communication methods include: Asynchronous communication is achieved through the WebSocket protocol.

4. A testing method, characterized in that, Applied to a first test platform, the method includes: A test data acquisition request is sent to a server; the server is configured to execute the test data generation method according to any one of claims 1-3; Receive the target test data sent by the server; The target test data is input into the software to be tested.

5. A test data generation device, characterized in that, Applied to a server, the device includes: The request receiving module is used to receive test data acquisition requests from the first test platform; the first test platform does not integrate a target test data generation module, which is used to generate target test data for testing the target project; The request processing module is used to obtain a request based on the test data and determine a target second test platform from multiple second test platforms; the target second test platform integrates the target test data generation module; the second test platform is the test platform corresponding to the software that has already undergone software testing on the server; the configurations of the project files for the first test platform and the second test platform are different; The calling module is used to directly call the target test data generation module of the target second test platform to generate the target test data; The data sending module is used to send the target test data to the first test platform; The request processing module includes a test project acquisition unit, a target project determination unit, and a target second test platform determination unit; The test item acquisition unit is used to acquire the test items corresponding to the test data generation modules of each of the second test platforms. The test items are those tested by the second test platform during the development of its corresponding software. When writing test cases on the second test platform, the correspondence between each test data generation module and the test items in the second test platform is established. The correspondence between the test data generation modules and the test items is acquired according to the development records of each second test platform. The target project determination unit is used to determine the target project based on the test data acquisition request; The target second test platform determination unit uses the second test platform whose test data generation module corresponds to the same test item as the target item as the target second test platform. The second test platform with the ability to generate target test data is selected from multiple second test platforms as the target second test platform.

6. The apparatus according to claim 5, characterized in that, The device further includes a log synchronization module, which is used to synchronize the running logs of the target test data generation module of the target second test platform to the front end of the first test platform through asynchronous communication.

7. A computer device, characterized in that, It includes one or more processors and a memory storing computer-readable instructions, which, when executed by the one or more processors, perform the steps of the test data generation method as claimed in any one of claims 1 to 3 or the test method as claimed in claim 4.

8. A storage medium, characterized in that, The storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the test data generation method as described in any one of claims 1 to 3 or the test method as described in claim 4.

Citation Information

Patent Citations

  • Cross-platform IC test method, device, equipment and medium

    CN113297083A