Data processing method, device, server and storage medium

By automatically generating and optimizing test cases with rule bases and unstructured databases in the server, the problem of inefficiency of software testing is solved, automated testing is realized, saving human resources and improving testing efficiency.

CN114416565BActive Publication Date: 2025-05-16BEIJING KNOWNSEC INFORMATION TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210065924.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-20
Publication Date
2025-05-16
Estimated Expiration
2042-01-20

AI Technical Summary

Technical Problem

The existing software testing process requires manual operation and is inefficient.

Method used

Automatically generate test cases by using rule bases and unstructured databases in the server, and generate target use cases through merges, optimizations, and data fills to achieve automated testing.

Benefits of technology

No manual participation is required, saving human resources and improving software testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416565B_ABST
    Figure CN114416565B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a data processing method, device, server and storage medium, which relates to the field of software technology and is applied to a server, wherein the server includes a rule base and an unstructured database, and the method includes: obtaining target information in a written program, wherein the target information includes first target information and second target information; generating a first test case according to preset rules in the rule base and the first target information, wherein the rule base is obtained based on rule model training; generating a second test case based on the unstructured database and the second target information; merging the first test case and the second test case, optimizing the merged test case to obtain an optimized test case; and filling the optimized test case with data to obtain a target case. The data processing method can improve the efficiency of software testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software technology, and in particular to a data processing method, device, server and storage medium. Background Art

[0002] After each program or software is written, it needs to be tested and adjusted to ensure that the program or software can run normally.

[0003] However, in the current software testing process, many places require dedicated operators to perform manual operations on site to complete the entire software testing work, which is inefficient. Summary of the invention

[0004] In order to solve the above problems, the present invention provides a data processing method, device, server and storage medium to at least partially solve the technical problem of low testing efficiency of the above software.

[0005] The embodiments of the present invention can be implemented as follows:

[0006] In a first aspect, the present invention provides a data processing method, applied to a server, wherein the server includes a rule base and an unstructured database, and the method includes:

[0007] Acquire target information in the written program, wherein the target information includes first target information and second target information;

[0008] Generate a first test case according to the preset rules in the rule base and the first target information, wherein the rule base is obtained based on rule model training;

[0009] Generate a second test case based on the unstructured database and the second target information;

[0010] Merging the first test case and the second test case, and optimizing the merged test case to obtain an optimized test case;

[0011] The optimized test case is filled with data to obtain a target test case.

[0012] Optionally, the unstructured database stores original keywords, the second target information includes API documents, and the generating a second test case based on the unstructured database and the second target information includes:

[0013] Extract target keywords from the API document based on Chinese word segmentation, word frequency statistics, and document retrieval;

[0014] Comparing the target keyword with the original keyword in the unstructured database and removing duplicates;

[0015] The second test case is obtained by integrating, comparing and removing duplicate keywords.

[0016] Optionally, the server further includes a semi-structured database, and the semi-structured database further stores a text file, and the step of filling the optimized test case with data to obtain a target test case includes:

[0017] Read the text file;

[0018] Acquire data meeting preset requirements from the text file based on element notation and / or field name search method;

[0019] Fill the data that meets the preset requirements into the optimized test case to obtain the target test case.

[0020] Optionally, after filling the optimized test case with data to obtain a target test case, the method further includes:

[0021] Apply the target use case to execute the target task, and assert the execution result of the target use case;

[0022] Mark the target test cases that have asserted successfully as passed.

[0023] Optionally, the method further comprises:

[0024] If the assertion fails, determine whether the target use case where the assertion fails is an abnormal target use case based on the preset exception rules;

[0025] If so, re-execute the target task using the abnormal target use case, and assert the execution result of the abnormal target use case;

[0026] If the re-execution is successful within the preset number of times, the abnormal case is marked as passed;

[0027] If not, then after re-executing the preset number of times, stop re-executing the target task.

[0028] Optionally, the server further includes a defect platform, and the method further includes:

