CN111258876B - Accurate regression testing method and device under micro-service architecture - Google Patents

Accurate regression testing method and device under micro-service architecture Download PDF

Info

Publication number
CN111258876B
CN111258876B CN201811456038.4A CN201811456038A CN111258876B CN 111258876 B CN111258876 B CN 111258876B CN 201811456038 A CN201811456038 A CN 201811456038A CN 111258876 B CN111258876 B CN 111258876B
Authority
CN
China
Prior art keywords
function
change
effective
calling
acquiring
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.)
Active
Application number
CN201811456038.4A
Other languages
Chinese (zh)
Other versions
CN111258876A (en
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.)
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang 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 China Mobile Communications Group Co Ltd, China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811456038.4A priority Critical patent/CN111258876B/en
Publication of CN111258876A publication Critical patent/CN111258876A/en
Application granted granted Critical
Publication of CN111258876B publication Critical patent/CN111258876B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides an accurate regression testing method and device under a micro-service architecture. Wherein the method comprises the following steps: acquiring an effective change function; acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function; determining a change interface function list according to all effective change functions and all calling functions, and determining a regression testing range according to the change interface function list; and carrying out regression testing according to the regression testing range. According to the accurate regression testing method and device under the micro-service architecture, the affected interface function list is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problem that the cost and efficiency of the regression test are low due to the fact that the software project regression testing range is not well determined in the continuous integration process under the micro-service architecture is solved; the regression test is greatly improved in accuracy and efficiency, and the test cost is remarkably reduced.

Description

