Test case generation method, device, computer equipment and storage medium

By downloading and embeding file package information in the automated test platform and generating test cases, the problem of hindering testing work caused by untimely update of personalized requirements is solved, and the automated generation and efficiency of test cases are achieved.

CN114385499BActive Publication Date: 2025-08-19PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210030711.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2025-08-19
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

In the development of existing automated test platforms, the inadequate update of personalized requirements leads to rule agreements or interface definitions, which affects the normal development of testing work.

Method used

Based on the file package information entered by users of different platforms, download the file package from the data warehouse and form a collection locally to the platform, select the target file package and embed the test case generation template to generate the test case.

Benefits of technology

It realizes the automatic generation of test cases, avoids inconsistencies or interface definitions, ensures the normal development of test work, and improves efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114385499B_ABST
    Figure CN114385499B_ABST
Patent Text Reader

Abstract

This application is applicable to the field of automated testing technology and provides a method, device, computer equipment, and storage medium for generating test cases, wherein the method includes: based on the file package information entered by different platform users, downloading a file package matching the file package information from a data warehouse to the platform locally to form a file package set; wherein the file package includes executable code for generating test data according to set test requirements; based on a target test requirement file, selecting a target file package from the file package set, embedding the output parameters of the executable code in the target file package into a test case generation template; running the target file package, and generating a test case based on the test case generation template embedded with the output parameters. This solution can ensure the normal implementation of testing work and improve efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automated testing technology, and in particular to a method, apparatus, computer equipment, and storage medium for generating test cases. Background Art

[0002] Interface testing is an essential process in system development. Interface testing is mainly used to test the usability of the interactive interfaces between external systems and between various subsystems within the system.

[0003] Currently, automated testing platforms are used to implement interface testing, with testers responsible for test configuration and execution. Traditional tool platform feature development requires user research, requirement collection, impact analysis, and then scheduling implementation.

[0004] Due to the small number of automation platform developers, the extensive coordination and support workload, a lack of understanding of personalized needs, and the need to schedule feature development, implementation is long and communication costs are high. This makes existing automation platform development solutions unable to accurately meet the needs of users in different functional systems. Discrepancies in rules and interface definitions often occur, hindering testing. Furthermore, personalized features are often updated as business system functions are updated. Failure to promptly monitor these updates can prevent the execution of tools maintained on the automation platform, impacting the execution of the automation platform tools and hindering the implementation or testing of the tools on the platform. Summary of the Invention

[0005] The embodiments of the present application provide a method, apparatus, computer equipment and storage medium for generating test cases to solve the problem in the prior art that the development of automation platforms often encounters discrepancies in rule agreements or interface definitions, and personalized function updates are not timely, which leads to obstruction of tool function implementation or testing work.

[0006] A first aspect of an embodiment of the present application provides a method for generating a test case, comprising:

[0007] Based on the file package information entered by different platform users, download the file packages that match the file package information from the data warehouse to the platform locally to form a file package set; wherein the file package includes executable code for generating test data according to the set test requirements;

[0008] Based on the target test requirement file, a target file package is selected from the file package set, and output parameters of the executable code in the target file package are embedded into the test case generation template;

[0009] The target file package is run to generate a test case based on a test case generation template embedded with the output parameter.

[0010] Optionally, the selecting a target file package from the file package set based on the target test requirement file includes:

[0011] Parse the target test requirement file to obtain the target test requirements of the object to be tested;

[0012] Providing a test case writing page, wherein the test case writing page displays the file packages in the file package set and a function description of each file package in generating test data according to the set test requirements;

[0013] Obtaining a candidate file package selected externally from the test case writing page based on the object to be tested;

[0014] Based on the target test requirement, when it is determined that the set test requirement according to which the function of the candidate file package generates test data is consistent with the target test requirement, the candidate file package is determined as the target file package.

[0015] Optionally, after obtaining the candidate file package selected externally from the test case writing page based on the object to be tested, the method further includes:

