CN111258876A - 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
CN111258876A
CN111258876A CN201811456038.4A CN201811456038A CN111258876A CN 111258876 A CN111258876 A CN 111258876A CN 201811456038 A CN201811456038 A CN 201811456038A CN 111258876 A CN111258876 A CN 111258876A
Authority
CN
China
Prior art keywords
function
change
effective
functions
regression
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.)
Granted
Application number
CN201811456038.4A
Other languages
Chinese (zh)
Other versions
CN111258876B (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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

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: obtaining an effective change function; based on the effective change function, obtaining a call function for directly and indirectly calling the effective change function; determining a change interface function list according to all effective change functions and all calling functions, and determining a regression test range according to the change interface function list; and performing regression testing according to the regression testing range. According to the method and the device for the accurate regression testing under the micro-service architecture, provided by the embodiment of the invention, the list of the affected interface functions is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problems of low cost and low efficiency of the regression testing caused by the fact that the regression testing range of a software project is not well determined in the continuous integration process under the micro-service architecture are solved; the accuracy and the efficiency of the regression test are greatly improved, and the test cost is obviously 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 gradual and fast iterative development, the continuous release of new versions makes regression testing frequently performed, and in the continuous integration and continuous interaction process, the regression testing is required to be performed frequently and efficiently. Therefore, it is very meaningful to improve the efficiency and effectiveness of regression testing by selecting the right regression testing strategy. The regression test of the existing microservice architecture software mainly adopts the following two schemes:
(one) regression based on regression document total
In general, a regression test document is designed based on a self service system, the regression test document is manually maintained along with a project process to keep the regression test document consistent with a current system, and full regression is performed according to the regression test document during regression test. When the regression test document design is not detailed enough, supplementary test is needed to be carried out according to the experience of testers during regression, and the situation of test scene omission is easy to occur. If the regression test document design covers all scenarios in sufficient detail, the workload of regression test document maintenance and test scenario design is increased, and the cost of regression testing is increased.
(II) regression testing based on certain regression strategy and regression case set
For a relatively large micro-service project, with the increase of the service complexity, the cost of frequent total regression is too high. Many projects can make certain regression strategies according to the project conditions by means of some automatic testing tools or platforms. For example, a risk-based selection test selects a regression test set from a baseline test case base based on certain risk criteria, and generally, the test is from a primary feature to a secondary feature; the test based on a certain function importance evaluation method is to preferentially select a test case aiming at the most important or most frequently used function for testing; and the modification condition of the software is identified through manual dependency analysis, the updated influence range is determined, and regression testing is performed. In the test method, the automatic test tool mainly performs automatic test case management, execution function module maintenance, tracking and the like; the input of test cases and the division of system function modules are also in a manual maintenance mode. The efficiency and cost of the test scheme test are reduced, the quality and stability of the test are improved, but the regression test scheme and range are still manually dominant on the whole, and the quality of the test depends on the good test scheme design and execution of a team.
Therefore, the existing technical scheme mainly depends on regression testing documents and self-defined testing strategies to determine the range of each regression testing, some regression testing can be performed through an automatic testing tool, but the regression testing range is still dominated by a manual mode, and the large-range regression testing is performed under a certain strategy. The existing scheme has a plurality of problems: firstly, an accurate regression test cannot be performed, and many regression tests only do nothing. Secondly, the total regression testing cost is higher, and large-range regression testing is always carried out for ensuring the quality. Thirdly, test omission easily occurs, and the bug is not found in time.
Disclosure of Invention
In order to solve the problems of low testing efficiency, high cost and the like in the conventional regression testing, the embodiment of the invention provides an accurate regression testing 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: obtaining an effective change function, wherein the effective change function is a function which is effectively changed; acquiring a calling function for directly and indirectly calling the effective changing function based on the effective changing function; 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 performing regression testing according to the regression testing range.
In a second aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method provided in the first aspect when executing the program.
In a third aspect, an embodiment of the present invention provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method as provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides an apparatus for accurate regression testing under a microservice architecture, where the apparatus includes: the effective change function acquisition module is used for acquiring an effective change function, wherein the effective change function is a function which is effectively changed; a calling function obtaining module, configured to obtain, based on the effective changing function, a calling function for directly and indirectly calling the effective changing function; the regression testing 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 testing 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 method and the device for the accurate regression testing under the micro-service architecture, provided by the embodiment of the invention, the list of the affected interface functions is determined by analyzing the source code change, so that the regression testing range is accurately determined, and the problems of low cost and low efficiency of the regression testing caused by the fact that the regression testing range of a software project is not well determined in the continuous integration process under the micro-service architecture are solved; the accuracy and the efficiency of the regression test are greatly improved, and the test cost is obviously reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart of a method for performing a regression test on a microservice architecture according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for performing a regression test on a microservice architecture according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating the obtaining of an effective modification function list in an accurate regression testing method under a microservice architecture according to another embodiment of the present invention;
FIG. 4 is a diagram illustrating a function call relation multi-way tree in an accurate regression testing method under a micro service architecture according to another embodiment of the present invention;
FIG. 5 is a schematic physical structure diagram 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 the micro service architecture according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of an accurate regression testing method under the micro service architecture according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step 101, obtaining an effective change function, wherein the effective change function is a function which is effectively changed;
the accurate regression testing device under the micro-service architecture firstly obtains an effective change function, wherein the effective change function is a function which is effectively changed. The effective change means that the function is substantially changed, and the function operation or the function is affected. For example, if the function is changed by adding extra empty lines, spaces, or the like, the function is not affected by the operation or function, and the function is not changed. Invalid function changes do not require regression testing and can be ignored.
The effective change function may be plural.
102, acquiring a calling function for directly and indirectly calling the effective change function based on the effective change function;
the effective change function refers to a function in which the function itself is effectively changed. Due to the software implementation process of a project, calling between functions often occurs, and if the called function is changed, the function calling the function is influenced to be changed together with the change. Therefore, in performing the regression test, not only the effective modification function but also a calling function for directly and indirectly calling the effective modification function needs to be considered. The calling functions directly and indirectly calling the effective change function are functions directly calling the effective change function and functions indirectly calling the effective change function.
When there are a plurality of effective changing functions, the calling functions corresponding to the corresponding effective changing functions need to be acquired respectively.
103, determining a change interface function list according to all the effective change functions and all the call functions, and determining a regression test range according to the change interface function list;
and under the micro-service framework, testing the changed interface function, and finishing the regression test. The changed interface function is the changed interface function.
After the effective change functions and the call functions are obtained, all the effective change functions and the call functions are collected, and interface functions in the effective change functions and the call functions are screened out, so that the change interface function list is obtained.
After the change interface function list is obtained, a regression test range can be determined according to the change interface function list, and the regression test range comprises all the change interface functions in the change interface function list.
And 104, performing regression testing according to the regression testing range.
And after the regression test range is obtained, performing regression test according to the regression test range.
The embodiment of the invention determines the list of the affected interface functions by analyzing the source code change, further accurately determines the regression test range, and solves the problems of low cost and efficiency of regression test caused by the fact that the regression test range of the software project is not well determined in the continuous integration process under the micro service architecture; the accuracy and the efficiency of the regression test are greatly improved, and the test cost is obviously reduced.
Further, based on the above embodiment, the obtaining the effective change function specifically includes: acquiring a changed file which is changed; and acquiring the effective change function according to the change file.
And acquiring the changed file, and acquiring the effective change function according to the changed file. Specifically, comparing the changed file with the file before the change identifies all the changes of the file. And screening out the functions with effective changes from all the changes, namely obtaining the effective change functions.
On the basis of the embodiment, the embodiment of the invention obtains the effective change function by changing the file, thereby improving the obtaining efficiency and the accuracy of the effective change function and further improving the efficiency and the 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 all effective changes into function changes, class variable changes and annotation changes; acquiring a first class of change functions according to the change of the function, acquiring a second class of change functions according to the change of the class variable, and acquiring a third class of change functions according to the change of the annotation; and obtaining 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 obtained, obtaining all effective changes in the change file according to the change file. When determining whether or not the change is valid, the determination may be made by excluding invalid changes, or by setting a change form of valid changes, or may be made by such a method. For example, when the determination is made by excluding the invalid change, if it is determined that the change occurred is only insertion of an empty line, the change may be determined as an invalid change; if the change that occurs does not belong to any set invalid change, it is considered to be a valid change. When the determination is made by setting the change form of the valid change, if it is determined that the change that has occurred is a deletion and insertion, the change can be regarded as a valid change, and so on.
All valid changes are divided into three classes, namely function changes, class variable changes and annotation changes. The specific classification of each valid change can be determined based on the location of the change.
And acquiring a first class of change functions according to the change of the function, wherein the first class of change functions comprise all change types which are the change functions of the function. And determining a list of affected change functions by analyzing the scope of the changed class variable according to the change of the class variable, namely obtaining the second class change function. And determining the affected change function list by analyzing the scope of the annotation according to the change of the annotation, namely obtaining the third type of change function.
Obtaining 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 comprise the first type of change function, the second type of change function and the third type of change function.
On the basis of the above embodiment, the embodiment of the present invention further improves the efficiency and accuracy of obtaining the effective alteration function by dividing all effective alterations into the alteration of a function, the alteration of a class variable, and the alteration of an annotation, and obtaining the effective alteration function according to the three alterations, thereby further improving the efficiency and accuracy of the regression test.
Further, based on the above embodiment, the obtaining the effective change function according to the first type change function, the second type change function, and the third type change function specifically includes: and removing the duplication of the first type of change function, the second type of change function and the third type of change function after merging to obtain the effective change function.
After the first, second, and third types of modification functions are obtained, since there may be duplicate functions in the first, second, and third types of modification functions, the duplicate may be removed after the first, second, and third types of modification functions are merged to obtain the effective modification function, so as to avoid duplicate processing of the same effective modification function.
On the basis of the above embodiment, in the embodiment of the present invention, the effective alteration function is obtained by removing duplication after merging the first type alteration function, the second type alteration function, and the third type alteration function, so that the efficiency of the regression test is further improved.
Further, based on the above embodiment, the obtaining, based on the effective changing function, a calling function that directly and indirectly calls the effective changing function specifically includes: based on the effective change function, acquiring the call function for directly and indirectly calling the effective change function by constructing a function call relation multi-branch tree; the function call relation multi-way tree comprises the effective change function and the call function.
And acquiring the calling functions for directly and indirectly calling the effective changing functions by constructing a function calling relation multi-branch tree based on the effective changing functions. For example, the direct call functions F1 to Fn that effectively change the function P are represented by P ═ { F1, F2, F3 … Fn }, and then the direct call function of each Fn is circularly analyzed, and finally a function call relation multi-way tree is formed. In the function-call relation multi-way tree, a function for directly calling the effective alteration function P and a function for indirectly calling the effective alteration function P together constitute a call function for the effective alteration function P.
Wherein the function call relation multi-way tree includes the effective change function and the call function.
On the basis of the embodiment, the embodiment of the invention acquires the calling function for directly and indirectly calling the effective change function by constructing the function calling relation multi-branch tree, thereby ensuring the comprehensive acquisition of the calling function and improving the accuracy of the regression test.
Further, based on the above embodiment, the determining a change interface function list according to all the effective change functions and all the call functions specifically includes: comparing the effective change function and the call function in the function call relation multi-branch tree with an interface function list determined under the current micro service item by traversing the function call relation multi-branch tree to obtain an interface function in each function call relation multi-branch 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. Because the interface function needs to be packaged into a library, the function path corresponding to the interface function is used for analyzing the calling relationship of the interface function. The main objective of the embodiment of the present invention to determine the accurate regression test range is to determine the interface function affected by the code change, i.e., the change interface function.
Since all interface functions of the current software project can be known, after the function call relation multi-branch tree corresponding to each effective change function is obtained, the effective change functions and the call functions in the function call relation multi-branch tree are compared with an interface function list determined under the current micro service project by traversing the function call relation multi-branch tree to obtain the interface functions in each function call relation multi-branch tree; one or more interface functions in each function call relation multi-branch tree; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
On the basis of the embodiment, the embodiment of the invention further improves the efficiency and the accuracy of the regression test by acquiring the change interface function list through traversing the function call relation multi-way tree.
Further, after the performing the regression test according to the regression test range, the method further includes: and evaluating whether the regression test covers the regression test range or not, and giving an evaluation result.
In order to ensure the completeness and reliability of the regression test, after the regression test is carried out according to the regression test range, whether the regression test covers the regression test range is evaluated according to the test completion condition, and an evaluation result is given. And if the test points which completely complete the regression test do not exist, giving corresponding prompt information, wherein the prompt information comprises unfinished contents so as to prompt further regression test. And if the whole contents of the regression test are completely finished, giving a message of successful test.
It can be understood that, in order to evaluate the test result after the test is completed, the test content needs to be tracked and recorded in real time during the test process.
On the basis of the above embodiment, in the embodiment of the present invention, after the regression test is performed according to the regression test range, whether the regression test covers the regression test range is evaluated, and an evaluation result is given, so that the reliability of the regression test is improved.
To further illustrate the precise regression testing method under the micro service architecture provided by the embodiment of the present invention, a complete embodiment is provided below. This example is illustrated by regression testing of java code.
In the micro-service framework, all exposed interfaces of the current software project and function paths corresponding to the interfaces can be accurately output, functions under the class like under the annotation of @ RestController under the springboot framework are exposed interfaces, so that each project corresponds to an exposed interface list, and the criterion for judging the regression test 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 change of java code, and the change of dependence of a resource file and a jar version is out of the scope of the embodiment of the invention.
Fig. 2 is a flowchart of an accurate regression testing method under the microservice architecture according to another embodiment of the present invention. As shown in fig. 2, the testing device first obtains a change file list within a period of time (corresponding to a time period in which a code change occurs) from the gitlab, then screens out a java file list of the current change, then analyzes the change of each java file to determine 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 current change. And then analyzing the calling relation of each change function, finally confirming the interface influenced by each change function, outputting a list of the interfaces influenced by the current change, and finally determining the range of the regression test.
Fig. 3 is a flowchart illustrating the obtaining of the list of valid change functions in the precise regression testing method under the microservice 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 gitlab, the changed file list of java can be screened out, then the differences of java files before and after the change are compared based on a file change identification algorithm, and whether all changes in the current changed file are effective changes or invalid changes is judged, and if the changes are invalid, the changes are ignored; if the change is valid, the change types are distinguished to be different, including: changes to functions, changes to variables, and changes to annotations. Wherein the change of the variable and the annotation can determine the list of affected java functions by analyzing the scope of the change. And finally summarizing all java function lists influenced by effective changes to determine the java function list of the change.
After the changed java function list is obtained, the embodiment of the invention mainly outputs the interface list which is finally influenced by the changed java function by analyzing the calling chain of the function. The java function calling relation analysis is mainly based on the open source root technology, improvement is made on the basis of the technology, and the function calling relation multi-branch tree is used for analyzing the calling relation tree of each change function.
Fig. 4 is a schematic diagram of a function call relation multi-way tree in an accurate regression testing method under a micro service architecture according to another embodiment of the present invention. As shown in fig. 4, function a is an effective alteration function, function B and function C directly call function a, function E, function D and function H directly call function B, function F and function G directly call function C, function H and function G directly call function E, and function I directly calls function H.
The function D, the function F, the function G and the function I are not called by other functions, so that a function calling relation multi-way tree based on the effective change function A is formed. Wherein, the function A is an effective change function, and the functions B to I are corresponding calling functions.
And finally, outputting all interface functions in the function call relation multi-branch tree by comparing the traversal function call relation multi-branch tree with the interface function list determined under the current micro service item, and collecting the interface functions in the function call relation multi-branch tree of all effective change functions to obtain all change interface functions, thereby carrying out regression test on the change interface functions.
According to the embodiment of the invention, the java function change is deduced based on the source code change so as to confirm the influenced interface, the interface range influenced by each change is confirmed in a deep source code analysis mode, and the accuracy and the efficiency are greatly improved compared with the common regression test based on human experience, regression documents and regression strategies.
Fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device may include: a processor (processor)510, a communication Interface (Communications Interface)520, a memory (memory)530 and a communication bus 540, wherein the processor 510, the communication Interface 520 and the memory 530 communicate with each other via the communication bus 540. Processor 510 may call logic instructions in memory 530 to perform the following method: obtaining an effective change function, wherein the effective change function is a function which is effectively changed; acquiring a calling function for directly and indirectly calling the effective changing function based on the effective changing function; 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 performing regression testing according to the regression testing range.
Furthermore, the logic instructions in the memory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute 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), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Fig. 6 is a schematic structural diagram of an accurate regression testing apparatus under the micro service architecture according to an embodiment of the present invention. As shown in fig. 6, the apparatus includes an effective alteration function obtaining module 10, a calling function obtaining module 20, a regression test range determining module 30, and a regression test 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 effectively changed;
the effective alteration function obtaining module 10 first obtains an effective alteration function, which is a function where an effective alteration occurs. The effective change function is one or more. Invalid function changes do not require regression testing and can be ignored.
The calling function obtaining module 20 is configured to obtain a calling function for directly and indirectly calling the effective changing function based on the effective changing function;
when performing the regression test, not only the effective modification function but also a calling function for directly and indirectly calling the effective modification function need to be considered. The calling function obtaining module 20 is configured to obtain a calling function for directly and indirectly calling the effective changing function based on the effective changing function. When there are a plurality of effective alteration functions, the call function acquiring module 20 needs to acquire the call functions corresponding to the respective effective alteration functions.
The regression test range determining module 30 is configured to determine a change interface function list according to all the effective change functions and all the call functions, and determine a regression test range according to the change interface function list;
the regression test range determining module 30 collects all the effective modification functions and the calling functions, and screens out the interface functions therein, i.e. obtains the modification interface function list. After obtaining the modified interface function list, the regression test range determining module 30 may determine a regression test range according to the modified interface function list, where the regression test range includes all the modified interface functions in the modified interface function list.
The regression testing module 40 is configured to perform regression testing according to the regression testing range.
After the regression test range is obtained, the regression test module 40 may perform the regression test according to the regression test range.
The embodiment of the invention determines the list of the affected interface functions by analyzing the source code change, further accurately determines the regression test range, and solves the problems of low cost and efficiency of regression test caused by the fact that the regression test range of the software project is not well determined in the continuous integration process under the micro service architecture; the accuracy and the efficiency of the regression test are greatly improved, and the test cost is obviously reduced.
Further, based on the above embodiment, when the effective change function obtaining module 10 is configured to obtain an effective change function, specifically: acquiring a changed file which is changed; and acquiring the effective change function according to the change file.
The effective change function obtaining module 10 obtains the changed file, and obtains the effective change function according to the changed 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 functions with effective changes from all the changes, namely obtaining the effective change functions.
On the basis of the embodiment, the embodiment of the invention obtains the effective change function by changing the file, thereby improving the obtaining efficiency and the accuracy of the effective change function and further improving the efficiency and the accuracy of the regression test.
Further, based on the above embodiment, when the effective change function obtaining module 10 is configured to obtain the effective change function according to the change file, specifically: acquiring all effective changes appearing in the change file, and dividing all effective changes into function changes, class variable changes and annotation changes; acquiring a first class of change functions according to the change of the function, acquiring a second class of change functions according to the change of the class variable, and acquiring a third class of change functions according to the change of the annotation; and obtaining the effective change function according to the first type change function, the second type change function and the third type change function.
After the valid change function obtaining module 10 obtains the change file, all valid changes occurring in the change file are obtained according to the change file, the valid changes are classified, and each valid change is divided 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 type 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 annotated scope.
The effective change function obtaining module 10 obtains the effective change function according to the first type of change function, the second type of change function and the third type of change function; the effective change functions comprise the first type of change function, the second type of change function and the third type of change function.
On the basis of the above embodiment, the embodiment of the present invention further improves the efficiency and accuracy of obtaining the effective alteration function by dividing all effective alterations into the alteration of a function, the alteration of a class variable, and the alteration of an annotation, and obtaining the effective alteration function according to the three alterations, thereby further improving the efficiency and accuracy of the regression test.
Further, based on the above embodiment, when the effective change function obtaining module 10 is configured to obtain the effective change function according to the first type change function, the second type change function, and the third type change function, specifically: and removing the duplication of the first type of change function, the second type of change function and the third type of change function after merging to obtain the effective change function.
The effective modification function obtaining module 10 may remove duplicate after the first type modification function, the second type modification function, and the third type modification function are merged to obtain the effective modification function, so as to avoid repeated processing on the same effective modification function.
On the basis of the above embodiment, in the embodiment of the present invention, the effective alteration function is obtained by removing duplication after merging the first type alteration function, the second type alteration function, and the third type alteration function, so that the efficiency of the regression test is further improved.
Further, based on the above embodiment, when the calling function obtaining module 20 is configured to obtain, based on the effective changing function, a calling function that directly and indirectly calls the effective changing function, the calling function obtaining module is specifically configured to: based on the effective change function, acquiring the call function for directly and indirectly calling the effective change function by constructing a function call relation multi-branch tree; wherein the function call relation multi-way tree includes the effective change function and the call function.
The calling function obtaining module 20 obtains the calling functions for directly and indirectly calling the effective changing functions by constructing a function calling relation multi-way tree based on the effective changing functions. Wherein the function call relation multi-way tree includes the effective change function and the call function.
On the basis of the embodiment, the embodiment of the invention acquires the calling function for directly and indirectly calling the effective change function by constructing the function calling relation multi-branch tree, thereby ensuring the comprehensive acquisition of the calling function and improving the accuracy of the regression test.
Further, based on the above embodiment, when the regression test range determining module 30 is configured to determine the change interface function list according to all the effective change functions and all the call functions, it is specifically configured to: comparing the effective change function and the call function in the function call relation multi-branch tree with an interface function list determined under the current micro service item by traversing the function call relation multi-branch tree to obtain an interface function in each function call relation multi-branch 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 test range determining module 30 compares 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 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; one or more interface functions in each function call relation multi-branch tree; and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
On the basis of the embodiment, the embodiment of the invention further improves the efficiency and the accuracy of the regression test by acquiring the change interface function list through traversing the function call relation multi-way tree.
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 provide an evaluation result.
In order to ensure the comprehensive reliability of the regression test, the device also comprises an evaluation module. After the regression test is carried out according to the regression test range, the evaluation module evaluates whether the regression test covers the regression test range according to the test completion condition and gives an evaluation result.
On the basis of the above embodiment, in the embodiment of the present invention, after the regression test is performed according to the regression test range, whether the regression test covers the regression test range is evaluated, and an evaluation result is given, so that the reliability of the regression test is improved.
The apparatus provided in the embodiment of the present invention is used for the method, and specific functions may refer to the method flow described above, which is not described herein again.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An accurate regression testing method under a micro-service architecture is characterized by comprising the following steps:
obtaining an effective change function, wherein the effective change function is a function which is effectively changed;
acquiring a calling function for directly and indirectly calling the effective changing function based on the effective changing function;
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 performing regression testing according to the regression testing range.
2. The method according to claim 1, wherein the obtaining the effective change function specifically includes:
acquiring a changed file which is changed;
and acquiring the effective change function according to the change file.
3. The method according to claim 2, wherein the obtaining the effective change function according to the change file specifically includes:
acquiring all effective changes appearing in the change file, and dividing all effective changes into function changes, class variable changes and annotation changes;
acquiring a first class of change functions according to the change of the function, acquiring a second class of change functions according to the change of the class variable, and acquiring a third class of change functions according to the change of the annotation;
and obtaining the effective change function according to the first type change function, the second type change function and the third type change function.
4. The method according to claim 3, wherein the obtaining the effective change function according to the first type of change function, the second type of change function, and the third type of change function includes:
and removing the duplication of the first type of change function, the second type of change function and the third type of change function after merging to obtain the effective change function.
5. The method according to claim 1, wherein the obtaining a calling function that directly and indirectly calls the effective alteration function based on the effective alteration function specifically comprises:
based on the effective change function, acquiring the call function for directly and indirectly calling the effective change function by constructing a function call relation multi-branch tree;
wherein the function call relation multi-way tree includes the effective change function and the call function.
6. The method according to claim 5, wherein determining a change interface function list according to all the valid change functions and all the call functions comprises:
comparing the effective change function and the call function in the function call relation multi-branch tree with an interface function list determined under the current micro service item by traversing the function call relation multi-branch tree to obtain an interface function in each function call relation multi-branch tree;
and the collection of the interface functions in all the function call relation multi-way trees forms the change interface function list.
7. The method of claim 1, wherein after the performing the regression test according to the regression test range, the method further comprises:
and evaluating whether the regression test covers the regression test range or not, and giving an evaluation result.
8. 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 steps of the method according to any of claims 1 to 7 are implemented when the processor executes the program.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. An apparatus for performing an accurate regression test 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 which is effectively changed;
a calling function obtaining module, configured to obtain, based on the effective changing function, a calling function for directly and indirectly calling the effective changing function;
the regression testing 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 testing 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.
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 true CN111258876A (en) 2020-06-09
CN111258876B 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)