[0029] If the target use case where the assertion fails is not the abnormal use case, marking the target use case where the assertion fails as a defective target use case;

[0030] The execution result of the defect target use case is imported into the defect platform according to the preset template.

[0031] Optionally, after applying the target use case to perform the target task, the method further includes:

[0032] Collecting statistics on the execution results of the target use cases for which the assertion succeeds and the target use cases for which the assertion fails;

[0033] A test report is generated for the statistical results, and the test report is sent to the terminal device.

[0034] In a second aspect, the present invention provides a data processing device applied to a server, wherein the server includes a rule base and an unstructured database, and the data processing device includes:

[0035] A target information acquisition unit, used to acquire target information in the compiled program, wherein the target information includes first target information and second target information;

[0036] A first test case generating unit, configured to generate a first test case according to a preset rule in the rule base and the first target information, wherein the rule base is obtained based on rule model training;

[0037] A second test case generating unit, configured to generate a second test case based on the unstructured database and the second target information;

[0038] A test case merging unit, used for merging the first test case and the second test case, and optimizing the merged test case to obtain an optimized test case;

[0039] The data filling unit is used to fill the optimized test case with data to obtain a target test case.

[0040] In a third aspect, the present invention provides a server, 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 any one of the above methods when executing the program.

[0041] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a computer program, and when the computer program is executed, the server where the computer-readable storage medium is located is controlled to implement the steps of any one of the above methods.

[0042] The beneficial effects of the embodiments of the present invention include, for example:

[0043] The first test case is automatically generated based on the rule base obtained through rule model training and the target information obtained from the written program; the second test case is automatically generated based on the unstructured database and the second target information; and then the first test case and the second test case are merged and optimized to obtain the optimized test case. No human intervention is required throughout the process, which saves human resources and improves the efficiency of software testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0045] Figure 1 A schematic diagram of the structure of a server provided in an embodiment of the present invention;

[0046] Figure 2 A flowchart of a data processing method provided by an embodiment of the present invention;

[0047] Figure 3 A sub-step flow chart of a data processing method provided by an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the structure of a data processing device provided by an embodiment of the present invention.

[0049] Icon: 100 - server; 110 - memory; 120 - processor; 130 - communication module; 300 - data processing device; 301 - target information acquisition unit; 302 - first test case generation unit; 303 - second test case generation unit; 304 - test case merging unit; 305 - data filling unit. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0051] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0053] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0054] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0055] Please refer to Figure 1 , is a block diagram of a server 100 provided by the present application, including a memory 110, a processor 120 and a communication module 130. The memory 110, the processor 120 and the communication module 130. Each component is directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0056] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0057] The processor 120 is used to read / write data or programs stored in the memory and execute corresponding functions.

[0058] The communication module 130 is used to establish a communication connection between the server and other communication terminals through the network, and to send and receive data through the network.

[0059] It should be understood that Figure 1The structure shown is only a schematic diagram of the structure of the server 100. The server 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown, for example, the server 100 may also include an unstructured database, a semi-structured database, a rule base, and the like. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0060] A test case is a description of a test task for a specific software product, reflecting the test plan, method, technology and strategy. Its content includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., and finally forms a document. In simple terms, a test case is a set of test inputs, execution conditions and expected results compiled for a specific goal, used to verify whether a specific software requirement is met.

[0061] The data processing method provided by the embodiment of the present invention can be applied to various software product testing scenarios.

[0062] See also Figure 2 , Figure 2 The data processing method provided in this embodiment includes the following steps:

[0063] Step S110: Acquire target information in the written program, wherein the target information includes first target information and second target information;

[0064] Step S120: generating a first test case according to the preset rules in the rule base and the first target information, wherein the rule base is obtained based on rule model training;

[0065] Step S130: generating a second test case based on the unstructured database and the second target information;

[0066] Step S140: merging the first test case and the second test case, and optimizing the merged test case to obtain an optimized test case;