Accurate regression testing method and device under micro-service architecture
Technical Field
The embodiment of the invention relates to the technical field of software testing, in particular to an accurate regression testing method and device under a micro-service architecture.
Background
In progressive and rapid iterative development, the continuous release of new versions makes regression testing very frequent, and in the continuous integration continuous interaction process, frequent and efficient regression testing is required. Therefore, it is very significant to improve the efficiency and effectiveness of regression testing by choosing the correct regression testing strategy. The regression test of the existing micro-service architecture software mainly adopts the following two schemes:
(one) regression based on regression document
The micro service project with simple service is generally to design a regression test document based on a self service system, manually maintain the regression test document along with the project process to keep the consistency with the current system, and perform full regression according to the regression test document during regression test. When the regression test document is not designed in detail enough, the regression needs to be carried out according to the experience of a tester, and the condition of missing of a test scene is easy to occur. If the regression test document design is sufficiently detailed to cover all scenes, the workload of maintenance of the regression test document and design of the test scene can be increased, and the cost of the regression test can be increased.
(II) regression testing based on certain regression strategy and regression case set
For a relatively large micro-service project, the cost of frequent total regression is too high with the increase of business complexity. Many projects can utilize some automatic test tools or platforms, and a certain regression strategy is formulated according to the project conditions of the projects. For example, risk selection based tests, which are based on certain risk criteria to select a regression test set from a library of baseline test cases, typically from primary to secondary features; based on the test of a certain functional importance assessment method, the test is preferably selected to be conducted aiming at the test case of the most important or most frequently used function; and identifying the modification condition of the software by manually performing dependency analysis, determining the updated influence range, and performing regression testing. In the test method, the automatic test tool mainly performs automatic test case management, execution function module maintenance, tracking and the like; the test case input and the system function module division are also modes of manual maintenance. The efficiency and cost of the test scheme test are reduced, and the quality and stability of the test are improved, but the overall regression test scheme and scope is still artificially dominant, and the quality of the test depends on the design and execution of good test scheme by a team.
Therefore, the prior art scheme mainly relies on regression test documents and self-defined test strategies to determine the scope of each regression test, and some regression tests can be performed through an automatic test tool, but the scope of the regression test is still manually dominant, and the large-scale regression test is performed under a certain strategy. The existing scheme has a plurality of problems: first, accurate regression testing is not performed, and many regression testing works are simply idle. Secondly, the overall regression testing cost is relatively high, and a large-scale regression test is always carried out for ensuring the quality. Thirdly, the situation of test omission easily occurs, so that bug is not found in time.
Disclosure of Invention
In order to solve the problems of low test efficiency, high cost and the like in the existing regression test, the embodiment of the invention provides an accurate regression test method and device under a micro-service architecture.
In a first aspect, an embodiment of the present invention provides a method for accurate regression testing under a micro-service architecture, where the method includes: acquiring an effective change function, wherein the effective change function is a function with effective change; acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function; determining a change interface function list according to all the effective change functions and all the calling functions, and determining a regression testing range according to the change interface function list; and carrying out regression testing according to the regression testing range.
In a second aspect, an embodiment of the invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method as provided in the first aspect when the program is executed.
In a third aspect, embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as provided by the first aspect.
In a fourth aspect, an embodiment of the present invention provides an accurate regression testing apparatus under a micro-service architecture, including: the effective change function acquisition module is used for acquiring an effective change function, wherein the effective change function is a function with effective change; the calling function acquisition module is used for acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function; the regression test range determining module is used for determining a change interface function list according to all the effective change functions and all the calling functions and determining a regression test range according to the change interface function list; and the regression testing module is used for carrying out regression testing according to the regression testing range.
According to the accurate regression testing method and device under the micro-service architecture, the affected interface function list is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problem that the cost and efficiency of the regression test are low due to the fact that the software project regression testing range is not well determined in the continuous integration process under the micro-service architecture is solved; the regression test is greatly improved in accuracy and efficiency, and the test cost is remarkably reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for accurate regression testing under a micro-service architecture provided by an embodiment of the present invention;
FIG. 2 is a flow chart of a method for accurate regression testing under a micro-service architecture according to another embodiment of the present invention;
FIG. 3 is a flowchart of obtaining a list of valid change functions in a method for accurate regression testing under a micro-service architecture according to another embodiment of the present invention;
FIG. 4 is a schematic diagram of a multi-way tree of function call relationships in a method for accurate regression testing under a microservice architecture according to another embodiment of the present invention;
fig. 5 is a schematic diagram of an entity structure of an electronic device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an accurate regression testing apparatus under a micro-service architecture according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flowchart of an accurate regression testing method under a micro-service architecture according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step 101, acquiring an effective change function, wherein the effective change function is a function with effective change;
the accurate regression testing device under the micro-service architecture firstly acquires an effective change function, wherein the effective change function is a function with effective change. The effective change means that the function is changed substantially, and the function is affected. For example, if the change of the function is simply to add an extra blank line, space, or the like, the change is not effective because the function is not affected by the operation or the function. Invalid function changes do not require regression testing and are ignored.
The effective altering function may be multiple.
102, acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function;
the effective change function is a function in which the function itself is effectively changed. Because of the software implementation process of an item, the calling among functions often happens, and if the called function is changed, the function calling the function is influenced to be changed together. Therefore, when performing the regression test, not only the effective change function but also a calling function that directly and indirectly calls the effective change function need to be considered. The direct and indirect call of the call function of the effective change function is direct call of the effective change function and indirect call of the effective change function.
When the number of the effective changing functions is multiple, the calling functions corresponding to the corresponding effective changing functions need to be acquired respectively.
Step 103, determining a change interface function list according to all the effective change functions and all the calling functions, and determining a regression testing range according to the change interface function list;
and under the micro-service framework, testing the changed interface function, and thus completing the regression test. The changed interface function is the changed interface function.
And after the effective change function and the call function are obtained, collecting all the effective change function and the call function, and screening out interface functions in the effective change function and the call function to obtain the change interface function list.
After the change interface function list is obtained, a regression testing range can be determined according to the change interface function list, wherein the regression testing range comprises all the change interface functions in the change interface function list.
And 104, carrying out regression testing according to the regression testing range.
And after the regression testing range is obtained, carrying out regression testing according to the regression testing range.
According to the embodiment of the invention, the affected interface function list is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problems of low cost and efficiency of regression testing caused by poor determination of the regression testing range of the software project in the continuous integration process under the micro-service architecture are solved; the regression test is greatly improved in accuracy and efficiency, and the test cost is remarkably reduced.
Further, based on the above embodiment, the obtaining the effective change function specifically includes: acquiring a change file with change; and acquiring the effective change function according to the change file.
And acquiring a change file with change, and acquiring the effective change function according to the change file. Specifically, comparing the changed file with the file before the change identifies all the changes of the file. And screening out the function with effective change from all the changes to obtain the effective change function.
Based on the embodiment, the embodiment of the invention obtains the effective change function by changing the file, and improves the obtaining efficiency and accuracy of the effective change function, thereby improving the efficiency and accuracy of the regression test.
Further, based on the above embodiment, the obtaining the effective change function according to the change file specifically includes: acquiring all effective changes appearing in the change file, and dividing the all effective changes into function changes, class variable changes and annotation changes; acquiring a first type of change function according to the change of the function, acquiring a second type of change function according to the change of the class variable, and acquiring a third type of change function according to the change of the annotation; and acquiring the effective change function according to the first type change function, the second type change function and the third type change function.
And after the change file is acquired, acquiring all effective changes in the change file according to the change file. When determining whether or not the change is a valid change, the determination may be made by excluding the invalid change, or by setting a change form of the valid change, or may be made by such a method at the same time. For example, when judging by excluding invalid changes, if it is judged that the changes are only empty, then the invalid changes can be identified; if the change does not belong to any of the set invalid changes, the change is determined to be a valid change. When the determination is made by setting the change form of the effective change, if the determination is made that the change that has occurred is deleted and inserted, the determination can be regarded as the effective change, and the like.
All valid changes are classified into three types, namely, change of function, change of class variable and change of annotation. Each effective change is specifically classified into which category, and can be determined according to the position where the change is located.
And acquiring a first type of change function according to the change of the function, wherein the first type of change function comprises all the functions with the change types being the change of the function. And according to the change of the class variable, determining an affected change function list by analyzing the scope of the changed class variable, and obtaining the second class change function. And according to the change of the annotation, determining an affected change function list by analyzing the scope of the annotation, and obtaining the third type of change function.
Acquiring the effective change function according to the first type change function, the second type change function and the third type change function; the effective change functions include the first type change function, the second type change function, and the third type change function.
Based on the embodiment, the embodiment of the invention divides all effective changes into the changes of the functions, the changes of the class variables and the changes of the notes, and obtains the effective change functions according to the three changes, thereby further improving the obtaining efficiency and the accuracy of the effective change functions, and further improving the efficiency and the accuracy of the regression test.
Further, based on the above embodiment, the obtaining the valid change function according to the first type change function, the second type change function, and the third type change function specifically includes: and merging the first type of change function, the second type of change function and the third type of change function, and then removing duplication to obtain the effective change function.
After the first type of change function, the second type of change function and the third type of change function are obtained, because the first type of change function, the second type of change function and the third type of change function may have repeated functions, the effective change function can be obtained by removing the duplication of the first type of change function, the second type of change function and the third type of change function after the first type of change function, the second type of change function and the third type of change function are combined, so as to avoid repeated processing of the same effective change function.
Based on the above embodiment, the embodiment of the present invention further improves the efficiency of regression testing by performing the union and the de-duplication of the first type of change function, the second type of change function and the third type of change function to obtain the effective change function.
Further, based on the above embodiment, the obtaining, based on the valid change function, a calling function that directly and indirectly calls the valid change function specifically includes: acquiring a calling function for directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree based on the effective change function; the function call relation multi-way tree comprises the effective change function and the call function.
And based on the effective change function, acquiring the calling function for directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree. For example, p= { F1, F2, F3 … Fn } represents the direct calling functions F1 to Fn of the effective change function P, then the direct calling function of each Fn is circularly analyzed, and finally a multi-way tree of function calling relationship is formed. In the function call relation multi-way tree, the function directly calling the effective change function P and the function indirectly calling the effective change function P jointly form a call function of the effective change function P.
Wherein the function call relation multi-way tree comprises the effective change function and the call function.
On the basis of the embodiment, the embodiment of the invention acquires the calling function directly and indirectly calling the effective change function by constructing the function calling relation multi-way tree, thereby ensuring the comprehensive acquisition of the calling function and improving the accuracy of regression test.
Further, based on the above embodiment, the determining the change interface function list according to all the valid change functions and all the calling functions specifically includes: comparing the effective change function and the calling function in the function call relation multi-way tree with an interface function list determined under the current micro-service item by traversing the function call relation multi-way tree to obtain an interface function in each function call relation multi-way tree; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
Under the micro-service framework, all interface functions of the current software project and function paths corresponding to the interface functions can be accurately output. The interface functions need to be packaged into libraries, so that the function paths corresponding to the interface functions are used for analyzing the calling relation of the interface functions. The main objective of determining the accurate regression testing range in the embodiment of the invention is to determine the interface function affected by the code change, namely the changed interface function.
Since all interface functions of the current software project can be known, after obtaining the function call relation multi-way tree corresponding to each effective change function, comparing the effective change function and the call function in the function call relation multi-way tree with an interface function list determined under the current microservice project by traversing the function call relation multi-way tree to obtain the interface function in each function call relation multi-way tree; the number of the interface functions in each function call relation multi-way tree is one or more; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
Based on the embodiment, the embodiment of the invention obtains the interface function list by traversing the function call relation multi-way tree, thereby further improving the efficiency and accuracy of regression testing.
Further, after the regression testing according to the regression testing range, the method further includes: and evaluating whether the regression test covers the regression test range, and giving an evaluation result.
In order to ensure the comprehensive reliability of the regression test, after the regression test is performed according to the regression test range, whether the regression test covers the regression test range is evaluated according to the completion condition of the test, and an evaluation result is given. If the test points of the regression test are not fully completed, corresponding prompt information is given, wherein the prompt information comprises incomplete contents so as to prompt the regression test to be further carried out. If the whole content of the regression test is completed completely, a message of successful test is given.
It can be understood that in order to evaluate the test result after the test is completed, real-time tracking and recording of the content of the test are required in the test process.
On the basis of the embodiment, the embodiment of the invention improves the reliability of the regression test by evaluating whether the regression test covers the regression test range after the regression test is performed according to the regression test range and giving out an evaluation result.
To further illustrate the accurate regression testing method under the micro-service architecture provided by the embodiments of the present invention, a complete embodiment is given below. This embodiment is described by taking regression testing of java code as an example.
Under the micro-service framework, all exposed interfaces of the current software project and function paths corresponding to the interfaces can be accurately output, and functions under the class like the @ RestController solution under the Springboot framework are exposed interfaces, so that each project corresponds to an exposed interface list, and the standard for judging the regression testing range is to determine the range of the influence of code change on the interface list. In addition, the embodiment of the invention analyzes the changes of the java code, and the changes such as the changes of the resource file and jar version dependence are not in the scope of the embodiment of the invention.
Fig. 2 is a flowchart of a precise regression testing method under a micro-service architecture according to another embodiment of the present invention. As shown in fig. 2, the test device first obtains a changed file list from the gitlab within a period of time (corresponding to the period of time when the code change occurs), then screens out the changed java file list, then analyzes the change of each java file, determines whether the change is effective, and finally determines that each java file has a changed function to form a list of all java functions of the change. And then analyzing the calling relation of each change function, finally confirming the interface influenced by each change function, outputting an interface list influenced by the change, and finally determining the range of the regression test.
FIG. 3 is a flowchart illustrating an effective change function list acquisition in a method for accurate regression testing under a micro-service architecture according to another embodiment of the present invention. As shown in fig. 3, the file list of the current change can be obtained from the gitlab, the changed file list of the java can be screened out, then the java file difference before and after the change is compared based on the file change identification algorithm, and whether all changes in the current change file are valid changes or invalid changes is judged, and if the changes are invalid changes, the changes are ignored; if the change is valid, the change is classified into different change types, including: function changes, variable changes, and annotation changes. Wherein the change of the variables and the annotations can determine the affected java function list by analyzing the scope thereof. And finally summarizing all the java function lists affected by the effective change to determine the java function list of the current change.
After obtaining the changed java function list, the embodiment of the invention outputs the interface list finally influenced by the changed java function mainly by analyzing the call chain of the function. The java function call relation analysis is mainly based on an open source boot technology, and is improved on the basis of the technology, and a call relation tree of each changed function is analyzed by utilizing a function call relation multi-way tree.
Fig. 4 is a schematic diagram of a function call relationship multi-tree in the accurate regression testing method under the micro service architecture according to another embodiment of the present invention. As shown in fig. 4, the function a is an effective change function, the functions B and C directly call the function a, the functions E, D and H directly call the function B, the functions F and G directly call the function C, the functions H and G directly call the function E, and the functions I directly call the function H.
The function D, the function F, the function G and the function I do not call other functions, so that a function call relation multi-way tree based on the effective change function A is formed. The function A is an effective change function, and the functions B-I are calling functions corresponding to the function A.
And comparing the traversing function call relation multi-way tree with the interface function list determined under the current micro-service item, and finally outputting all interface functions in the function call relation multi-way tree, and collecting the interface functions in the function call relation multi-way tree of all effective change functions to obtain all change interface functions, so that regression test can be performed on the change interface functions.
According to the embodiment of the invention, the interface for confirming the influence by deriving the java function change based on the source code change is realized by deeply analyzing the source code, so that the range of the interface influenced by each change is confirmed, and the accuracy and the efficiency are greatly improved compared with the regression test based on human experience, regression documents and regression strategies.
Fig. 5 is a schematic diagram of an entity structure of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device may include: processor 510, communication interface (Communications Interface) 520, memory 530, and communication bus 540, wherein processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform the following method: acquiring an effective change function, wherein the effective change function is a function with effective change; acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function; determining a change interface function list according to all the effective change functions and all the calling functions, and determining a regression testing range according to the change interface function list; and carrying out regression testing according to the regression testing range.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Fig. 6 is a schematic structural diagram of an accurate regression testing apparatus under a micro-service architecture according to an embodiment of the present invention. As shown in fig. 6, the apparatus includes an effective change function obtaining module 10, a calling function obtaining module 20, a regression testing range determining module 30, and a regression testing module 40, wherein:
the effective change function obtaining module 10 is configured to obtain an effective change function, where the effective change function is a function that is changed effectively;
the effective change function obtaining module 10 first obtains an effective change function, which is a function in which an effective change occurs. The effective change function is one or more. Invalid function changes do not require regression testing and are ignored.
The calling function obtaining module 20 is configured to obtain a calling function that directly and indirectly calls the effective change function based on the effective change function;
when the regression test is performed, not only the effective change function but also a calling function for directly and indirectly calling the effective change function are considered. The calling function obtaining module 20 is configured to obtain a calling function that directly and indirectly calls the valid change function based on the valid change function. When the number of the valid change functions is plural, the calling function obtaining module 20 needs to obtain the calling functions corresponding to the corresponding valid change functions, respectively.
The regression testing range determining module 30 is configured to determine a list of changed interface functions according to all the valid changed functions and all the calling functions, and determine a regression testing range according to the list of changed interface functions;
the regression testing range determining module 30 gathers all the effective changing functions and the calling functions, and screens out the interface functions therein, thereby obtaining the changing interface function list. After obtaining the change interface function list, the regression testing range determining module 30 may determine a regression testing range according to the change interface function list, where the regression testing range includes all the change interface functions in the change interface function list.
The regression testing module 40 is configured to perform a regression test according to the regression testing range.
After obtaining the regression testing range, the regression testing module 40 may perform the regression testing according to the regression testing range.
According to the embodiment of the invention, the affected interface function list is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problems of low cost and efficiency of regression testing caused by poor determination of the regression testing range of the software project in the continuous integration process under the micro-service architecture are solved; the regression test is greatly improved in accuracy and efficiency, and the test cost is remarkably reduced.
Further, based on the above embodiment, the effective change function obtaining module 10 is specifically configured to, when used for obtaining an effective change function: acquiring a change file with change; and acquiring the effective change function according to the change file.
The effective change function obtaining module 10 obtains a change file of the change, and obtains the effective change function according to the change file. Specifically, the effective change function obtaining module 10 compares the changed file with the file before the change, and identifies all the change conditions of the file; and screening out the function with effective change from all the changes to obtain the effective change function.
Based on the embodiment, the embodiment of the invention obtains the effective change function by changing the file, and improves the obtaining efficiency and accuracy of the effective change function, thereby improving the efficiency and accuracy of the regression test.
Further, based on the above embodiment, the effective change function obtaining module 10 is specifically configured to, when configured to obtain the effective change function according to the change file: acquiring all effective changes appearing in the change file, and dividing the all effective changes into function changes, class variable changes and annotation changes; acquiring a first type of change function according to the change of the function, acquiring a second type of change function according to the change of the class variable, and acquiring a third type of change function according to the change of the annotation; and acquiring the effective change function according to the first type change function, the second type change function and the third type change function.
After the effective change function obtaining module 10 obtains the change file, all effective changes in the change file are obtained according to the change file, the effective changes are classified, and each effective change is classified into a change of a function, a change of a class variable or a change of an annotation.
The effective change function obtaining module 10 obtains a first type of change function according to the change of the function, obtains a second type of change function according to the change of the class variable, and obtains a third type of change function according to the change of the annotation; and acquiring the second type of change function by analyzing the scope of the class variable, and acquiring the third type of change function by analyzing the scope of the annotation.
The effective change function obtaining module 10 obtains the effective change function according to the first type change function, the second type change function and the third type change function; the effective change functions include the first type change function, the second type change function, and the third type change function.
Based on the embodiment, the embodiment of the invention divides all effective changes into the changes of the functions, the changes of the class variables and the changes of the notes, and obtains the effective change functions according to the three changes, thereby further improving the obtaining efficiency and the accuracy of the effective change functions, and further improving the efficiency and the accuracy of the regression test.
Further, based on the above embodiment, the effective change function obtaining module 10 is specifically configured to, when used for obtaining the effective change function according to the first type change function, the second type change function, and the third type change function: and merging the first type of change function, the second type of change function and the third type of change function, and then removing duplication to obtain the effective change function.
The effective change function obtaining module 10 may remove duplication after the first type change function, the second type change function, and the third type change function are combined to obtain the effective change function, so as to avoid repetitive processing on the same effective change function.
Based on the above embodiment, the embodiment of the present invention further improves the efficiency of regression testing by performing the union and the de-duplication of the first type of change function, the second type of change function and the third type of change function to obtain the effective change function.
Further, based on the above embodiment, the calling function obtaining module 20 is specifically configured to, when obtaining, based on the valid change function, a calling function that directly and indirectly calls the valid change function: acquiring a calling function for directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree based on the effective change function; wherein the function call relation multi-way tree comprises the effective change function and the call function.
The calling function obtaining module 20 obtains the calling function directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree based on the effective change function. Wherein the function call relation multi-way tree comprises the effective change function and the call function.
On the basis of the embodiment, the embodiment of the invention acquires the calling function directly and indirectly calling the effective change function by constructing the function calling relation multi-way tree, thereby ensuring the comprehensive acquisition of the calling function and improving the accuracy of regression test.
Further, based on the above embodiment, the regression testing range determination module 30 is specifically configured to, when determining the list of changed interface functions according to all the valid changed functions and all the calling functions: comparing the effective change function and the calling function in the function call relation multi-way tree with an interface function list determined under the current micro-service item by traversing the function call relation multi-way tree to obtain an interface function in each function call relation multi-way tree; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
The regression testing range determining module 30 compares the effective change function and the calling function in the function calling relation multi-way tree with the interface function list determined under the current micro-service item by traversing the function calling relation multi-way tree to obtain the interface function in each function calling relation multi-way tree; the number of the interface functions in each function call relation multi-way tree is one or more; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
Based on the embodiment, the embodiment of the invention obtains the interface function list by traversing the function call relation multi-way tree, thereby further improving the efficiency and accuracy of regression testing.
Further, based on the above embodiment, the apparatus further includes an evaluation module, configured to evaluate whether the regression test covers the regression test range after the regression test module 40 performs the regression test according to the regression test range, and give an evaluation result.
In order to ensure the comprehensive reliability of the regression test, the device further comprises an evaluation module. After carrying out the regression test according to the regression test range, the evaluation module evaluates whether the regression test covers the regression test range according to the completion condition of the test and gives an evaluation result.
On the basis of the embodiment, the embodiment of the invention improves the reliability of the regression test by evaluating whether the regression test covers the regression test range after the regression test is performed according to the regression test range and giving out an evaluation result.
The device provided by the embodiment of the invention is used for the method, and specific functions can refer to the flow of the method and are not repeated here.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (6)