Cited By (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 (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030018932A1 (en) * 2001-07-21 2003-01-23 International Business Machines Corporation Method and system for performing automated regression tests in a state-dependent data processing system
CN101286119A (en) * 2008-05-27 2008-10-15 华耀环宇科技(北京)有限公司 Method for determining function point changing through code analysis
US20090199161A1 (en) * 2008-01-31 2009-08-06 Computer Associates Think, Inc. System and method for repeating program flow for debugging and testing
CN103176895A (en) * 2011-12-22 2013-06-26 阿里巴巴集团控股有限公司 Method and system of regression testing
CN103377121A (en) * 2012-04-24 2013-10-30 百度在线网络技术(北京)有限公司 Method and device for detecting coupling risks
CN103678097A (en) * 2012-09-05 2014-03-26 百度在线网络技术(北京)有限公司 Method and device for selecting regression test case
CN103699488A (en) * 2013-12-30 2014-04-02 优视科技有限公司 Call relation dependence graph based regression testing method and system
US8806450B1 (en) * 2008-06-26 2014-08-12 Juniper Networks, Inc. Static analysis in selective software regression testing
US20150254173A1 (en) * 2014-03-07 2015-09-10 Ca, Inc. Automated generation of test cases for regression testing
CN105159715A (en) * 2015-09-01 2015-12-16 南京大学 Python code change reminding method on basis of abstract syntax tree node change extraction
CN105302720A (en) * 2015-10-27 2016-02-03 浪潮电子信息产业股份有限公司 Software regression test case screening method
CN105389262A (en) * 2015-12-23 2016-03-09 北京奇虎科技有限公司 Method and device for generating test suggestions in allusion to interface tests
CN106021103A (en) * 2016-05-16 2016-10-12 南京大学 Code change-based mobile application test script automatic maintenance method
CN107273281A (en) * 2016-04-06 2017-10-20 阿里巴巴集团控股有限公司 Service interface test method, system based on code change
CN108804326A (en) * 2018-06-12 2018-11-13 上海新炬网络技术有限公司 A kind of software code automatic testing method
CN108829575A (en) * 2018-04-17 2018-11-16 平安科技(深圳)有限公司 Test cases recommended method, electronic device and readable storage medium storing program for executing
CN108874652A (en) * 2017-05-09 2018-11-23 北京京东尚科信息技术有限公司 It tests and assesses certainly the method, apparatus estimated and electronic equipment for software

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030018932A1 (en) * 2001-07-21 2003-01-23 International Business Machines Corporation Method and system for performing automated regression tests in a state-dependent data processing system
US20090199161A1 (en) * 2008-01-31 2009-08-06 Computer Associates Think, Inc. System and method for repeating program flow for debugging and testing
CN101286119A (en) * 2008-05-27 2008-10-15 华耀环宇科技(北京)有限公司 Method for determining function point changing through code analysis
US8806450B1 (en) * 2008-06-26 2014-08-12 Juniper Networks, Inc. Static analysis in selective software regression testing
CN103176895A (en) * 2011-12-22 2013-06-26 阿里巴巴集团控股有限公司 Method and system of regression testing
CN103377121A (en) * 2012-04-24 2013-10-30 百度在线网络技术(北京)有限公司 Method and device for detecting coupling risks
CN103678097A (en) * 2012-09-05 2014-03-26 百度在线网络技术(北京)有限公司 Method and device for selecting regression test case
CN103699488A (en) * 2013-12-30 2014-04-02 优视科技有限公司 Call relation dependence graph based regression testing method and system
US20150254173A1 (en) * 2014-03-07 2015-09-10 Ca, Inc. Automated generation of test cases for regression testing
CN105159715A (en) * 2015-09-01 2015-12-16 南京大学 Python code change reminding method on basis of abstract syntax tree node change extraction
CN105302720A (en) * 2015-10-27 2016-02-03 浪潮电子信息产业股份有限公司 Software regression test case screening method
CN105389262A (en) * 2015-12-23 2016-03-09 北京奇虎科技有限公司 Method and device for generating test suggestions in allusion to interface tests
CN107273281A (en) * 2016-04-06 2017-10-20 阿里巴巴集团控股有限公司 Service interface test method, system based on code change
CN106021103A (en) * 2016-05-16 2016-10-12 南京大学 Code change-based mobile application test script automatic maintenance method
CN108874652A (en) * 2017-05-09 2018-11-23 北京京东尚科信息技术有限公司 It tests and assesses certainly the method, apparatus estimated and electronic equipment for software
CN108829575A (en) * 2018-04-17 2018-11-16 平安科技(深圳)有限公司 Test cases recommended method, electronic device and readable storage medium storing program for executing
CN108804326A (en) * 2018-06-12 2018-11-13 上海新炬网络技术有限公司 A kind of software code automatic testing method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
搜狗测试: "[小白讲白盒]初篇:测试范围评估", Retrieved from the Internet <URL:https://www.sohu.com/a/107915600_216613> *
郑锦勤;牟永敏;: "基于函数调用路径的回归测试用例选择排序方法研究", 计算机应用研究, no. 07, pages 149 - 153 *

Cited By (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

Also Published As

Publication number Publication date
CN111258876B (en) 2023-08-01

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
Potdar et al. An exploratory study on self-admitted technical debt
Brito et al. APIDiff: Detecting API breaking changes
CN103092761B (en) Method and device of recognizing and checking modifying code blocks based on difference information file
US9619373B2 (en) Method and apparatus to semantically connect independent build and test processes
CN108763091B (en) Method, device and system for regression testing
US8769501B2 (en) Method for analyzing changes in a software code and software analysis system
CN111258876A (en) Accurate regression testing method and device under micro-service architecture
CN110019067A (en) A kind of log analysis method and system
CN111859047A (en) Fault solving method and device
CN110990282B (en) Automatic unit testing method
Aversano et al. Evaluating architecture stability of software projects
CN111966597A (en) Test data generation method and device
CN114490413A (en) Test data preparation method and device, storage medium and electronic equipment
CN108897678B (en) Static code detection method, static code detection system and storage device
CN109063040B (en) Client program data acquisition method and system
CN111858292A (en) Screening method, screening system, computer device and storage medium of test case
CN112434831A (en) Troubleshooting method and device, storage medium and computer equipment
CN109508203B (en) Method, device and system for determining version consistency
CN111193631B (en) Information processing method, system, and computer-readable storage medium
Şora Finding the right needles in hay helping program comprehension of large software systems
Aktaş et al. A learning-based bug predicition method for object-oriented systems
CN117667643A (en) Evolution method and device of test case set, computing device cluster and storage medium
CN113672509A (en) Automatic testing method, device, testing platform and storage medium

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