[0067] Step S150: Fill the optimized test case with data to obtain a target test case.

[0068] In step S110, the target information may be the name of the product, the interface path of the transmission, the input parameter, the output parameter, the sample data, etc. In an optional implementation, the target information may be divided into the first target information and the second target information according to the purpose. After the program coding is completed, the user submits the target information of the program from the terminal to the server, and the server receives the target information through the interface.

[0069] In step S120, the rule base is an information set containing rules that can automatically generate automated test cases for single scenarios and mixed scenarios. Before generating the first test case, the rule base can be trained through the rule model, so that the rule base receives training data through the API interface, performs content analysis on the training data, and identifies effective and potentially useful rules from a large amount of data to obtain a rule base that meets the requirements.

[0070] The first target information can be the product name, the transmission interface path, and the input parameter. The rule library stores a variety of preset rules. When generating the first test case each time, the specific rules to be used can be pre-set by the staff according to the actual situation. For example: call the rule library, find the parameter values ​​of the requested key and type from the input parameters, parse the final key parameters through equivalence class, boundary value and other analysis methods, and finally generate one or more first test cases in the preset format.

[0071] In addition to generating the first test case, the server may also generate a second test case through the unstructured database and the second target information. The second test case may be generated in a manner different from the first test case.

[0072] Optionally, the unstructured database stores original keywords, and the second target information includes API documents. Based on the unstructured database and the second target information, a second test case is generated, including: extracting target keywords from the API documents based on Chinese word segmentation, word frequency statistics and document retrieval; comparing and removing duplicates of the target keywords with the original keywords in the unstructured database; and integrating the compared and removed duplicate keywords to obtain a second test case.

[0073] Pre-generated keyword data, i.e., original keywords, are stored in the unstructured database. The second target information may include an API (Application Programming Interface) document. After receiving the second target information, the target keyword may be extracted from the API document in the second target information based on Chinese word segmentation technology, word frequency statistics technology, document retrieval and other technical methods. After obtaining the target keyword, the target keyword is compared with the original keyword in the unstructured database, and the duplicated parts are removed to obtain one or more second test cases.

[0074] After obtaining the first test case and the second test case, the two test cases can be merged and compared, redundant and repeated test cases in the two test cases can be removed, and the remaining two test cases can be optimized to obtain one or more optimized test cases.

[0075] After obtaining the optimized test case, in order to test it, it is necessary to fill the optimized test case with data and finally obtain the target test case.

[0076] Optionally, the server also includes a semi-structured database, which also stores text files, and fills the optimized test cases with data to obtain target test cases, including: reading the text files; obtaining data that meets preset requirements from the text files based on element tagging and / or field name search methods; filling the data that meets the preset requirements into the optimized test cases to obtain the target test cases.

[0077] In the server, a semi-structured database can be set up, which can contain text files in formats such as CSV, log, XML, JSON, etc. After obtaining the optimized test case, the text file in the semi-structured database is read, and then the data that meets the preset requirements is searched from the text file by element tagging and / or field name search method, and the optimized test case is filled in to obtain the target test case.

[0078] For example: the format of an optimization test case is "name: (); keyword: (). The data corresponding to "name" and the data corresponding to "keyword" can be found from the text file through element tagging and / or field name search method, and finally filled into the optimization test case to obtain the target case.

[0079] In an optional embodiment, if suitable data for filling cannot be found in the semi-structured database, an unstructured database may be called to obtain data that meets preset requirements from the unstructured database to fill the optimized test case.

[0080] Optionally, after filling the optimized test case with data to obtain the target test case, the data processing method provided by the embodiment of the present invention may further include: Figure 3 The following sub-steps are shown:

[0081] Sub-step S151: applying the target use case to execute the target task, and asserting the execution result of the target use case;

[0082] Sub-step S152: Mark the target use case that succeeded in the assertion as tested as passed.

[0083] After obtaining the target use case, the server can automatically generate the target task according to the cron expression in the target use case. The server applies the target use case to execute the target task and asserts the execution result of the target use case before the execution result comes out.