1. An accurate regression testing method under a micro-service architecture is characterized by comprising the following steps:
acquiring an effective change function, wherein the effective change function is a function with effective change;
acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function;
determining a change interface function list according to all the effective change functions and all the calling functions, and determining a regression testing range according to the change interface function list;
performing regression testing according to the regression testing range;
the method for obtaining the calling function directly and indirectly calling the effective change function based on the effective change function specifically comprises the following steps:
acquiring a calling function for directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree based on the effective change function;
wherein the function call relation multi-way tree comprises the effective change function and the call function;
the step of determining a change interface function list according to all the effective change functions and all the calling functions specifically comprises the following steps:
comparing the effective change function and the calling function in the function call relation multi-way tree with an interface function list determined under the current micro-service item by traversing the function call relation multi-way tree to obtain an interface function in each function call relation multi-way tree;
all the collection of interface functions in the function call relation multi-way tree form the change interface function list;
the obtaining the effective change function specifically includes:
acquiring a change file with change;
acquiring the effective change function according to the change file;
the obtaining the effective change function according to the change file specifically includes:
acquiring all effective changes appearing in the change file, and dividing the all effective changes into function changes, class variable changes and annotation changes;
acquiring a first type of change function according to the change of the function, acquiring a second type of change function according to the change of the class variable, and acquiring a third type of change function according to the change of the annotation;
and acquiring the effective change function according to the first type change function, the second type change function and the third type change function.
2. The method according to claim 1, wherein the obtaining the valid change function according to the first type change function, the second type change function, and the third type change function specifically includes:
and merging the first type of change function, the second type of change function and the third type of change function, and then removing duplication to obtain the effective change function.
3. The method of claim 1, wherein after the regression testing according to the regression testing range, the method further comprises:
and evaluating whether the regression test covers the regression test range, and giving an evaluation result.
4. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 3 when the program is executed.
5. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 3.
6. An accurate regression testing device under a micro-service architecture, comprising:
the effective change function acquisition module is used for acquiring an effective change function, wherein the effective change function is a function with effective change;
the obtaining the effective change function specifically includes:
acquiring a change file with change;
acquiring the effective change function according to the change file;
the obtaining the effective change function according to the change file specifically includes:
acquiring all effective changes appearing in the change file, and dividing the all effective changes into function changes, class variable changes and annotation changes;
acquiring a first type of change function according to the change of the function, acquiring a second type of change function according to the change of the class variable, and acquiring a third type of change function according to the change of the annotation;
acquiring the effective change function according to the first type change function, the second type change function and the third type change function;
the calling function acquisition module is used for acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function;
the regression test range determining module is used for determining a change interface function list according to all the effective change functions and all the calling functions and determining a regression test range according to the change interface function list;
the regression testing module is used for carrying out regression testing according to the regression testing range;
the method for obtaining the calling function directly and indirectly calling the effective change function based on the effective change function specifically comprises the following steps:
acquiring a calling function for directly and indirectly calling the effective change function by constructing a function calling relation multi-way tree based on the effective change function;
wherein the function call relation multi-way tree comprises the effective change function and the call function;
the step of determining a change interface function list according to all the effective change functions and all the calling functions specifically comprises the following steps:
comparing the effective change function and the calling function in the function call relation multi-way tree with an interface function list determined under the current micro-service item by traversing the function call relation multi-way tree to obtain an interface function in each function call relation multi-way tree;
and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
CN201811456038.4A 2018-11-30 2018-11-30 Accurate regression testing method and device under micro-service architecture Active CN111258876B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811456038.4A CN111258876B (en) 2018-11-30 2018-11-30 Accurate regression testing method and device under micro-service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811456038.4A CN111258876B (en) 2018-11-30 2018-11-30 Accurate regression testing method and device under micro-service architecture

