CN115757149A - Automatic testing method, system, electronic equipment and storage medium - Google Patents

Automatic testing method, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN115757149A
CN115757149A CN202211469578.2A CN202211469578A CN115757149A CN 115757149 A CN115757149 A CN 115757149A CN 202211469578 A CN202211469578 A CN 202211469578A CN 115757149 A CN115757149 A CN 115757149A
Authority
CN
China
Prior art keywords
code
test
mapping relation
test case
case set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211469578.2A
Other languages
Chinese (zh)
Inventor
金凌云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lantu Automobile Technology Co Ltd
Original Assignee
Lantu Automobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lantu Automobile Technology Co Ltd filed Critical Lantu Automobile Technology Co Ltd
Priority to CN202211469578.2A priority Critical patent/CN115757149A/en
Publication of CN115757149A publication Critical patent/CN115757149A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention provides an automatic test method, a system, electronic equipment and a storage medium, wherein the automatic test method comprises the following steps: acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between a test case set and code segments in a target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code. According to the invention, the mapping relation between the test case set and the code segments in the target test code is established based on the compiling and instrumentation mode, the mapping relation is simplified based on the preset simplification strategy, and the target test code is tested based on the obtained optimal mapping relation, so that the whole test process is refined and controlled from the node level of the code segments, the test quality is ensured, the test cost is reduced, and the overall efficiency in the project development process is improved.

Description