[0084] If the execution result of the target use case meets the assertion, the target use case is marked as passed, indicating that the assertion of the target use case is successful. The state value of the target use case can also be changed to indicate that the assertion of the target use case is successful.

[0085] In the embodiments provided in this specification, when the target use case executes the target task, some problems other than the target use case itself may occur, such as mechanical failure, etc. If the assertion fails due to these reasons (the execution result of the target use case does not meet the assertion), the server will determine whether the target use case that failed the assertion is an abnormal use case, wherein the abnormal rule can be to detect whether the target task or device has an abnormality. Other target use cases except the abnormal target use case that failed the assertion can be marked as defective target use cases.

[0086] For an abnormal target use case, the server can re-execute the target task, or regenerate a new target task, apply the abnormal target use case to execute the new target task, and re-assert. If the execution result of the abnormal target use case meets the assertion within the preset number of retries, the status value of the abnormal target use case is changed to pass, or the test is marked as passed; if the abnormal use case is still judged as an abnormal use case after exceeding the preset number of retries, the target task will not be re-executed.

[0087] For defect target use cases, the server can call the defect platform to import the execution results of the defect target use cases into the defect platform according to the preset template so that the technicians can view them.

[0088] As an optional embodiment, the preset template may be as shown in the following table:

[0089] type state Priority Solution Result Label Severity

[0090] After all target use cases have completed the target tasks and obtained the execution results, the server can obtain the final test report based on the execution of the target tasks by all target use cases. The report can include the number of successful and failed assertions of target use cases, including how many of the target use cases with failed assertions are abnormal target use cases, how many are defective target use cases, etc., and the defect types of defective target use cases can be classified, and the causes of defects can be preliminarily analyzed. After the test report is output, it can be sent to PCs, mobile devices and other terminals through emails, text messages, etc., so that relevant personnel can view it.

[0091] Based on the same inventive concept, Figure 4 As shown, an embodiment of the present invention further provides a data processing device 300, which is applied to a server, the server includes a rule base and an unstructured database, and the data processing device 300 includes:

[0092] The target information acquisition unit 301 is used to acquire the target information in the written program, where the target information includes the first target information and the second target information;

[0093] A first test case generating unit 302 is used to generate a first test case according to a preset rule in a rule base and first target information, wherein the rule base is obtained based on rule model training;

[0094] A second test case generating unit 303, configured to generate a second test case based on the unstructured database and the second target information;

[0095] A test case merging unit 304 is used to merge the first test case and the second test case, and optimize the merged test case to obtain an optimized test case;

[0096] The data filling unit 305 is used to fill the optimized test case with data to obtain a target test case.

[0097] Regarding the above-mentioned data processing device 300, the specific functions of each unit therein have been described in detail in the embodiment of the data processing method provided in this specification, and will not be elaborated here.

[0098] Based on the same inventive concept, an embodiment of the present invention specification provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of any method of the above-mentioned data processing method are implemented.

[0099] By adopting the above solution in the embodiment of the present invention, the following effects can be achieved at least in part:

[0100] The first test case is automatically generated based on the rule base obtained through rule model training and the target information obtained from the written program; the second test case is automatically generated based on the unstructured database and the second target information; and then the first test case and the second test case are merged and optimized to obtain an optimized test case. In the process of case generation, no human participation is required, which saves human resources and improves the efficiency of software testing.