[0016] Based on the target test requirements, when it is determined that the set test requirements followed by the function of the candidate file package to generate test data are inconsistent with the target test requirements, a file package reselection prompt message is output in the test case writing page until the set test requirements followed by the function of the candidate file package to generate test data are consistent with the target test requirements.

[0017] Optionally, based on the file package information entered by different platform users, downloading the file packages matching the file package information from the data warehouse to the platform locally to form a file package set includes:

[0018] Setting a test sample template in the platform for use by a user of the platform;

[0019] Obtaining the file package information entered by different platform users, wherein the file package information includes a storage address of the file package in a data warehouse or key feature information of the file package;

[0020] Based on the file package information, download the file packages that match the file package information from the data warehouse to the platform to form a file package set;

[0021] The file package is generated by the platform user based on the test sample template and then uploaded to the data warehouse.

[0022] Optionally, running the target file package to generate a test case based on a test case generation template embedded with the output parameter includes:

[0023] Running the target file package to generate target test data according to set test requirements through the executable code in the target file package;

[0024] The target test data is assigned to the output parameter embedded in the test case generation template, and the test case generation template embedded with the output parameter is run to generate a test case.

[0025] Optionally, the running of the target file package, based on a test case template embedded with the output parameter, after generating the test case, further comprises:

[0026] Executing the test case, and performing a performance evaluation on the target file package based on the execution result of the test case to obtain a performance evaluation value;

[0027] When it is determined based on the performance evaluation value that the evaluation performance of the target file package does not meet a set standard, the target file package is removed from the file package set.

[0028] Optionally, the executing the test case and performing a performance evaluation on the target file package based on the execution result of the test case to obtain a performance evaluation value further includes:

[0029] In combination with the performance evaluation value and the historical performance evaluation value of the target file package, when it is determined that the evaluation performance of the target file package meets the set standard, the target file package is solidified locally on the platform.

[0030] A second aspect of an embodiment of the present application provides a test case generation device, comprising:

[0031] An acquisition module is used to download file packages matching the file package information entered by different platform users from a data warehouse to the platform to form a file package set; wherein the file package includes executable code for generating test data according to the set test requirements;

[0032] A parameter setting module is used to select a target file package from the file package set based on the target test requirement file, and embed the output parameters of the executable code in the target file package into the test case generation template;

[0033] The test case generation module is used to run the target file package and generate a test case based on a test case generation template embedded with the output parameters.

[0034] A third aspect of an embodiment of the present application provides a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.

[0035] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0036] A fifth aspect of the present application provides a computer program product, which, when executed on a terminal, enables the terminal to execute the steps of the method described in the first aspect.

[0037] As can be seen from the above, in the embodiment of the present application, based on the file package information entered by users of different platforms, file packages that can generate test data according to the set test requirements are downloaded from the data warehouse to the local platform to form a file package collection, and the output parameters of the executable code in the target file package are embedded in the test case generation template. Finally, a test case is generated based on the file package and the test case generation template. This process obtains the file package that can generate test data developed by the user through the test platform, so that different file packages have the function of generating interface test data required by different functional systems, avoiding discrepancies in rule agreements or interface definitions, realizing the sharing of file packages, ensuring the automatic generation of test cases in the automation platform tools, ensuring the richness of the platform tool functions, ensuring the normal progress of testing work, and improving efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0039] Figure 1 This is a process of generating a test case provided by the embodiment of the present application Figure 1 ;

[0040] Figure 2 This is a process of generating a test case provided by the embodiment of the present application Figure 2 ;

[0041] Figure 3 This is a structural diagram of a test case generation device provided in an embodiment of the present application;

[0042] Figure 4This is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0044] It will be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0045] It should also be understood that the terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0046] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0047] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0048] In specific implementations, the terminals described in the embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (e.g., touch screen displays and / or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., touch screen displays and / or touch pads).

[0049] In the following discussion, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and / or joystick.

