Method, apparatus, device, medium and product for acquiring test data
Patent Information
- Application Number
- CN202210727194.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-06-24
AI Technical Summary
[0003]目前创建测试数据的方式主要是根据测试任务的要求手动创建满足要求的测试数据,导致测试数据的准备时间较长,影响测试效率
[0034]本申请提供的获取测试数据的方法,在接收到第一查询指令后,调用接口组中的查询准备接口,通过查询准备接口从元数据中获取目标模板中的待测试项对应的约束条件。并在接收到第一查询指令或第二查询指令后,调用接口组中的查询执行接口,通过查询执行接口从数据池预先配置的数据中获取待测试项对应的查询数据。在获取待测试项对应的约束条件以及查询数据后,在查询数据中挑选出符合约束条件的测试数据。这样,在数据池中预先配置数据,需要获取待测试项的查询数据时,直接从数据池中调用待测试项对应的查询数据,挑选出符合约束条件的测试数据,减少测试数据的准备时间,提高测试效率。
Smart Images

Figure CN115145810B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer software testing technology, and in particular to a method, apparatus, device, medium and product for acquiring test data. Background Technology
[0002] Test data is data in various forms used to test different applications, such as images, text, and videos. This data is used to check whether the software under test can work as expected, and also to test the limits of the application or identify its glaring points through boundary value testing.
[0003] Currently, the main way to create test data is to manually create test data that meets the requirements of the test task, which results in a long preparation time for test data and affects testing efficiency. Summary of the Invention
[0004] This application provides a method, apparatus, device, medium, and product for acquiring test data, thereby reducing test data preparation time and improving test efficiency.
[0005] Firstly, this application provides a method for obtaining test data, including:
[0006] Upon receiving the first query instruction, the query preparation interface in the interface group is called, and the constraint conditions corresponding to the test item in the target template are obtained from the metadata through the query preparation interface.
[0007] Upon receiving the first query instruction or the second query instruction, the query execution interface in the interface group is invoked to obtain the query data corresponding to the item to be tested from the data pre-configured in the data pool through the query execution interface;
[0008] Select test data that meets the constraints from the query data.
[0009] Optionally, obtaining the query data corresponding to the item to be tested from the pre-configured data in the data pool specifically includes:
[0010] The query data corresponding to each test item is retrieved sequentially from the pre-configured data in the data pool according to the ascending order of the test item numbers.
[0011] Optionally, obtaining the constraints corresponding to the test item in the target template from the metadata specifically includes:
[0012] According to the order of the test items in the target template from smallest to largest, the constraints corresponding to each test item are searched in the metadata in turn, and the constraints corresponding to the test items with constraints are obtained.
[0013] Optionally, obtaining the query data corresponding to the item to be tested from the pre-configured data in the data pool specifically includes:
[0014] Obtain the pre-configured data from the data pool, and select the query data corresponding to each item to be tested from the pre-configured data.
[0015] Optionally, the method further includes:
[0016] Replace the test item in the target template, and obtain the constraint conditions corresponding to the replaced test item from the metadata and the query data corresponding to the replaced test item from the data pool.
[0017] Optionally, the method further includes:
[0018] Add test items to the target template, and obtain the constraints corresponding to the added test items from the metadata and the query data corresponding to the added test items from the data pool.
[0019] Optionally, the method further includes:
[0020] Data is pre-configured in the data pool, and the configured data in the data pool is updated at preset time intervals;
[0021] The step of retrieving the query data corresponding to the item to be tested from the pre-configured data in the data pool specifically includes:
[0022] The query data corresponding to the item to be tested is retrieved from the updated data pool at the preset time interval.
[0023] Optionally, the method further includes:
[0024] Upon receiving the acquisition instruction, the acquisition interface in the interface group is invoked, and a target template is selected from the template library for the test task according to the test item to be tested in the acquisition instruction through the acquisition interface.
[0025] Optionally, the method further includes:
[0026] The test data is sent to the front-end client so that the front-end client fills the test data into the target template and uses the target template filled with test data to test the test task.
[0027] Secondly, this application provides an apparatus for acquiring test data, comprising: a first acquisition module, configured to, upon receiving a first query instruction, call a query preparation interface in an interface group, and obtain the constraint conditions corresponding to the test item in the target template from the metadata through the query preparation interface;
[0028] The second acquisition module is used to, after receiving the first query instruction or the second query instruction, call the query execution interface in the interface group, and obtain the query data corresponding to the test item from the data pre-configured in the data pool through the query execution interface;
[0029] The selection module is used to select test data that meets the constraints from the query data.
[0030] Thirdly, this application provides an electronic device, including: a memory and a processor;
[0031] The memory is used to store instructions; the processor is used to invoke the instructions in the memory to execute the first aspect and the method for acquiring test data in any possible design of the first aspect.
[0032] Fourthly, this application provides a computer-readable storage medium storing computer instructions, which, when executed by at least one processor of an electronic device, enable the electronic device to perform the method for acquiring test data in the first aspect and any possible design of the first aspect.
[0033] Fifthly, this application provides a computer program product comprising computer instructions that, when executed by at least one processor of an electronic device, enable the electronic device to perform the method for acquiring test data in the first aspect and any possible design of the first aspect.
[0034] The method for obtaining test data provided in this application, upon receiving a first query instruction, calls the query preparation interface in the interface group to retrieve the constraints corresponding to the test item in the target template from the metadata. Upon receiving either the first or second query instruction, it calls the query execution interface in the interface group to retrieve the query data corresponding to the test item from the pre-configured data in the data pool. After obtaining the constraints and query data corresponding to the test item, test data that meets the constraints is selected from the query data. In this way, by pre-configuring data in the data pool, when query data for the test item is needed, the corresponding query data is directly retrieved from the data pool, and test data that meets the constraints is selected, reducing test data preparation time and improving testing efficiency. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in 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 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 schematic diagram illustrating a scenario of a method for acquiring test data provided in an embodiment of this application;
[0037] Figure 2 A flowchart illustrating a method for acquiring test data according to an embodiment of this application;
[0038] Figure 3 Signaling interaction diagram of a method for acquiring test data provided in an embodiment of this application;
[0039] Figure 4 This is a schematic diagram of the structure of a device for acquiring test data according to an embodiment of this application;
[0040] Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions 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, 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.
[0042] As software systems become increasingly complex, a single software program is typically written collaboratively by multiple software engineers, each responsible for a specific module. Each engineer may focus primarily on their assigned module, lacking a comprehensive understanding of the entire software. Running the software directly in this way can easily lead to numerous errors. Therefore, software testing is essential. Testing primarily involves operating the program under specified conditions to identify errors, measure software quality, and evaluate whether the software meets design requirements.
[0043] Before testing software, test data needs to be created. This test data is used to check whether the software under test functions as expected. Test data can be Word or Excel, including usernames, passwords, and other database fields, used to test the application's positive and negative results; test data can also be images or pictures, used to verify applications with different objects or facial expressions, for data analysis, autonomous driving technology, etc.; test data can also be audio, used to recognize different language commands.
[0044] Currently, test data is primarily created manually based on the requirements of the testing task. This results in lengthy preparation times and impacts testing efficiency. Furthermore, since different testing tasks require the manual creation of different test data, a significant amount of manpower is needed, leading to high costs associated with test preparation.
[0045] To address the aforementioned issues, this application proposes a method for acquiring test data. Upon receiving a first query instruction, the query preparation interface in the interface group is invoked to retrieve the constraints corresponding to the test item in the target template from the metadata. Upon receiving either the first or second query instruction, the query execution interface in the interface group is invoked to retrieve the query data corresponding to the test item from the pre-configured data in the data pool. After obtaining the constraints and query data for the test item, test data that meets the constraints is selected from the query data. In this way, by pre-configuring data in the data pool, when query data for the test item is needed, the corresponding query data is directly retrieved from the data pool, and test data that meets the constraints is selected, reducing test data preparation time and improving testing efficiency. Furthermore, since the data pool contains a large amount of pre-configured data, it can provide corresponding query data for multiple different test items, thereby reducing test preparation costs.
[0046] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0047] Figure 1This illustration shows a scenario for obtaining test data according to an embodiment of this application. A front-end client 101 receives a first query instruction and sends it to a back-end server 102. The first query instruction includes the test item from the target template. The front-end client 101 can also receive a second query instruction and send it to the back-end server 102. The second query instruction includes the test item from the target template. Upon receiving the first query instruction, the back-end server 102 can retrieve the test item from the first query instruction and call the query preparation interface and query execution interface in the interface group. The query preparation interface retrieves the constraints corresponding to the test item in the target template from the metadata, and the query execution interface retrieves the query data corresponding to the test item from the pre-configured data in the data pool. Upon receiving a first query instruction, backend server 102 can retrieve the test items from the first query instruction, call only the query preparation interface in the interface group, and obtain the constraints corresponding to the test items in the target template from the metadata through the query preparation interface. Upon receiving a second query instruction, it retrieves the test items from the second query instruction, calls the query execution interface in the interface group, and obtains the query data corresponding to the test items from the pre-configured data in the data pool through the query execution interface. Then, backend server 102 selects test data that meets the constraints from the query data and can return the test data to frontend client 101. Frontend client 101 fills the test data into the corresponding test items in the target template and sends the filled target template to backend server 102. Backend server 102 uses the target template filled with test data to test the test task and can return the test results to frontend client 101.
[0048] Figure 2 A flowchart illustrating a method for acquiring test data according to an embodiment of this application is shown. Figure 1 Based on the illustrated embodiments, as Figure 2 As shown, with the backend server as the execution entity, the method in this embodiment may include the following steps:
[0049] S101. After receiving the first query instruction, call the query preparation interface in the interface group, and obtain the constraint conditions corresponding to the test item in the target template from the metadata through the query preparation interface.
[0050] Testers send a first query command to the front-end client via an input device, such as a mouse or keyboard. Upon receiving the first query command, the front-end client forwards it to the back-end server. The first query command includes the name, identifier, and sequence number of the item to be tested in the target template. The first query command can be used to indicate the constraints corresponding to the item to be tested in the target template, or it can be used to indicate the query data corresponding to the item to be tested in the target template.
[0051] After receiving the first query command, the backend server calls the query preparation interface in the interface group. This interface group, which can be located within the data query service, includes multiple interfaces such as query preparation, query execution, and testing interfaces to improve data transmission speed. Then, the backend server connects to the metadata through the query preparation interface and retrieves the constraints corresponding to the test items in the target template. These constraints are used to limit the test data and can include unique constraints, default value constraints, and non-null constraints. For example, if the test item is an identity type and its constraint is a unique constraint, only one identity type can be selected. Similarly, if the test item is a bank category and its constraint is a default value constraint, only the default bank can be selected. Finally, if the test item is a name and its constraint is a non-null constraint, the name is a required field.
[0052] S102. Upon receiving the first query instruction or the second query instruction, call the query execution interface in the interface group to obtain the query data corresponding to the test item from the pre-configured data in the data pool through the query execution interface.
[0053] A data pool can be understood as a data container arranged according to certain rules. Test items are obtained through template queries or transaction-based data generation, and the corresponding test data is placed in the data pool, thus pre-configuring a large amount of data. For example, a large number of test items corresponding to test tasks can be obtained, and the query data corresponding to these test items can be configured in the data pool. Because the data pool pre-configures a large amount of test data corresponding to the test items, when testing different tasks, test data corresponding to the test items of different tasks can be obtained, thereby reducing the cost and time invested in test preparation.
[0054] It should be noted that the data pool is geared towards testers. During the test case design phase, testers can send instructions to the backend server through the frontend client, causing the backend server to select test data from the data pool that matches the test task, so that testers can use the test data. During the test case execution phase, executors can use the test data to test the test task.
[0055] In some embodiments, the data configured in the data pool can be updated at preset time intervals, such as adding, deleting, or replacing some data, to improve data availability and meet the needs of different testing tasks. Therefore, query data corresponding to the test item can be obtained from the updated data pool at preset time intervals, and the query data obtained at multiple preset time intervals can be used as the query data corresponding to the test item, improving data comprehensiveness and thus enhancing testing effectiveness.
[0056] Testers send a first query command or a second query command to the front-end client through an input device. The back-end server can then call the query execution interface in the interface group based on the first or second query command to retrieve the query data corresponding to the test item from the pre-configured data in the data pool.
[0057] In some embodiments, after receiving the first query instruction, the backend server simultaneously calls the query preparation interface and the query execution interface in the interface group. The query preparation interface obtains the constraints corresponding to the test item in the target template from the metadata, and the query execution interface obtains the query data corresponding to the test item from the pre-configured data in the data pool.
[0058] In other embodiments, after receiving the first query instruction, the backend server only calls the query preparation interface in the interface group to obtain the constraints corresponding to the test item in the target template from the metadata. After receiving the second query instruction, the backend server then calls the query execution interface in the interface group to obtain the query data corresponding to the test item from the pre-configured data in the data pool.
[0059] One implementation involves replacing the test items in the target template. The original test item is called the current test item, and the replaced test item is called the target test item. The current query data corresponding to the current test item in the data pool is replaced with the target query data, and the current constraints corresponding to the current test item in the metadata are replaced with the target constraints. After replacing the current test item in the target template with the target test item, the target constraints corresponding to the target test item can be obtained from the metadata, and the target query data corresponding to the target test item can be obtained from the data pool. This ensures that the data pool can provide the test data needed when the test task changes.
[0060] As another implementation, it's necessary to add test items to the target template. These new test items are called target test items. Then, query data corresponding to the target test item can be added to the data pool, and constraints corresponding to the target test item can be added to the metadata. After adding the test item to the target template, the constraints corresponding to the target test item can be retrieved from the metadata, and the query data corresponding to the target test item can be retrieved from the data pool. This ensures that the data pool can meet the test data requirements when the test task changes.
[0061] S103. Select test data that meets the constraints from the query data.
[0062] After obtaining the constraints and query data corresponding to the test item in the target template, the server selects test data that meets the constraints from the query data. For example, if the test item is a bank category, the query data includes multiple banks, and the constraint is the default bank, then the test data is the default bank.
[0063] The method for obtaining test data provided in this application pre-configures data in a data pool. When query data for a test item needs to be obtained, the corresponding query data is directly retrieved from the data pool, and test data that meets the constraints is selected, reducing the preparation time of test data and improving testing efficiency.
[0064] Figure 3 This diagram illustrates a signaling interaction method for acquiring test data according to an embodiment of this application. Figure 3 As shown, the method in this embodiment may include the following steps:
[0065] S201. Send the acquisition command to the backend server.
[0066] The front-end client receives a retrieval command sent by the tester via an input device. This command instructs the user to retrieve the target template corresponding to the test task. Upon receiving the retrieval command, the front-end client forwards it to the back-end server.
[0067] S202. Receive the acquisition instruction, call the acquisition interface in the interface group, and select the target template for the test task from the template library through the acquisition interface according to the test task to be tested in the acquisition instruction.
[0068] The backend server receives the retrieval command sent by the frontend client, extracts the test items of the test task in the retrieval command, and calls the retrieval interface in the interface group. In this way, it can use the retrieval interface to select the target template corresponding to the test item from the template library. The test items included in the target template may include the test items of the test task in the retrieval command.
[0069] In some embodiments, the retrieval instruction may include the test items of the test task. After receiving the retrieval instruction, the backend server can extract the test items of the test task from the retrieval instruction and call the retrieval interface in the interface group to search for a target template that matches the test items of the test task in the template library through the retrieval interface, thereby selecting a target template for the test task.
[0070] In some embodiments, after receiving a retrieval instruction, the backend server can call a retrieval interface to obtain all templates in the template library and send them to the frontend client. This allows testers to select the corresponding target template based on the items to be tested in the test task. For example, the items to be tested in each template in the template library can be compared with the items to be tested in the test task. If the items to be tested in a certain template include the items to be tested in the test task, that template can be selected as the target template.
[0071] S203. Send the first query command to the backend server.
[0072] The front-end client receives a first query command sent by the tester via an input device. This first query command can be used to specify the constraints corresponding to the item to be tested in the target template, or it can be used to specify the query data corresponding to the item to be tested in the target template. After receiving the first query command, the front-end client sends it to the back-end server.
[0073] S204. Receive the first query instruction, obtain the test items of the target template in the first query instruction, call the query preparation interface in the interface group, and obtain the constraint conditions corresponding to the test items in the target template from the metadata through the query preparation interface.
[0074] The backend server receives the first query command sent by the frontend client, obtains the test item of the target template in the first query command, and calls the query preparation interface in the interface group. The query preparation interface searches for the constraints of the test item in the metadata. If the constraints of the test item exist in the metadata, the corresponding constraints of the test item are obtained through the query preparation interface.
[0075] In some embodiments, some test items may not have corresponding constraints. The constraints for each test item can be searched sequentially in the metadata according to their serial numbers, from smallest to largest. This allows for querying each test item and avoids missing any constraints. If a constraint for a test item can be found in the metadata, it indicates that the test item has constraints; if no constraint is found, it indicates that the test item does not have constraints. The constraints corresponding to the test items with constraints are then obtained. For example, the metadata can be searched for constraints with the same identifier as the test item. If a constraint with the same identifier is found, it indicates that the test item has constraints; if no constraint with the same identifier is found, it indicates that the test item does not have constraints.
[0076] For example, the target template includes five test items: the first test item, the second test item, the third test item, the fourth test item, and the fifth test item. The sequence number of the first test item is ①, the second test item is ②, the third test item is ③, the fourth test item is ④, and the fifth test item is ⑤. First, the metadata is searched for constraints with the same identifier as the identifier of the first test item. If found, the constraints with the same identifier as the identifier of the first test item are obtained; otherwise, the first test item has no constraints. Then, the metadata is searched for constraints with the same identifier as the identifier of the second test item. If found, the constraints with the same identifier as the identifier of the second test item are obtained; otherwise, the second test item has no constraints. Finally, the metadata is searched for constraints with the same identifier as the identifier of the third test item. If found, the constraints with the same identifier as the identifier of the third test item are obtained. The identifier of the third test item has its own constraints; if none are found, the third test item has no constraints. Then, the metadata searches for constraints with the same identifier as the identifier of the fourth test item. If found, the constraints with the same identifier as the identifier of the fourth test item are obtained; otherwise, the fourth test item has no constraints. Finally, the metadata searches for constraints with the same identifier as the identifier of the fifth test item. If found, the constraints with the same identifier as the identifier of the fifth test item are obtained; otherwise, the fifth test item has no constraints. In some embodiments, the constraints for each test item can be searched in the metadata sequentially according to its serial number from largest to smallest; this is not a limitation.
[0077] S205. Send the second query command to the backend server.
[0078] The front-end client receives a second query command sent by the tester via an input device. This second query command instructs the user to retrieve the data corresponding to the item to be tested within the target template. Upon receiving the second query command, the front-end client forwards it to the back-end server.
[0079] S206. Receive the second query instruction, call the query execution interface in the interface group, and obtain the query data corresponding to the test item from the pre-configured data in the data pool through the query execution interface.
[0080] The backend server receives the second query command sent by the frontend client, retrieves the test item from the target template in the second query command, and calls the query execution interface in the interface group. The query execution interface then searches the data pool for the corresponding query data for the test item, thus obtaining the query data for the test item. For example, if the test item is an identity type, the query data includes ID cards, passports, etc.
[0081] In some embodiments, query data corresponding to each test item can be retrieved sequentially from a pre-configured data pool in ascending order of the test item's index to avoid missing any test item's query data. For example, query data with the same identifier as the test item's identifier can be searched in the data pool.
[0082] For example, the target template includes five test items: Item 1, Item 2, Item 3, Item 4, and Item 5. Item 1 is numbered ①, Item 2 is numbered ②, Item 3 is numbered ③, Item 4 is numbered ④, and Item 5 is numbered ⑤. First, the database searches for query data with the same identifier as Item 1 (i.e., the query data corresponding to Item 1). Then, it searches for query data with the same identifier as Item 2 (i.e., the query data corresponding to Item 2). Next, it searches for query data with the same identifier as Item 3 (i.e., the query data corresponding to Item 3). Then, it searches for query data with the same identifier as Item 4 (i.e., the query data corresponding to Item 4). Finally, it searches for query data with the same identifier as Item 5 (i.e., the query data corresponding to Item 5). In some embodiments, the query data corresponding to each test item can be searched in the data pool in descending order of the test item number, which is not limited here.
[0083] S207. Select test data that meets the constraints from the query data.
[0084] After obtaining the constraints and query data corresponding to the test items in the target template, the server selects the test data that meets the constraints from the query data.
[0085] S208. Send the test data to the front-end client.
[0086] After the backend server selects the test data that meets the constraints from the query data, it sends the test data to the frontend client so that testers can obtain the test data.
[0087] S209. Fill the target template with the test data.
[0088] After receiving the test data, the tester uses an input device on the front-end client to populate the test data into the target template.
[0089] S210. Send the target template filled with test data to the backend server.
[0090] S211. Test the test task using the target template filled with test data.
[0091] The backend server receives the target template for populating test data. The target template includes the test items of the test task, so the test task can be tested using the target template for populating test data.
[0092] The method for obtaining test data provided in this application involves interaction between the backend server and the frontend client. When query data for the item to be tested is needed, the query data corresponding to the item to be tested is directly retrieved from the pre-configured data in the data pool. Test data that meets the constraints is selected, reducing the preparation time of test data and improving testing efficiency.
[0093] Figure 4 This invention provides a schematic diagram of the structure of a device for acquiring test data according to an embodiment of this application. Figure 4 As shown, the device 10 for acquiring test data in this embodiment is used to implement the operation corresponding to the backend server in any of the above method embodiments. The device 10 for acquiring test data in this embodiment includes:
[0094] The first acquisition module 11 is used to call the query preparation interface in the interface group after receiving the first query instruction, and obtain the constraint conditions corresponding to the test item in the target template from the metadata through the query preparation interface.
[0095] The second acquisition module 12 is used to call the query execution interface in the interface group after receiving the first query instruction or the second query instruction, and obtain the query data corresponding to the test item from the data pre-configured in the data pool through the query execution interface;
[0096] The selection module 13 is used to select test data that meets the constraints from the query data.
[0097] The apparatus 10 for obtaining the test device provided in this application embodiment can execute the above method embodiment. Its specific implementation principle and technical effect can be found in the above method embodiment, and will not be repeated here.
[0098] Figure 5 A schematic diagram of the hardware structure of an electronic device according to an embodiment of this application is shown. Figure 5As shown, the electronic device 20 is used to implement the operation corresponding to the backend server in any of the above method embodiments. The electronic device 20 in this embodiment may include: a memory 21, a processor 22, and a communication interface 23.
[0099] The memory 21 is used to store computer instructions. The memory 21 may include high-speed random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0100] Processor 22 is used to execute computer instructions stored in memory to implement the method for acquiring test data in the above embodiments. For details, please refer to the relevant descriptions in the foregoing method embodiments. The processor 22 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0101] Alternatively, the memory 21 can be either standalone or integrated with the processor 22.
[0102] The communication interface 23 can be connected to the processor 22. The processor 22 can control the communication interface 23 to realize the functions of receiving and sending data.
[0103] The electronic device provided in this embodiment can be used to execute the above-described method for acquiring test data. Its implementation and technical effects are similar, and will not be described again here.
[0104] This application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used to implement the methods provided in the various embodiments described above.
[0105] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. At least one processor of the device can read the computer instructions from the computer-readable storage medium, and the at least one processor executes the computer instructions to cause the device to perform the methods provided in the various embodiments described above.
[0106] This application also provides a chip including a memory and a processor. The memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory, causing a device equipped with the chip to perform the methods described in the various possible embodiments described above.
[0107] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for acquiring test data, characterized in that, The method includes: Upon receiving the first query instruction, the query preparation interface in the interface group is invoked. This interface searches the metadata sequentially for the constraints corresponding to each test item in the target template, in ascending order of their index. The constraints for each test item with constraints are then obtained. These constraints include unique constraints, default value constraints, and non-null constraints. The interface group includes a query preparation interface, a query execution interface, and a test interface. The query preparation interface is used by the backend server to connect to the metadata. Upon receiving the first query instruction or the second query instruction, the query execution interface in the interface group is invoked. The query execution interface retrieves the query data corresponding to each test item from the pre-configured data in the data pool in ascending order of the test item number. Select test data that meets the constraints from the query data; The method further includes: Replace the test item in the target template, and obtain the constraint conditions corresponding to the replaced test item from the metadata and the query data corresponding to the replaced test item from the data pool; Add test items to the target template, and obtain the constraints corresponding to the added test items from the metadata and the query data corresponding to the added test items from the data pool.
2. The method according to claim 1, characterized in that, The step of retrieving the query data corresponding to the item to be tested from the pre-configured data in the data pool specifically includes: Obtain the pre-configured data from the data pool, and select the query data corresponding to each item to be tested from the pre-configured data.
3. The method according to any one of claims 1-2, characterized in that, The method further includes: Data is pre-configured in the data pool, and the configured data in the data pool is updated at preset time intervals; The step of retrieving the query data corresponding to the item to be tested from the pre-configured data in the data pool specifically includes: The query data corresponding to the item to be tested is retrieved from the updated data pool at the preset time interval.
4. The method according to any one of claims 1-2, characterized in that, The method further includes: Upon receiving the acquisition instruction, the acquisition interface in the interface group is invoked, and a target template is selected from the template library for the test task according to the test item to be tested in the acquisition instruction through the acquisition interface.
5. The method according to claim 4, characterized in that, The method further includes: The test data is sent to the front-end client so that the front-end client fills the test data into the target template and uses the target template filled with test data to test the test task.
6. A data testing device, characterized in that, The device includes: The first acquisition module is used to, upon receiving a first query instruction, call the query preparation interface in the interface group to obtain the constraints corresponding to the test item in the target template from the metadata through the query preparation interface; wherein, the constraints include unique constraints, default value constraints, and non-null constraints; the interface group includes a query preparation interface, a query execution interface, and a test interface; the query preparation interface is used for the backend server to connect to the metadata; The second acquisition module is used to, after receiving the first query instruction or the second query instruction, call the query execution interface in the interface group, and obtain the query data corresponding to the test item from the data pre-configured in the data pool through the query execution interface; The selection module is used to select test data that meets the constraints from the query data; The first acquisition module is specifically used to acquire query data corresponding to each test item from the pre-configured data in the data pool in ascending order of the test item's serial number; The second acquisition module is specifically used to search for the constraint conditions corresponding to each test item in the metadata in ascending order of the serial number of the test items in the target template, and to acquire the constraint conditions corresponding to the test items with constraint conditions. The processing module is used to replace the test item in the target template, and obtain the constraint conditions corresponding to the replaced test item from the metadata and the query data corresponding to the replaced test item from the data pool. Add test items to the target template, and obtain the constraints corresponding to the added test items from the metadata and the query data corresponding to the added test items from the data pool.
7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method for acquiring test data as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, are used to implement the method for acquiring test data as described in any one of claims 1 to 5.
9. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method for acquiring test data as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data collection method, device and equipment and storage medium
CN111427784A
Distribution board automatic test method and device
CN114384351A
Smart contract test method and device, computer equipment and storage medium
CN114490322A