[0101] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0103] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0104] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data processing method, characterized in that: The method is applied to a server, wherein the server includes a rule base, a semi-structured database and an unstructured database, wherein the unstructured database stores original keywords, and the semi-structured database also stores text files. The rule base is an information set including rules for generating test cases in single scenarios and mixed scenarios, and the rule base is obtained based on rule model training. The method includes: Obtain target information in the written program, the target information including first target information and second target information; the first target information includes product name, transmission interface path, and input parameters, and the second target information includes API documentation; Generate a first test case according to the preset rules in the rule base and the first target information, including: calling the rule base, finding the parameter values ​​of the requested key and type from the input parameters, parsing the key parameters by an equivalence class analysis method or a boundary value analysis method, and generating a first test case in a preset format; Based on the unstructured database and the second target information, a second test case is generated, including: extracting target keywords from the API document based on Chinese word segmentation, word frequency statistics, and document retrieval; comparing and removing duplicates of the target keywords with the original keywords in the unstructured database; integrating the compared and removed duplicate keywords to obtain the second test case; Merging the first test case and the second test case, and optimizing the merged test case to obtain an optimized test case; Filling the optimized test case with data to obtain a target test case includes: reading the text file; obtaining data that meets preset requirements from the text file based on an element tagging method and / or a field name search method; and filling the data that meets the preset requirements into the optimized test case to obtain a target test case.

2. The data processing method according to claim 1, characterized in that: After filling the optimized test case with data to obtain the target test case, the method further includes: Apply the target use case to execute the target task, and assert the execution result of the target use case; Mark the target test cases that have asserted successfully as passed.

3. The data processing method according to claim 2, characterized in that: The method further comprises: If the assertion fails, determine whether the target use case where the assertion fails is an abnormal target use case based on the preset exception rules; If so, re-execute the target task using the abnormal target use case, and assert the execution result of the abnormal target use case; If the re-execution is successful within the preset number of times, the abnormal target use case is marked as passed; If not, then after re-executing the preset number of times, stop re-executing the target task.

4. The data processing method according to claim 3, characterized in that: The server further includes a defect platform, and the method further includes: If the target use case where the assertion fails is not the abnormal target use case, marking the target use case where the assertion fails as a defective target use case; The execution result of the defect target use case is imported into the defect platform according to the preset template.

5. The data processing method according to any one of claims 2 to 4, characterized in that: After applying the target use case to perform the target task, the method further includes: Collecting statistics on the execution results of the target use cases for which the assertion succeeds and the target use cases for which the assertion fails; A test report is generated for the statistical results, and the test report is sent to the terminal device.

6. A data processing device, characterized in that: The invention is applied to a server, wherein the server includes a rule base, a semi-structured database and an unstructured database, wherein the unstructured database stores original keywords, and the semi-structured database also stores text files. The rule base is an information set including rules for generating test cases in single scenarios and mixed scenarios, and the rule base is obtained based on rule model training; and the data processing device includes: A target information acquisition unit, used to acquire target information in the written program, wherein the target information includes first target information and second target information; the first target information includes a product name, a transmission interface path, and input parameters, and the second target information includes an API document; A first test case generating unit is used to generate a first test case according to the preset rules in the rule base and the first target information, including: calling the rule base, finding the parameter values ​​of the requested key and type from the input parameters, parsing the key parameters by an equivalence class analysis method or a boundary value analysis method, and generating a first test case in a preset format; A second test case generating unit is used to generate a second test case based on the unstructured database and the second target information, including: extracting target keywords from the API document based on Chinese word segmentation, word frequency statistics and document retrieval; comparing and removing duplicates of the target keywords with the original keywords in the unstructured database; integrating the compared and removed keywords to obtain the second test case; A test case merging unit, used for merging the first test case and the second test case, and optimizing the merged test case to obtain an optimized test case; A data filling unit is used to fill the optimized test case with data to obtain a target test case, including: reading the text file; obtaining data that meets the preset requirements from the text file based on element tagging and / or field name search method; filling the data that meets the preset requirements into the optimized test case to obtain a target test case.

7. A server, characterized in that: include: 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 according to any one of claims 1 to 5 when executing the program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a computer program, and when the computer program is executed, the server where the computer-readable storage medium is located is controlled to implement the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test case recommendation method and device and electronic equipment

    CN112416778A

  • Big data test case generation method and device

    CN112988603A

  • Test case design method and device, equipment and readable storage medium

    CN113886222A