[0050] The terminal supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a website creation application, a disk burning application, a spreadsheet application, a game application, a phone application, a video conferencing application, an email application, an instant messaging application, a workout support application, a photo management application, a digital camera application, a digital video camera application, a web browsing application, a digital music player application, and / or a digital video player application.

[0051] Various applications that can be executed on the terminal can use at least one common physical user interface device, such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and / or changed between applications and / or within a corresponding application. In this way, the common physical architecture of the terminal (e.g., the touch-sensitive surface) can support a variety of applications with user interfaces that are intuitive and transparent to the user.

[0052] It should be understood that the size of the serial numbers of each step in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of this application.

[0053] In order to illustrate the technical solution described in this application, specific embodiments are provided below.

[0054] See also Figure 1 , Figure 1 This is a process of generating a test case provided by the embodiment of the present application Figure 1 .

[0055] like Figure 1 As shown, a method for generating a test case includes the following steps:

[0056] Step 101: Based on the file package information entered by different platform users, the file packages matching the file package information are downloaded from the data warehouse to the platform locally to form a file package set.

[0057] The file packages in the data warehouse are specifically written and uploaded by different platform users. After the platform users upload the written file packages to the data warehouse, they can enter the file package information into the automation platform, which can then download the file from the data warehouse based on the file package information.

[0058] The file package information includes the storage address of the file package in the data warehouse or key feature information of the file package. The automation platform can use the storage address or key feature information of the file package to find the corresponding file package from the data warehouse to perform the download action.

[0059] The file package includes executable code for generating test data according to set test requirements.

[0060] The test requirements are set, for example, for login interface testing and data access interface testing, and the generated test data are, for example, several login accounts and passwords automatically and randomly generated, several virtual accounts and passwords randomly matched from the test database, or several data IDs and access addresses automatically and randomly generated, several virtual accounts and passwords randomly matched from the test database.

[0061] By executing the executable code in the file package, test data can be generated according to the set test requirements, avoiding deviations in rule agreements or interface definitions, and ensuring the convenience and accuracy of test data generation.

[0062] Specifically, during implementation, platform users can use Maven packaging to produce executable jar tool packages and upload them to Maven private servers.

[0063] A jar package corresponds to a method class and the methods that class can implement. After the platform user generates a jar package corresponding to the test function, it uploads the jar package to the data warehouse. The data warehouse collects jar packages that implement different test data generation functions so that the test platform can call the jar packages.

[0064] During this process, the automation platform reserves an interactive window. Once the platform user has developed the corresponding test data generation functionality based on the business attributes of their own personalized functional modules, they can upload the toolkit to the Maven repository. After entering the toolkit's Maven-published JAR information or the designated location of the JAR package in the data warehouse, the automation platform can download and import the toolkit.

[0065] As an optional implementation method, based on the file package information entered by different platform users, the file packages matching the file package information are downloaded from the data warehouse to the platform locally to form a file package set, including:

[0066] Setting up test sample templates in the platform for use by platform users;

[0067] Obtaining file package information entered by different platform users, including the file package's storage address in the data warehouse or key feature information of the file package;

[0068] Based on the file package information, the file packages that match the file package information are downloaded from the data warehouse to the platform to form a file package collection;

[0069] Among them, the file package is generated by the platform user based on the test sample template and uploaded to the data warehouse.

[0070] This test sample template is used to explain to platform users the unified writing specifications of the test data required in the current platform.

[0071] Specifically, the test sample template includes sample documents, examples, and source code, which provide standardized guidance to users.

[0072] Based on the test sample template, different platform users can combine the business attributes of their own personalized function modules to write data generation code for corresponding interface testing requirements. The data generation code is used to generate the data required for interface testing corresponding to the business attributes of the personalized function modules.

[0073] Step 102: Based on the target test requirement file, select a target file package from the file package set, and embed the output parameters of the executable code in the target file package into the test case generation template;

[0074] Specifically, the target test requirement file records the current test requirements, and based on the file, a target file package can be selected to achieve automatic generation of corresponding test data.

