Data management method and system for software automatic testing
By using the method of interface encapsulating, code parameter setting and classified storage of use case data in software automation testing, the problem of poor use case data management is solved, comprehensive, effective and unified data management is achieved, and the efficiency of use case maintenance and management is improved.
Patent Information
- Application Number
- CN202411573142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-28
AI Technical Summary
During the software automation testing process, it is difficult for the existing technology to effectively manage use case data, resulting in incomplete data, ineffective and inconsistent format.
By encapsulating the interface used for testing into a callable program block, setting code parameters, generating the use case suite, it is stored in the use case management library, and classified storage and indexing are performed according to the preset use case classification rules.
It realizes comprehensive, effective and unified format management of use case data, making use case maintenance and management more scientific, fast and effective.
Smart Images

Figure CN119537218A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to a data management method and system for software automated testing. Background Art
[0002] Software automation testing refers to the process of using automation tools and scripts to perform test tasks. It allows computers to perform repetitive and tedious test tasks, aiming to improve test efficiency, reduce test costs, and increase test coverage and accuracy. Software automation testing can significantly improve test efficiency, reduce human errors, make tests more accurate and repeatable, and thus save manpower, time, and hardware resources. In the process of software automation testing, test data needs to be managed uniformly and effectively, especially the management of use case data is the top priority of data management. Summary of the invention
[0003] The main technical problem solved by this application is to optimize the management of use case data to ensure that comprehensive, effective and uniformly formatted use case data is obtained during the automated testing process.
[0004] According to the first aspect, an embodiment provides a data management method for software automated testing, comprising: Encapsulate the interface used for testing to obtain a program segment that can call the interface; the program segment includes a function and / or a class, the function is a code block that can execute a preset task, and the class is a predefined reference data type; Setting code parameters of the program segment; the code parameters include function parameters, method parameters, command line parameters, configuration file parameters, environment variable parameters, constant parameters and / or default parameters; Writing the program segment into a use case program to be executed and then packaging it to obtain a use case suite; The use case suite is stored in a use case management library; the use case management library is used to classify, store and index the use case program according to a preset use case classification rule; wherein the use case classification rule is based on the business object of the use case, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type.
[0005] In one embodiment, the data management method further includes: Selecting and calling a use case program in the use case suite in the use case management library, and executing the use case program; The test report generated by executing the use case program is stored in the use case management library for retrieval and / or display.
[0006] In one embodiment, the use case management library includes: The api address module is used to save the path and format of the interface used for testing; Business method module, used to store business-related use case programs; Public method module, used to store use case programs that are not related to the business; The complex assertion module is used to store use case programs related to assertion judgment values.
[0007] In one embodiment, the business method module includes a simple business flow module and a complex business flow module, the complex business flow module is used to store the use case program including the front-end process encapsulation, and the use case program is executed in the browser opening and use case project initialization steps; the simple business flow module is the use case program that does not include the front-end process encapsulation; The public method module is used to store the use case program in json format.
[0008] In one embodiment, the use case management library further includes: The database calling method module is used to store the use case programs classified according to the database calling method.
[0009] In one embodiment, the use case management library further includes: An interface parameter storage module, used for storing the use case programs classified according to interface parameters; Other parameter storage module, used for storing the use case programs classified according to other preset configuration parameters except interface parameters; The complex parameter storage module is used to store the use case programs classified according to preset specified configuration parameters.
[0010] In one embodiment, the use case management library further includes: The report and log module is used to store the test report and / or log generated by executing the use case program.
[0011] According to the second aspect, an embodiment provides a computer-readable storage medium, on which a program is stored, and the program can be executed by a processor to implement the method described in the first aspect.
[0012] According to the third aspect, an embodiment provides a data management system for applying the data management method according to the first aspect, the data management system comprising: A use case generation unit, used to write the interface for testing into a program segment that can call the interface, and package the program segment into a use case program to be executed after setting code parameters, so as to obtain a use case suite; the use case generation unit is also used to store the use case suite in a use case management library, and the use case management library is used to classify, store and index the use case programs according to a preset use case classification rule; wherein the use case classification rule is based on the business object of the use case, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type; A use case execution unit, configured to select and call a use case program in the use case suite from the use case management library for execution, and store a test report generated by executing the use case program in the use case management library; A report display unit is used to retrieve and display the test report and / or log report.
[0013] According to the fourth aspect, an embodiment provides a computer program product, including a computer program and / or instructions, characterized in that when the computer program and / or instructions are executed by a processor, the data management method described in the first aspect is implemented.
[0014] According to the data management method of the above embodiment, the use cases are classified according to their business objects, interface encapsulation methods, use case purposes, use case calling methods, configuration environment settings and / or log report types, making the maintenance and management of use cases more scientific, faster and more effective. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic diagram of a flow chart of a data management method in an embodiment; Figure 2 A schematic diagram of a functional module of a use case management library in an embodiment; Figure 3 A structural block diagram of a data management system in an embodiment; Figure 4 The figure is a schematic diagram showing the functional modules of a use case management library in an embodiment. DETAILED DESCRIPTION
[0016] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0017] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0018] The serial numbers assigned to the components herein, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0019] A test case is a set of inputs, operation steps and expected results, which is used to guide the execution of the test and ensure the quality and stability of the software. Test cases are the core of software testing work. They are a set of standards for input and output during testing, corresponding to the specific control of software requirements. Test cases include basic items such as test case number, test item, test title, importance level, preconditions, input, operation steps and expected results. The role of test cases includes verifying whether the software meets customer requirements, showing the design ideas of test cases, and serving as a standard for implementing tests and preventing missed tests. A test instance is an example of specific execution based on a test case, which shows how to apply the test case for actual operation. Test instances usually include specific operation steps and actual results, which are used to verify whether the validity of the test case is consistent with the actual situation of the software. The methods for writing test cases mainly include the design method based on requirements, that is, extracting test points from the requirements document and designing test cases. Specific methods include equivalence class partitioning, boundary value analysis, cause-effect diagram method, etc. The benefits of writing test cases include providing test basis, ensuring test repeatability, evaluating requirement coverage and accumulating test method ideas.
[0020] In the embodiments of the present application, a decoupled and layered approach is adopted to solve the high coupling of the automated use case process. Through complete layered planning of configuration, parameters, interfaces, file objects, use cases, and use case sets, the functions of each layer are independently encapsulated, independent of each other, easy to maintain and convenient to use.
[0021] Embodiment 1: Please refer to Figure 1 , is a flow chart of a data management method in an embodiment, the data management method is used to manage and maintain use cases in software automation testing, and specifically includes: Step 101, obtaining a program segment for calling an interface.
[0022] The interface used for testing is encapsulated to obtain a program segment that can call the interface, wherein the program segment includes a function and / or a class, a function is a code block that can execute a preset task, and a class is a predefined reference data type.
[0023] Step 102, preset parameters.
[0024] Set the code parameters of the program segment, which include function parameters, method parameters, command line parameters, configuration file parameters, environment variable parameters, constant parameters and / or default parameters.
[0025] Step 103: Obtain a use case suite.
[0026] The program segments are written into the use case program to be executed and then packaged to obtain the use case suite.
[0027] Step 104: Store the use case suite in the use case management library.
[0028] The use case management library is used to classify, store and index use case programs according to a preset use case classification rule. The use case classification rule is based on the business object, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type of the use case.
[0029] In one embodiment, the data management method further includes: Step 105, execute the use case program.
[0030] Select and call the use case program in the use case suite in the use case management library, and execute the use case program.
[0031] Step 106: Store the test report and log.
[0032] The test reports and logs generated by executing the use case program are stored in the use case management repository for retrieval and / or display.
[0033] Please refer to Figure 2, is a functional module diagram of a use case management library in an embodiment. In one embodiment, the use case management library 100 includes an api address module 10, a business method module 20, a public method module 30, a complex assertion module 40, a database call method module 50, an interface parameter storage module 60, an other parameter storage module 70 and a complex parameter storage module 80. The api address module 10 is used to save the path and format of the interface used for testing. The business method module 20 is used to store use case programs related to the business. The public method module 30 is used to store use case programs unrelated to the business. The complex assertion module 40 is used to store use case programs related to assertion judgment values. The database call method module 50 is used to store the use case programs classified according to the database call method. The interface parameter storage module 60 is used to store use case programs classified according to interface parameters. The other parameter storage module 70 is used to store use case programs classified according to other preset configuration parameters other than interface parameters. The complex parameter storage module 80 is used to store use case programs classified according to preset specified configuration parameters.
[0034] In one embodiment, the business method module includes a simple business flow module and a complex business flow module. The complex business flow module is used to store a use case program including a front-end process encapsulation. The use case program is executed in the browser opening and use case project initialization steps. In one embodiment, the simple business flow module is a use case program that does not include a front-end process encapsulation. The public method module is used to store a use case program in json format.
[0035] In one embodiment, the use case management library further includes a report and log module 90, and the report and log module 90 is used to store test reports and / or logs generated by executing the use case program.
[0036] Please refer to Figure 3 , is a structural block diagram of a data management system in an embodiment, which is used to apply the real data management method as described above, and includes a use case generation unit 1, a use case execution unit 2 and a report display unit 3. The use case generation unit 1 is used to write the interface for testing into the program segment of the callable interface, and set the code parameters of the program segment and package it into the use case program to be executed to obtain a use case suite. The use case generation unit 1 is also used to store the use case suite in the use case management library, and the use case management library is used to classify, store and index the use case program according to a preset use case classification rule. Among them, the use case classification rule is classified according to the business object, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type of the use case. The use case execution unit 2 is used to select and call the use case program in the use case suite in the use case management library for execution, and store the test report generated by executing the use case program in the use case management library. The report display unit 3 is used to retrieve and display the test report and / or log report.
[0037] Please refer to Figure 4 , is a schematic diagram showing the functional modules of the use case management library in an embodiment. The use case management library includes functional blocks such as business method module business, common method module common, complex assertion module modules_assert, database call method module modules_db, report and log module Reprt, environment configuration Config and execution module run. The environment configuration Config is used to store configurations for different environments, and tests can be run in multiple different engineering environments. In one embodiment, the functional modules of the use case management library also include interface base page_object, use case storage test_case, suite and management use case test_suite and interface base Page_object. Among them, the interface base page_object is a method encapsulation module for basic calls to the API interface, and the use case storage test_case is used for writing specific use case entries. The suite and management use case test_suite are modules for managing use cases in the use case storage test_case, which are similar to the relationship between files and folders.
[0038] The data management method and system disclosed in the embodiment of the present application first encapsulates the interface used for testing to obtain a program segment that can call the interface; then sets the code parameters of the program segment; then writes the program segment into the use case program to be executed and packages it to obtain a use case suite; finally, the obtained use case suite is stored in a use case management library, which is used to classify, store and index the use case program according to a preset use case classification rule. Since the use case classification rule is based on the business object of the use case, the interface encapsulation method, the use case purpose, the use case calling method, the configuration environment setting and / or the log report type, the maintenance and management of the use case is more scientific and faster.
[0039] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0040] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. A data management method for software automated testing, characterized in that: include: Encapsulate the interface used for testing to obtain a program segment that can call the interface; the program segment includes a function and / or a class, the function is a code block that can execute a preset task, and the class is a predefined reference data type; Setting code parameters of the program segment; the code parameters include function parameters, method parameters, command line parameters, configuration file parameters, environment variable parameters, constant parameters and / or default parameters; Writing the program segment into a use case program to be executed and then packaging it to obtain a use case suite; The use case suite is stored in a use case management library; the use case management library is used to classify, store and index the use case program according to a preset use case classification rule; wherein the use case classification rule is based on the business object of the use case, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type.
2. The data management method according to claim 1, characterized in that: Also includes: Selecting and calling a use case program in the use case suite in the use case management library, and executing the use case program; The test report generated by executing the use case program is stored in the use case management library for retrieval and / or display.
3. The data management method according to claim 2, characterized in that: The use case management library includes: The api address module is used to save the path and format of the interface used for testing; Business method module, used to store business-related use case programs; Public method module, used to store use case programs that are not related to the business; The complex assertion module is used to store use case programs related to assertion judgment values.
4. The data management method according to claim 3, characterized in that: The business method module includes a simple business flow module and a complex business flow module. The complex business flow module is used to store the use case program including the front-end process encapsulation, and the use case program is executed in the browser opening and use case project initialization steps; the simple business flow module is the use case program that does not include the front-end process encapsulation; The public method module is used to store the use case program in json format.
5. The data management method according to claim 4, characterized in that: The use case management library also includes: The database calling method module is used to store the use case programs classified according to the database calling method.
6. The data management method according to claim 4, characterized in that: The use case management library also includes: An interface parameter storage module, used for storing the use case programs classified according to interface parameters; Other parameter storage module, used for storing the use case programs classified according to other preset configuration parameters except interface parameters; The complex parameter storage module is used to store the use case programs classified according to preset specified configuration parameters.
7. The data management method according to claim 4, characterized in that: The use case management library also includes: The report and log module is used to store the test report and / or log generated by executing the use case program.
8. A computer-readable storage medium, characterized in that: The medium stores a program, and the program can be executed by a processor to implement the data management method according to any one of claims 1 to 7.
9. A data management system for software automated testing, characterized in that: Used to apply the data management method according to any one of claims 1 to 7, the data management system comprising: A use case generation unit is used to write the interface for testing into a program segment that can call the interface, and package the program segment into a use case program to be executed after setting code parameters, so as to obtain a use case suite; the use case generation unit is also used to store the use case suite in a use case management library, and the use case management library is used to classify, store and index the use case program according to a preset use case classification rule; wherein the use case classification rule is based on the business object of the use case, interface encapsulation method, use case purpose, use case calling method, configuration environment setting and / or log report type; A use case execution unit, configured to select and call a use case program in the use case suite from the use case management library for execution, and store a test report generated by executing the use case program in the use case management library; A report display unit is used to retrieve and display the test report and / or log report.
10. A computer program product comprising a computer program and / or instructions, characterized in that: When the computer program and / or the instructions are executed by a processor, the data management method according to any one of claims 1 to 7 is implemented.