Publications (2)

Publication Number Publication Date
CN111258876A CN111258876A (en) 2020-06-09
CN111258876B true CN111258876B (en) 2023-08-01

Family

ID=70951954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811456038.4A Active CN111258876B (en) 2018-11-30 2018-11-30 Accurate regression testing method and device under micro-service architecture

Country Status (1)

Country Link
CN (1) CN111258876B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342685A (en) * 2021-06-29 2021-09-03 平安资产管理有限责任公司 Precise test method and device, computer equipment and storage medium
CN113656318A (en) * 2021-08-23 2021-11-16 上海哔哩哔哩科技有限公司 Software version testing method and device and computer equipment
CN113704127A (en) * 2021-09-03 2021-11-26 北京惠岩信息科技有限公司 Micro-service testing method and micro-service testing device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377121A (en) * 2012-04-24 2013-10-30 百度在线网络技术(北京)有限公司 Method and device for detecting coupling risks
US8806450B1 (en) * 2008-06-26 2014-08-12 Juniper Networks, Inc. Static analysis in selective software regression testing
CN105302720A (en) * 2015-10-27 2016-02-03 浪潮电子信息产业股份有限公司 Software regression test case screening method
CN108804326A (en) * 2018-06-12 2018-11-13 上海新炬网络技术有限公司 A kind of software code automatic testing method

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6966013B2 (en) * 2001-07-21 2005-11-15 International Business Machines Corporation Method and system for performing automated regression tests in a state-dependent data processing system
US8473919B2 (en) * 2008-01-31 2013-06-25 Ca, Inc. System and method for repeating program flow for debugging and testing
CN100576172C (en) * 2008-05-27 2009-12-30 华耀环宇科技(北京)有限公司 A kind of method of determining that function point changes that changes by code analysis
CN103176895B (en) * 2011-12-22 2016-03-30 阿里巴巴集团控股有限公司 A kind of regression testing method and system
CN103678097A (en) * 2012-09-05 2014-03-26 百度在线网络技术(北京)有限公司 Method and device for selecting regression test case
CN103699488B (en) * 2013-12-30 2017-01-04 优视科技有限公司 Regression testing method based on call relation dependency graph and system
US9361211B2 (en) * 2014-03-07 2016-06-07 Ca, Inc. Automated generation of test cases for regression testing
CN105159715B (en) * 2015-09-01 2018-07-20 南京大学 A kind of Python code change reminding method extracted based on the change of abstract syntax tree node
CN105389262B (en) * 2015-12-23 2019-02-15 北京奇虎科技有限公司 A kind of method and apparatus generating Test Suggestion for interface detection
CN107273281A (en) * 2016-04-06 2017-10-20 阿里巴巴集团控股有限公司 Service interface test method, system based on code change
CN106021103B (en) * 2016-05-16 2019-01-04 南京大学 A kind of mobile application test script automatic maintenance method based on code change
CN108874652B (en) * 2017-05-09 2022-06-07 北京京东尚科信息技术有限公司 Method and device for software self-test evaluation and electronic equipment
CN108829575B (en) * 2018-04-17 2021-08-24 平安科技(深圳)有限公司 Test case recommendation method, electronic device and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8806450B1 (en) * 2008-06-26 2014-08-12 Juniper Networks, Inc. Static analysis in selective software regression testing
CN103377121A (en) * 2012-04-24 2013-10-30 百度在线网络技术(北京)有限公司 Method and device for detecting coupling risks
CN105302720A (en) * 2015-10-27 2016-02-03 浪潮电子信息产业股份有限公司 Software regression test case screening method
CN108804326A (en) * 2018-06-12 2018-11-13 上海新炬网络技术有限公司 A kind of software code automatic testing method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于函数调用路径的回归测试用例选择排序方法研究;郑锦勤;牟永敏;;计算机应用研究(07);149-153 *