[0075] The target test requirement document is entered into the test platform by the tester. Specifically, the target test requirement document is obtained by the tester uploading a prepared document directly to the test platform, or is obtained by the tester writing it on the test platform based on the test requirements.

[0076] Alternatively, a test requirement file library may be integrated into the test platform, and the test requirement files in the test requirement file library may be used by users to select files based on current test requirements, and the target test requirement files may be generated after the content of the selected files are edited and modified, thereby improving test efficiency and the intelligence of test operations.

[0077] As an optional implementation, selecting a target file package from a file package set based on a target test requirement file includes:

[0078] Parse the target test requirement file to obtain the target test requirements of the object to be tested;

[0079] Provide a test case writing page, which displays the file packages in the file package set and the function description of each file package in generating test data according to the set test requirements;

[0080] Obtain candidate file packages selected from the test case writing page based on the object to be tested;

[0081] Based on the target test requirement, when it is determined that the set test requirement according to which the function of the candidate file package generates test data is consistent with the target test requirement, the candidate file package is determined as the target file package.

[0082] Among them, the target test requirement file is parsed to obtain the test preconditions, test parameters, test sequence and other test requirement contents corresponding to different objects to be tested.

[0083] The target test requirements document may include test tasks for different interfaces. For example, to test the interfaces of a smart home system in a room, you can first test the lighting control module, then the audio control module. This will provide the test parameters and test sequence for each interface to be tested.

[0084] When selecting a target file package from a file package set based on a target test requirement file, in addition to parsing the file and automatically matching the file packages, the target file package can also be selected based on a user selection operation.

[0085] Specifically, a test case writing page is provided to users, which displays the file packages and file package functions available for external users to select. When external users select relevant file packages in the test case writing page, the platform provides them with auxiliary judgment of the selection results, reducing the professional business requirements for testers and improving the correct implementation of personalized function testing work.

[0086] Correspondingly, after obtaining the candidate file package selected from the test case writing page based on the object to be tested, it also includes:

[0087] Based on the target test requirements, when it is determined that the set test requirements for the function of generating test data of the candidate file package are inconsistent with the target test requirements, output the file package reselection prompt information in the test case writing page until the set test requirements for the function of generating test data of the candidate file package are consistent with the target test requirements.

[0088] During this process, the test platform provides users with the function of selecting file packages and provides auxiliary judgment functions for user selection results to meet customers' more practical testing needs and ensure the correct generation of test cases.

[0089] Furthermore, after selecting a target file package from the file package set based on the target test requirement file, it is necessary to embed the output parameters of the executable code in the target file package into the test case generation template.

[0090] The test case generation template is a test case generation template that matches the target test requirements of the object to be tested.

[0091] The test case generation template may be uploaded by a user, shared from a third-party platform, or pre-trained.

[0092] The test case generation template may include a test case generation code, and a set position in the test case generation code is used to embed data required for the test.

[0093] During the application process, the output parameters of the executable code in the target file package are embedded into the corresponding positions in the test case generation template, so that the test data generated after the target file package is run can be embedded into the test case generation template through parameter passing. The test data is directly processed through the test case generation template to generate the corresponding test case.

[0094] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0095] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0096] Step 103: Run the target file package and generate a test case based on the test case generation template embedded with the output parameters.

[0097] When the target file package is run, the executable code in the target file package is specifically triggered to be executed so as to generate corresponding test data according to the set test requirements. After the test data is generated, the output of the data is realized through the output parameters of the target file package.

[0098] After obtaining the target data, a test case generation template embedded with output parameters can be used to assign and fill the test data in the test case generation template, and then the corresponding test case can be generated.

[0099] That is, the running target file package generates a test case based on a test case generation template embedded with output parameters, including:

[0100] Run the target file package and generate target test data according to the set test requirements through the executable code in the target file package; assign the target test data to the output parameters embedded in the test case generation template, run the test case generation template embedded with the output parameters, and generate the test case.

[0101] In an embodiment of the present application, based on the file package information entered by users of different platforms, a file package that can generate test data according to the set test requirements is downloaded from the data warehouse to the local platform to form a file package collection. After selecting the target file package from the file package collection based on the target test requirement file, the output parameters of the executable code in the target file package are embedded in the test case generation template. Combined with the test case generation template, the target file package is run to generate the final test case. This process obtains the file package that can generate test data developed by the user through the test platform, so that different file packages have the function of generating interface test data required by different functional systems, avoiding discrepancies in rule agreements or interface definitions, realizing the sharing of file packages, ensuring the automatic generation of test cases in the automation platform tools, ensuring the richness of the platform tool functions, ensuring the normal progress of testing work, and improving efficiency.

[0102] The embodiments of this application also provide different implementation methods of the test case generation method.

[0103] See also Figure 2 , Figure 2 This is a process of generating a test case provided by the embodiment of the present application Figure 2 .like Figure 2 As shown, a method for generating a test case includes the following steps:

[0104] Step 201: Based on the file package information entered by different platform users, file packages matching the file package information are downloaded from the data warehouse to the platform locally to form a file package set.

[0105] The file package includes executable code for generating test data according to set test requirements.

[0106] The implementation process of this step is the same as the implementation process of step 101 in the aforementioned embodiment, and will not be repeated here.

[0107] Step 202 : Based on the target test requirement file, a target file package is selected from the file package set, and output parameters of the executable code in the target file package are embedded into a test case generation template.

[0108] The implementation process of this step is the same as the implementation process of step 102 in the aforementioned embodiment, and will not be repeated here.

[0109] Step 203: Run the target file package and generate a test case based on the test case generation template embedded with the output parameters.

[0110] The implementation process of this step is the same as the implementation process of step 103 in the aforementioned embodiment, and will not be repeated here.

[0111] Step 204: execute the test case, and perform a performance evaluation on the target file package based on the execution result of the test case to obtain a performance evaluation value.

[0112] When evaluating the performance of a target file package, factors such as whether the test case execution results meet expectations, whether test failures occur during the test case execution process, and the duration of the test case execution can be used as reference for performance evaluation. These reference factors can be adjusted based on the actual application scenario and testing requirements, but are not limited to these.

[0113] After obtaining the performance evaluation value, the file package can be managed and updated based on it.

[0114] Step 205 : Based on the performance evaluation value, when it is determined that the evaluation performance of the target file package does not meet the set standard, the target file package is removed from the file package set.

[0115] Step 206 : When it is determined that the evaluation performance of the target file package meets the set standard by combining the performance evaluation value and the historical performance evaluation value of the target file package, the target file package is solidified locally on the platform.

[0116] When the performance evaluation value of a file package is not ideal, the file package can be removed to improve the usability and usage effect of the platform tool.

[0117] When the current performance evaluation value of a file package is good and its historical performance evaluation results are also good, it can be solidified into the test platform to achieve the reuse rate and usage efficiency of the file package and improve the convenience and intelligence of the platform.

[0118] In this embodiment, the test platform obtains file packages developed by users that can generate test data, so that different file packages have the function of generating interface test data required by different functional systems, avoiding discrepancies in rule agreements or interface definitions, realizing the sharing of file packages, ensuring the automatic generation of test cases in the automation platform tools, and at the same time realizing the management and effective reuse of file packages generated by different platform users, thereby improving the functional diversification and test automation performance of the test platform, ensuring the normal progress of testing work, and improving efficiency.

[0119] See also Figure 3 , Figure 3This is a structural diagram of a test case generation device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown.

[0120] The test case generating device 300 includes:

[0121] The acquisition module 301 is used to download file packages matching the file package information entered by different platform users from the data warehouse to the platform to form a file package set; wherein the file package includes executable code for generating test data according to the set test requirements;

[0122] The parameter setting module 302 is used to select a target file package from the file package set based on the target test requirement file, and embed the output parameters of the executable code in the target file package into the test case generation template;

[0123] The test case generation module 303 is configured to run the target file package and generate a test case based on a test case generation template embedded with the output parameters.

[0124] The parameter setting module 302 is specifically configured to:

[0125] Parse the target test requirement file to obtain the target test requirements of the object to be tested;

[0126] Providing a test case writing page, wherein the test case writing page displays the file packages in the file package set and a function description of each file package in generating test data according to the set test requirements;

[0127] Obtaining a candidate file package selected externally from the test case writing page based on the object to be tested;

[0128] Based on the target test requirement, when it is determined that the set test requirement according to which the function of the candidate file package generates test data is consistent with the target test requirement, the candidate file package is determined as the target file package.

[0129] The parameter setting module 302 is further configured to:

[0130] Based on the target test requirements, when it is determined that the set test requirements followed by the function of the candidate file package to generate test data are inconsistent with the target test requirements, a file package reselection prompt message is output in the test case writing page until the set test requirements followed by the function of the candidate file package to generate test data are consistent with the target test requirements.

[0131] The acquisition module 301 is specifically configured to:

[0132] Setting a test sample template in the platform for use by a user of the platform;

[0133] Obtaining the file package information entered by different platform users, wherein the file package information includes a storage address of the file package in a data warehouse or key feature information of the file package;

[0134] Based on the file package information, download the file packages that match the file package information from the data warehouse to the platform to form a file package set;

[0135] The file package is generated by the platform user based on the test sample template and then uploaded to the data warehouse.

[0136] The test case generation module 303 is specifically used to:

[0137] Running the target file package to generate target test data according to set test requirements through the executable code in the target file package;

[0138] The target test data is assigned to the output parameter embedded in the test case generation template, and the test case generation template embedded with the output parameter is run to generate a test case.

[0139] The device also includes an evaluation module for:

[0140] Execute the test case, and based on the execution result of the test case, perform a performance evaluation on the target file package to obtain a performance evaluation value; based on the performance evaluation value, when it is determined that the evaluation performance of the target file package does not meet the set standard, remove the target file package from the file package collection.

[0141] The evaluation module is further configured to combine the performance evaluation value and the historical performance evaluation value of the target file package, and when it is determined that the evaluation performance of the target file package meets the set standard, solidify the target file package locally on the platform.

[0142] The test case generation device provided in the embodiment of the present application can implement each process of the embodiment of the above-mentioned test case generation method and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0143] Figure 4 4 is a structural diagram of a computer device provided in an embodiment of the present application. As shown in the figure, the computer device 4 of this embodiment includes: at least one processor 40 ( Figure 4Only one is shown), a memory 41 and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps of any of the above-mentioned method embodiments when executing the computer program 42.

[0144] The computer device 4 can be a desktop computer, a notebook computer, a PDA, a cloud server or other computing devices. The computer device 4 can include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that Figure 4 It is only an example of the computer device 4 and does not constitute a limitation of the computer device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0145] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0146] The memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. The memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the computer device 4. Furthermore, the memory 41 may include both an internal storage unit of the computer device 4 and an external storage device. The memory 41 is used to store the computer program and other programs and data required by the computer device. The memory 41 may also be used to temporarily store data that has been output or is about to be output.

[0147] The server can be a stand-alone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0148] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.