Automatic testing method, system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of automated testing technologies, and in particular, to an automated testing method, an automated testing system, an electronic device, and a storage medium.
Background
The Test Case (Test Case) refers to the description of a Test task performed on a specific software product, and embodies Test schemes, methods, techniques and strategies. The contents of which include test objects, test environments, input data, test steps, expected results, test scripts, etc., ultimately forming a document. Simply considered, a test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to verify whether a particular software requirement is met. The test case mainly comprises four contents: case title, preconditions, test steps and expected results. The use case title mainly describes and tests a certain function; the precondition means that the case title needs to satisfy the condition; the test step mainly describes the operation steps of the use case; the expected result refers to meeting the expected (development specification, requirement document, user requirement, etc.) requirements.
With the continuous iteration of the project version, the number of test cases is continuously expanded, and the maintenance cost is increasingly increased. Before a new version is released, not only new functions need to be verified, but also the original functions need to be tested to determine whether the functions are normal, so that the testing time and cost are continuously increased, and therefore, how to further reduce the testing time and cost is a problem to be solved urgently.
Disclosure of Invention
The invention provides an automatic testing method, an automatic testing system, electronic equipment and a storage medium, aiming at the technical problems in the prior art, and aims to solve the problem of how to further reduce the testing time and cost.
According to a first aspect of the present invention, there is provided an automated testing method, comprising:
acquiring a target test code and a test case set corresponding to the target test code;
based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code;
simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation;
and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code.
On the basis of the technical scheme, the invention can be improved as follows.
Preferably, the step of establishing a mapping relationship between the test case set and code segments in the target test code based on a compiling and instrumentation manner includes:
extracting code segments of the target test code based on a preset code tree structure, and setting a corresponding counter at each extracted code segment inlet;
and sequentially operating each test case in the test case set, and establishing a mapping relation between the test case set and the code segments in the target test code according to the counting of the counter.
Preferably, the preset code tree structure includes: the code is divided into classes, methods, branch conditions and code segments according to the scope of code action.
Preferably, the step of simplifying the mapping relationship based on a preset reduction strategy to obtain an optimal mapping relationship includes:
acquiring case information of each test case in the mapping relation, wherein the case information comprises a unique identifier, hit times, priority, module BUG rate, coverage rate and/or version number;
and simplifying the mapping relation based on the use case information so that the mapping relation meets a preset simplification strategy to obtain an optimal mapping relation.
Preferably, the preset reduction policy includes:
the test coverage rate corresponding to the test cases in the mapping relation exceeds a preset coverage threshold value, and/or the average value of the priorities corresponding to the test cases in the mapping relation exceeds a preset priority threshold value, and/or the total running time length of the test cases in the mapping relation is smaller than a preset running time length threshold value.
Preferably, after the step of establishing a mapping relationship between the test case set and the code segments in the target test-providing code based on a compiling and instrumentation manner, the method further includes:
and storing the mapping relation into a database in a key-value structure, wherein the key is the unique identifier of the test case in the test case set, and the value is the node identifier set of the code segment.
Preferably, the step of selecting the corresponding test case set according to the optimal mapping relationship includes:
acquiring update information of a code segment in a current latest version of a test code, acquiring a node identifier of a corresponding code segment according to the update information, and selecting a corresponding test case set according to the node identifier, wherein the acquired node identifier is as follows: modifying on the basis of the original code segment to obtain the node identification of the original code segment; adding a code segment in the original method or branch to obtain the node identification of the corresponding father node; modifying on the basis of the original branch condition to obtain the node identification of the original branch condition; newly adding branch conditions, and acquiring the node identification of the corresponding father node; and adding a method and a class, and acquiring the node identification of the corresponding method and the node identification of the class.
According to a second aspect of the present invention, there is provided an automated test system comprising:
the data acquisition module is used for acquiring the target test code and the corresponding test case set;
the mapping construction module is used for establishing a mapping relation between the test case set and the code segments in the target test-promoting code based on a compiling and instrumentation mode;
the mapping simplification module is used for simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation;
and the automatic test module is used for selecting a corresponding test case set according to the optimal mapping relation and automatically testing the target extraction code.
According to a third aspect of the present invention, there is provided an electronic device, comprising a memory and a processor, wherein the processor is configured to implement the steps of any one of the automated testing methods of the first aspect when executing a computer management class program stored in the memory.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer management like program, which when executed by a processor, performs the steps of any of the automated testing methods of the first aspect described above.
The invention provides an automatic test method, a system, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code. According to the invention, the mapping relation between the test case set and the code segments in the target test code is established based on a compiling and instrumentation mode, the mapping relation is simplified based on a preset simplification strategy, and the target test code is tested based on the obtained optimal mapping relation, so that the whole test process is finely controlled from the node level of the code segments, and the test is carried out based on the optimal mapping relation between the code segments and the test case set, so that the test quality is ensured, the test time and the test cost are reduced, and the overall efficiency in the project development process is improved.
Drawings
FIG. 1 is a flow chart of an automated testing method provided by the present invention;
FIG. 2 is a diagram of a code tree structure provided by the present invention;
FIG. 3 is a schematic flow chart of a possible application scenario provided by the present invention;
FIG. 4 is a schematic structural diagram of an automated test system according to the present invention;
fig. 5 is a schematic diagram of a hardware structure of a possible electronic device provided in the present invention;
fig. 6 is a schematic diagram of a hardware structure of a possible computer-readable storage medium according to the present invention.
Detailed Description
The following detailed description of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Fig. 1 is a flowchart of an automated testing method provided by the present invention, and as shown in fig. 1, the method includes:
step S100: acquiring a target test code and a test case set corresponding to the target test code;
it should be noted that the main executing body of the method of this embodiment may be a computer terminal device having functions of data processing, network communication, and program execution, for example: computers, notebook computers, and the like; the cloud server may also be a server device having the same similar function, or may also be a cloud server having the similar function, which is not limited in this embodiment. For convenience of understanding, the present embodiment and the following embodiments will be described by taking a server apparatus as an example.
It can be understood that the target test-extracting code may be a project code submitted by a developer in a project team according to test-extracting requirements and specifications, or a project code actively pulled by a tester according to a test-extracting document provided by development, where the code is signed in advance to complete code compilation, static code scanning and unit test passing, and self-test is completed by the developer, and the target test-extracting code may be a project code of the latest version, or a project code of a past history version selected according to test requirements, which is not limited in this embodiment.
It should be understood that the test case set may be a set of test cases written by a tester for the target test code and the corresponding business logic, and the test cases in the test case set may include the test case written by the tester most recently or may include historical test cases, which is not limited in this embodiment.
It can also be understood that the case information of the test case includes: case id: uniquely identifying the use case; selecting count: hit frequency, in a version period, the frequency of hit of the use case is screened; priority: the priority level is marked by a development tester according to the priority level of each case function, and the more important the case function is, the higher the mark is; bugRate: the module bug rate is the frequency of the bug of the module corresponding to the use case according to the historical data; coverage: coverage rate, namely the code coverage rate after the use case runs, wherein the higher the coverage rate is, the more sufficient the use case tests the code; version: and the version number can be dynamically updated along with the change of the functions of the item, and the version number is used for recording the version of the item to which the item currently belongs.
Step S200: based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code;
it is understood that the above-mentioned manner of compiling instrumentation may be to modify existing code or newly generated code during code compilation, and the above-mentioned compiling instrumentation technology may be divided into two types from the time of modifying code: firstly, the java file is a java file, the java file is dynamically generated by intervening at the beginning of compiling, then a compiler compiles the generated java file into a class file, codes such as ButterKnife and Dagger are generated in the way, and the corresponding technology is mainly APT (association Process Tools Annotation processor); and the second byte code file is a byte code file, and is intervened after the class file is generated, so that the byte codes of the class file are directly modified, and the purpose of modifying the codes is achieved. Commonly used bytecode programming frameworks are AspectJ, javasist, ASM, etc.
Further, to further describe the step of establishing the mapping relationship in this embodiment, the step of establishing the mapping relationship between the test case set and the code segment in the target test code in this embodiment based on a compiling and instrumentation manner includes:
step S201: based on a preset code tree structure, carrying out code segment extraction on the target extraction code, and setting a corresponding counter at each extracted code segment inlet;
it can be understood that the preset code tree structure may be set in advance, and the preset code tree structure may refer to fig. 2, where fig. 2 is a schematic diagram of the code tree structure provided by the present invention; in fig. 2, the codes in the project can be firstly divided into: classes, methods, branch conditions, and code segments; the branch condition may be a branch condition defined by a branch determination statement such as if and while, each branch condition corresponds to a branch, and the branches may be included in each other; the code segment can be a group of continuous code statements in the method, only one entry statement and one exit statement are provided, no branch judgment condition exists in the middle, the code segment can be wrapped by the method, and if the method has the branch condition, the code segment can also be wrapped by the branch. Through compiler parsing and lexical analysis, the hierarchical relationship tree structure of the production class is the code tree structure in fig. 2.
It should be understood that the nodes in the tree structure described above may also be saved to the code tree table of the database using the following data structure:
Figure BDA0003958002320000071
Figure BDA0003958002320000081
in a specific implementation, counter logic can be embedded in the code segment entry, and in order to reduce the intrusiveness of the source code, the embodiment uses a compiling and instrumentation mode to embed the counter. The initial value in the counter is 0 and if the code segment is executed once, the counter is incremented by 1. The branch conditional statement need not be inserted into a counter because whether the branch was executed can be determined based on the method or included code segment to which the branch conditional statement belongs.
Step S202: and sequentially operating each test case in the test case set, and establishing a mapping relation between the test case set and the code segments in the target test-promoting code according to the counting of the counter.
In a specific implementation, each test case in the test case set is sequentially executed, a code segment or a branch condition with a counter value greater than 0 in the process is statistically analyzed after the execution is finished, a corresponding code node Id is searched in a code tree table in a database, and a corresponding mapping relation is established. And after the statistics is finished, obtaining the coverage rate value of the test case relative to all the codes, and updating the coverage rate value into a case information table in the database.
Further, in order to prevent data from being lost due to an abnormal condition, the mapping relationship between the test case and the code segments may be solidified, and the test case and the code segments are stored in a dictionary form, that is, the test case and code relationship dictionary takes case Id as key and value as a set of code node identifiers Id (where key is a unique identifier of the test case in the test case set and value is a set of node identifiers of the code segments), and in order to reduce the set, if all code segments in a method are executed, the method Id is used to replace the original code segment Id. And storing the dictionary into a use case code relation table in a database.
Step S300: simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation;
it is to be understood that the preset reduction policy may be selected by an administrator or a tester in advance according to a project test requirement, and the preset reduction policy may include a plurality of dimensions, where the plurality of dimensions include: selectionCount: in one version cycle, if the use case is screened to hit more than twice, then the current screening is abandoned for the use case. Priority: the higher the priority, the more should be screened for hits on BugRate: the higher the bug rate of the module, the more should be screened for hits in Coverage: the higher the code coverage, the more hits should be screened.
Furthermore, the test case set corresponding to the mapping relationship may be directly used for performing test verification on the target test code, but in actual production, the number of the test cases is still large, and the computer power and time required to be used are large, so that in order to further improve the test efficiency, the set needs to be simplified through the preset reduction strategy. Since the same code is likely to be covered by a plurality of use cases simultaneously, theoretically, the code can be fully tested by only selecting one of the use cases. The step of obtaining the optimal mapping relationship further includes:
step S301: acquiring use case information of each test use case in the mapping relation, wherein the use case information comprises: unique identification, hit times, priority, module BUG rate, coverage and/or version number;
step S302: and simplifying the mapping relation based on the use case information so that the mapping relation meets a preset simplification strategy to obtain an optimal mapping relation.
Further, the preset simplification policy includes: the test coverage rate corresponding to the test cases in the mapping relation exceeds a preset coverage threshold value, and/or the average value of the priorities corresponding to the test cases in the mapping relation exceeds a preset priority threshold value, and/or the sum of the running time lengths of the test cases in the mapping relation is smaller than a preset running time length threshold value.
In a specific implementation, the step of simplifying the mapping relationship based on the use case information is a multidimensional discrete manner, and in order to comprehensively quantify the screening efficiency, the simplified step can be converted into a mathematical problem manner, which is described as follows: given a code set CS { C1, C2.. Cn }, wherein a use case set corresponding to C1 is named as TC1S { T1C1, T2C1.. TnC1}, then the use case sets corresponding to the code set CS are { TC1S, T2S.. TCnS }, respectively. How to find a subset in the { TC1S, TC2S.. TCnS } set is solved, and the preset reduction strategy is met.
Further, the preset coverage threshold, the preset priority threshold and the preset operation time threshold may be set by a tester, and the preset coverage threshold may be set to be 60% to 85%; the preset priority threshold may be set to 80, the priority range of a single test case is 0-100, and when there are multiple test cases, the priority average of the multiple test cases is calculated (for example, when there are 1000 test cases at the same time, the priority sum of 1000 test cases is calculated first, and then divided by 1000 to obtain the priority average of the 1000 test cases); the preset operation time threshold may be set to 120 minutes; the number of the preset reduction strategies can also be selected by a tester according to test requirements, and a final simplified test case set, namely an optimal mapping relation, is obtained through calculation by using a greedy or dynamic programming algorithm.
Step S400: and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code.
In specific implementation, a simplified test case set is obtained, a test verification process can be performed, and the final test result is not a pure pass or fail test, but code coverage and uncovered incremental code information of the whole test process can be obtained additionally, so that the test result can be quantized more finely. In the embodiment, except for the design of newly added test cases and specified threshold values, one-time labor cost needs to be input, other processes do not need manual participation, and the full-automatic operation can be realized.
It can be understood that, based on the defects in the background art, the embodiment of the present invention provides an automated testing method, including: acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code. According to the invention, the mapping relation between the test case set and the code segments in the target test code is established based on the compiling and instrumentation mode, the mapping relation is simplified based on the preset simplification strategy, and the target test code is tested based on the obtained optimal mapping relation, so that the whole test process is finely controlled from the node level of the code segments, and the test is carried out based on the optimal mapping relation between the code segments and the test case set, so that the test quality is ensured, the test time and the test cost are reduced, and the overall efficiency in the project development process is improved. In the whole testing process, the invention starts from the code node level to carry out refined control, automatically recommends and simplifies the test case set, can carry out quantitative analysis on the test result, finally improves the code robustness and reduces the testing cost.
In a possible embodiment, the step of selecting a corresponding test case set according to the optimal mapping relationship includes:
step S401: acquiring update information of a code segment in a current latest version of a test code, acquiring a node identifier of a corresponding code segment according to the update information, and selecting a corresponding test case set according to the node identifier, wherein the acquired node identifier is as follows: modifying on the basis of the original code segment to obtain the node identification of the original code segment; adding a code segment in the original method or branch to obtain the node identification of the corresponding father node; modifying on the basis of the original branch condition to obtain a node identifier of the original branch condition; adding branch conditions, and acquiring the node identification of the corresponding father node; and adding a method and a class, and acquiring the node identification of the corresponding method and the node identification of the class.
In a specific implementation, after a new version of a project submits a test, a tester designs a new test case and adds the new test case to a case information table, and then the embodiment uses the latest source code library to automatically update a code tree table, a case information table and a case code relation table in a database. Comparing the position information of the new modified code with the original code, and inquiring a corresponding code node Id in a code tree table in a database, wherein the following conditions exist according to different code modification modes: modifying on the basis of the original code segment, and inquiring the node identification of the original code segment; adding a code segment in the original method or branch, and inquiring the node identification of the father node of the code segment; modifying on the basis of the original branch condition, and inquiring the node identification of the original branch condition; newly adding a branch condition, and inquiring the node identification of the father node of the branch condition; adding a method and a new class, and inquiring node identification of the corresponding method and node identification of the class; and inquiring the case code relation table to obtain all test case sets needing to be verified in the new version so as to realize automatic recommendation of the test case sets.
In a possible application scenario, referring to fig. 3, fig. 3 is a schematic flowchart of a possible application scenario provided by the present invention; in fig. 3, firstly, in the process of compiling a code in a project, a counter is implanted into each code segment, a test case is run for the first time, the value of the counter is collected and analyzed, whether a target code segment is executed is judged based on the collected value, a case code relation table of the test case and the code is established, a code segment modified by a new version is obtained, whether the case code relation table needs to be updated is judged, the counter is implanted into the modified code segment when needed, a test case set is automatically recommended when not needed, the automatically recommended test case set is further simplified by using the preset reduction strategy, a refined case set is obtained, and the test case is executed again to obtain a quantized test result.
In the above application scenario, a case set is automatically recommended first, and a preset reduction strategy is used for simplification, so that a corresponding test case can be selected for the simplified test case based on the update information in order to further improve the test efficiency, which is not limited in this embodiment.
In the embodiment, the whole test process starts from the code node level to perform refined control, automatically recommends and simplifies the test case set, and can perform quantitative analysis on the test result, so that the code robustness is finally improved, and the test cost is reduced.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating a structure of an automatic test system according to an embodiment of the present invention, as shown in fig. 4, the automatic test system includes a data obtaining module 100, a mapping construction module 200, a mapping simplification module 300, and an automatic test module 400, wherein:
the data acquisition module 100 is configured to acquire a target test code and a test case set corresponding to the target test code; the mapping construction module 200 is configured to establish a mapping relationship between the test case set and code segments in the target test code based on a compiling and instrumentation manner; the mapping simplification module 300 is configured to simplify the mapping relationship based on a preset simplification policy to obtain an optimal mapping relationship; and the automatic test module 400 is configured to select a corresponding test case set according to the optimal mapping relationship, and perform an automatic test on the target test code.
It can be understood that the automated testing system provided by the present invention corresponds to the automated testing methods provided in the foregoing embodiments, and the relevant technical features of the automated testing system may refer to the relevant technical features of the automated testing method, which are not described herein again.
Referring to fig. 5, fig. 5 is a schematic view of an embodiment of an electronic device according to an embodiment of the invention. As shown in fig. 5, an embodiment of the present invention provides an electronic device, which includes a memory 1310, a processor 1320, and a computer program 1311 stored in the memory 1310 and executable on the processor 1320, where the processor 1320 executes the computer program 1311 to implement the following steps:
acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code.
Referring to fig. 6, fig. 6 is a schematic diagram of an embodiment of a computer-readable storage medium according to the present invention. As shown in fig. 6, the present embodiment provides a computer-readable storage medium 1400, on which a computer program 1411 is stored, which computer program 1411, when executed by a processor, implements the steps of:
acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code.
The invention provides an automatic test method, a system, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a target test code and a test case set corresponding to the target test code; based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code; simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation; and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code. According to the invention, the mapping relation between the test case set and the code segments in the target test code is established based on the compiling and instrumentation mode, the mapping relation is simplified based on the preset simplification strategy, and the target test code is tested based on the obtained optimal mapping relation, so that the whole test process is finely controlled from the node level of the code segments, and the test is carried out based on the optimal mapping relation between the code segments and the test case set, so that the test quality is ensured, the test time and the test cost are reduced, and the overall efficiency in the project development process is improved. In the whole testing process, the invention starts from the code node level to carry out refined control, automatically recommends and simplifies the test case set, can carry out quantitative analysis on the test result, finally improves the code robustness and reduces the testing cost.
It should be noted that, in the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to relevant descriptions of other embodiments for parts that are not described in detail in a certain embodiment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. An automated testing method, the method comprising:
acquiring a target test code and a test case set corresponding to the target test code;
based on a compiling and instrumentation mode, establishing a mapping relation between the test case set and code segments in the target test code;
simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation;
and selecting a corresponding test case set according to the optimal mapping relation, and carrying out automatic test on the target test code.
2. The automated testing method of claim 1, wherein the step of establishing a mapping relationship between the test case set and code segments in the target test code based on a compiling and instrumentation manner comprises:
extracting code segments of the target test code based on a preset code tree structure, and setting a corresponding counter at each extracted code segment inlet;
and sequentially operating each test case in the test case set, and establishing a mapping relation between the test case set and the code segments in the target test code according to the counting of the counter.
3. The automated testing method of claim 2, wherein the pre-defined code tree structure comprises: the code is classified into classes, methods, branch conditions, and code segments according to the scope of code action.
4. The automated testing method of claim 1, wherein the step of simplifying the mapping relationship based on a preset simplification strategy to obtain an optimal mapping relationship comprises:
acquiring case information of each test case in the mapping relation, wherein the case information comprises a unique identifier, hit times, priority, module BUG rate, coverage rate and/or version number;
and simplifying the mapping relation based on the use case information so that the mapping relation meets a preset simplification strategy to obtain an optimal mapping relation.
5. The automated testing method of claim 4, wherein the preset compaction policy comprises:
the test coverage rate corresponding to the test cases in the mapping relation exceeds a preset coverage threshold value, and/or the average value of the priorities corresponding to the test cases in the mapping relation exceeds a preset priority threshold value, and/or the sum of the running time lengths of the test cases in the mapping relation is smaller than a preset running time length threshold value.
6. The automated testing method according to claim 1, wherein after the step of establishing a mapping relationship between the test case set and the code segments in the target test-providing code based on a compiling instrumentation manner, the method further comprises:
and storing the mapping relation into a database in a key-value structure, wherein the key is the unique identifier of the test case in the test case set, and the value is the node identifier set of the code segment.
7. The automated testing method according to claim 6, wherein the step of selecting the corresponding set of test cases according to the optimal mapping relationship comprises:
acquiring update information of a code segment in a current latest version of a test code, acquiring a node identifier of a corresponding code segment according to the update information, and selecting a corresponding test case set according to the node identifier, wherein the acquired node identifier is as follows: modifying on the basis of the original code segment to obtain the node identification of the original code segment; adding a code segment in the original method or branch to obtain the node identification of the corresponding father node; modifying on the basis of the original branch condition to obtain the node identification of the original branch condition; adding branch conditions, and acquiring the node identification of the corresponding father node; and adding a method and a class, and acquiring the node identification of the corresponding method and the node identification of the class.
8. An automated test system, comprising:
the data acquisition module is used for acquiring the target test code and the corresponding test case set;
the mapping construction module is used for establishing a mapping relation between the test case set and code segments in the target test-promoting code based on a compiling and instrumentation mode;
the mapping simplification module is used for simplifying the mapping relation based on a preset simplification strategy to obtain an optimal mapping relation;
and the automatic test module is used for selecting a corresponding test case set according to the optimal mapping relation and automatically testing the target extraction code.
9. An electronic device comprising a memory, a processor configured to implement the steps of the automated testing method of any of claims 1-7 when executing a computer management class program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer management class program is stored thereon, which computer management class program, when executed by a processor, carries out the steps of the automated testing method according to any one of claims 1 to 7.
CN202211469578.2A 2022-11-22 2022-11-22 Automatic testing method, system, electronic equipment and storage medium Pending CN115757149A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211469578.2A CN115757149A (en) 2022-11-22 2022-11-22 Automatic testing method, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211469578.2A CN115757149A (en) 2022-11-22 2022-11-22 Automatic testing method, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115757149A true CN115757149A (en) 2023-03-07