Also Published As

Publication number Publication date
CN111258876A (en) 2020-06-09

Similar Documents

Publication Publication Date Title
CN109388566B (en) Code coverage rate analysis method, device, equipment and storage medium
US10289532B2 (en) Method and system for providing delta code coverage information
CN106909510B (en) Method for obtaining test case and server
CN111258876B (en) Accurate regression testing method and device under micro-service architecture
US9619373B2 (en) Method and apparatus to semantically connect independent build and test processes
CN108763091B (en) Method, device and system for regression testing
EP3428828B1 (en) System and method for locating and correcting vulnerabilites in a target computer system
CN110275878B (en) Service data detection method and device, computer equipment and storage medium
Yang et al. Vuldigger: A just-in-time and cost-aware tool for digging vulnerability-contributing changes
CN112328499A (en) Test data generation method, device, equipment and medium
CN110019067A (en) A kind of log analysis method and system
Velasco-Elizondo et al. Towards detecting MVC architectural smells
CN111858292A (en) Screening method, screening system, computer device and storage medium of test case
WO2022012327A1 (en) Code analysis method and system, and computing device
CN108897678B (en) Static code detection method, static code detection system and storage device
CN106557419B (en) Program testing method and device
CN110990282B (en) Automatic unit testing method
CN109542496B (en) Method, device and system for determining incremental code
Aktaş et al. A learning-based bug predicition method for object-oriented systems
CN116016270A (en) Switch test management method and device, electronic equipment and storage medium
CN114490413A (en) Test data preparation method and device, storage medium and electronic equipment
CN109508203B (en) Method, device and system for determining version consistency
CN113641573A (en) Revision log-based automatic testing method and system for program analysis software
Li A better approach to track the evolution of static code warnings
CN108763092B (en) Code defect detection method and device based on cross validation

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
GR01 Patent grant
GR01 Patent grant