[0149] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0150] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0151] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0152] In the embodiments provided in this application, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0154] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0155] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0156] The present application implements all or part of the processes in the above-mentioned embodiment method, and can also be implemented through a computer program product. When the computer program product runs on a terminal, the terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0157] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A method for generating a test case, characterized in that: include: Setting the test sample template in the platform for use by the platform user; Obtaining file package information entered by different platform users, wherein the file package information includes a storage address of the file package in a data warehouse or key feature information of the file package; Based on the file package information, a file package matching the file package information is downloaded from the data warehouse to the platform locally to form a file package set; wherein the file package includes executable code for generating test data in accordance with the set test requirements; the executable code is the data generation code for the corresponding interface test requirements written by different platform users based on the test sample template and the business attributes of their own personalized functional modules; The file package information is recorded after different platform users upload the compiled file packages to the data warehouse; the data warehouse is used to collect the file packages uploaded by different platform users so that the automation platform can download and import the file packages and automatically generate test cases in the automation platform; Based on the target test requirement file, a target file package is selected from the file package set, and output parameters of the executable code in the target file package are embedded into the test case generation template; the executable code in the target file package is used to generate data required for interface testing corresponding to the business attributes of the personalized function module; The target file package is run to generate a test case based on a test case generation template embedded with the output parameter.

2. The method according to claim 1, characterized in that The step of selecting a target file package from the file package set based on the target test requirement file includes: Parse the target test requirement file to obtain the target test requirements of the object to be tested; Providing a test case writing page, wherein the test case writing page displays the file packages in the file package set and a function description of each file package in generating test data according to the set test requirements; Obtaining a candidate file package selected externally from the test case writing page based on the object to be tested; Based on the target test requirement, when it is determined that the set test requirement according to which the function of the candidate file package generates test data is consistent with the target test requirement, the candidate file package is determined as the target file package.

3. The method according to claim 2, characterized in that After obtaining the candidate file package selected externally from the test case writing page based on the object to be tested, the method further includes: Based on the target test requirements, when it is determined that the set test requirements followed by the function of the candidate file package to generate test data are inconsistent with the target test requirements, a file package reselection prompt message is output in the test case writing page until the set test requirements followed by the function of the candidate file package to generate test data are consistent with the target test requirements.

4. The method according to claim 1, wherein The step of running the target file package and generating a test case based on a test case generation template embedded with the output parameter includes: Running the target file package to generate target test data according to set test requirements through the executable code in the target file package; The target test data is assigned to the output parameter embedded in the test case generation template, and the test case generation template embedded with the output parameter is run to generate a test case.

5. The method according to claim 1, wherein The step of running the target file package and generating a test case template based on the test case embedded with the output parameter, after generating the test case, further includes: Executing the test case, and performing a performance evaluation on the target file package based on the execution result of the test case to obtain a performance evaluation value; When it is determined based on the performance evaluation value that the evaluation performance of the target file package does not meet a set standard, the target file package is removed from the file package set.

6. The method according to claim 5, characterized in that The method further includes executing the test case, and performing a performance evaluation on the target file package based on the execution result of the test case to obtain a performance evaluation value. In combination with the performance evaluation value and the historical performance evaluation value of the target file package, when it is determined that the evaluation performance of the target file package meets the set standard, the target file package is solidified locally on the platform.

7. A test case generation device, characterized in that: include: An acquisition module, configured to set the test sample template in the platform for use by the platform user; Obtain file package information entered by different platform users, wherein the file package information includes the storage address of the file package in the data warehouse or the key feature information of the file package; based on the file package information, download the file package matching the file package information from the data warehouse to the platform locally to form a file package set; wherein the file package includes executable code for generating test data according to the set test requirements; the executable code is the data generation code for the corresponding interface test requirements written by different platform users based on the test sample template and the business attributes of their own personalized functional modules; The file package information is recorded after different platform users upload the compiled file packages to the data warehouse; the data warehouse is used to collect the file packages uploaded by different platform users so that the automation platform can download and import the file packages and automatically generate test cases in the automation platform; A parameter setting module is used to select a target file package from the file package set based on the target test requirement file, and embed the output parameters of the executable code in the target file package into the test case generation template; the executable code in the target file package is used to generate data required for interface testing corresponding to the business attributes of the personalized function module; The test case generation module is used to run the target file package and generate a test case based on a test case generation template embedded with the output parameters.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for automatically generating testing cases

    CN104123227A

  • Test data generation method and device, computer equipment and storage medium

    CN111008122A

  • Test method, device and equipment

    CN113157583A