Family

ID=85335384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211469578.2A Pending CN115757149A (en) 2022-11-22 2022-11-22 Automatic testing method, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115757149A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116822424A (en) * 2023-07-11 2023-09-29 北京云枢创新软件技术有限公司 Source file modifying and positioning system and readable storage medium
CN117194275A (en) * 2023-11-03 2023-12-08 吉贝克信息技术(北京)有限公司 Automatic software automatic test plan generation method and system based on intelligent algorithm

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116822424A (en) * 2023-07-11 2023-09-29 北京云枢创新软件技术有限公司 Source file modifying and positioning system and readable storage medium
CN116822424B (en) * 2023-07-11 2023-12-22 北京云枢创新软件技术有限公司 Source file modifying and positioning system and readable storage medium
CN117194275A (en) * 2023-11-03 2023-12-08 吉贝克信息技术(北京)有限公司 Automatic software automatic test plan generation method and system based on intelligent algorithm
CN117194275B (en) * 2023-11-03 2024-01-26 吉贝克信息技术(北京)有限公司 Automatic software automatic test plan generation method and system based on intelligent algorithm

Similar Documents

Publication Publication Date Title
US20200019494A1 (en) Method and apparatus for performing test by using test case
CN106909510B (en) Method for obtaining test case and server
CN115757149A (en) Automatic testing method, system, electronic equipment and storage medium
US8312440B2 (en) Method, computer program product, and hardware product for providing program individuality analysis for source code programs
US20180246803A1 (en) Targeted software testing
Christopoulou et al. Automated refactoring to the strategy design pattern
US20140229922A1 (en) Efficient model checking technique for finding software defects
US8898635B2 (en) System and method for automatic impact variable analysis and field expansion in mainframe systems
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
Yue et al. A characterization study of repeated bug fixes
US10528457B2 (en) Automated unit testing in a mainframe environment
CN110990019A (en) Java class analysis method and device, storage medium and electronic equipment
Islam et al. How bugs are fixed: Exposing bug-fix patterns with edits and nesting levels
CN109542444B (en) JAVA application monitoring method, device, server and storage medium
Islam et al. What changes in where? an empirical study of bug-fixing change patterns
Milea et al. Vector abstraction and concretization for scalable detection of refactorings
Vélez et al. Challenges in migrating imperative Deep Learning programs to graph execution: An empirical study
Zojaji et al. Automated program repair using genetic programming and model checking
Molitorisz et al. Patty: A pattern-based parallelization tool for the multicore age
Parizi et al. Automated test generation technique for aspectual features in AspectJ
de Boer et al. Combining monitoring with run-time assertion checking
US20150033213A1 (en) Compiling method, storage medium and compiling apparatus
CN115048298A (en) Seed scheduling weight value distribution method for data packet splicing
WO2021011117A1 (en) Detecting misconfiguration and/or bug(s) in large service(s) using correlated change analysis
Ko et al. Learning to Boost Disjunctive Static Bug-Finders

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination