CN117573510A - Software testing method, device, terminal equipment and storage medium - Google Patents
Software testing method, device, terminal equipment and storage medium Download PDFInfo
- Publication number
- CN117573510A CN117573510A CN202311364071.5A CN202311364071A CN117573510A CN 117573510 A CN117573510 A CN 117573510A CN 202311364071 A CN202311364071 A CN 202311364071A CN 117573510 A CN117573510 A CN 117573510A
- Authority
- CN
- China
- Prior art keywords
- analysis result
- interface call
- interface
- call analysis
- code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000013522 software testing Methods 0.000 title claims abstract description 76
- 238000000034 method Methods 0.000 title claims abstract description 75
- 238000003860 storage Methods 0.000 title claims abstract description 12
- 238000004458 analytical method Methods 0.000 claims abstract description 244
- 230000008859 change Effects 0.000 claims abstract description 88
- 238000012360 testing method Methods 0.000 claims description 55
- 239000011159 matrix material Substances 0.000 claims description 14
- 238000012545 processing Methods 0.000 claims description 13
- 238000011144 upstream manufacturing Methods 0.000 claims description 10
- 230000002776 aggregation Effects 0.000 claims description 7
- 238000004220 aggregation Methods 0.000 claims description 7
- 238000010845 search algorithm Methods 0.000 claims description 5
- 230000006870 function Effects 0.000 description 12
- 230000008569 process Effects 0.000 description 10
- 230000004044 response Effects 0.000 description 6
- 230000002159 abnormal effect Effects 0.000 description 4
- 230000006399 behavior Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000007418 data mining Methods 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 238000011990 functional testing Methods 0.000 description 2
- 238000010234 longitudinal analysis Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 238000011056 performance test Methods 0.000 description 2
- 230000008439 repair process Effects 0.000 description 2
- 238000007619 statistical method Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011981 development test Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000004573 interface analysis Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000012502 risk assessment Methods 0.000 description 1
- 238000011076 safety test Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy 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 invention discloses a software testing method, a device, terminal equipment and a storage medium, wherein the method comprises the following steps: performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result; and performing software testing according to the global influence analysis result to obtain a software testing result. According to the method, the system interface call analysis is carried out through the codes of the initial version and the changed version, and the system link log is subjected to the system interface call analysis, so that the global influence analysis result is obtained to carry out the software test, the software test result is obtained, the global influence analysis of the code change during the software test is realized, and the accuracy of the software test is improved.
Description
Technical Field
The present invention relates to the field of software testing, and in particular, to a software testing method, a device, a terminal device, and a storage medium.
Background
With the increasing size and complexity of software systems, software testing has become increasingly important, and code analysis techniques for software testing have developed, whereby code change impact analysis can find problems or potential errors in code by analyzing the impact ranges of different versions of the code before and after the code change.
However, in the current software test, only single system code change and an affected interface are focused on analysis of the code change influence, when a call relation exists among a plurality of systems, the influence range of the change of the single system code on other systems is ignored, and the analysis of the global influence range of the code change is not realized, so that the reliability of the evaluation of the software test range is reduced.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The main purpose of the application is to provide a software testing method, a device, a terminal device and a storage medium, which aim to solve the problem that code change has no global influence on analysis in software testing.
In order to achieve the above object, the present application provides a software testing method, including:
Performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result;
performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result;
acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and performing software testing according to the global influence analysis result to obtain a software testing result.
Optionally, the step of performing intra-system interface call analysis according to the pre-acquired version source code, and generating an intra-system interface call analysis result includes:
comparing the initial version code with the changed version code to obtain a comparison result;
identifying according to the comparison result to obtain changed interface information;
and generating an interface call analysis result in the system according to the interface change information.
Optionally, the step of identifying according to the comparison result and obtaining the change interface information includes:
according to the comparison result, grammar compiling is carried out on the changed version codes, and a code grammar tree is constructed;
Acquiring a call relationship in the system according to the code grammar tree;
analyzing the annotation of the changed version code to acquire external interface information;
and identifying the external interface information through a preset depth-first search algorithm according to a change method in the call relation in the system, and obtaining corresponding change interface information.
Optionally, the step of performing intersystem interface call analysis according to the pre-acquired system link log and generating an intersystem interface call analysis result further includes:
when a call request between an upstream system and a downstream system is received, generating a identifier corresponding to the call request;
generating system link information according to the identifier;
and acquiring a link log through a preset real-time stream processing frame according to the system registration link information to acquire a system link log.
Optionally, the step of performing intersystem interface call analysis according to the pre-acquired system link log, and generating an intersystem interface call analysis result includes:
carrying out association aggregation on the system link logs according to the identifier to obtain summarized log data;
calculating according to the summarized log data to obtain an interface calling relation between systems;
And generating an intersystem interface call analysis result according to the intersystem interface call relation.
Optionally, the step of obtaining the global impact analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result includes:
analyzing by combining the interface information of the change of the interface call analysis result in the system and the interface call relation between the systems of the interface call analysis result between the systems to generate a global influence range matrix;
and acquiring a global influence analysis result according to the global influence range matrix.
Optionally, the step of performing a software test according to the global impact analysis result, and obtaining a software test result includes:
acquiring system change service information according to the global influence analysis result;
summarizing the business log data in the system link log to obtain business index baseline data;
generating a test case according to the system change service information and the service index baseline data;
and testing according to the test cases to obtain software test results.
The embodiment of the application also provides a software testing device, which comprises:
The system internal interface call analysis module is used for carrying out system internal interface call analysis according to the pre-acquired initial version code and the modified version code to generate a system internal interface call analysis result;
the system interface call analysis module is used for carrying out system interface call analysis according to a pre-acquired system link log to generate a system interface call analysis result;
the global change influence analysis module is used for acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and the software testing module is used for carrying out software testing according to the global influence analysis result to obtain a software testing result.
The embodiment of the application also provides a terminal device, which comprises a memory, a processor and a software test program stored on the memory and capable of running on the processor, wherein the software test program realizes the steps of the software test method when being executed by the processor.
The embodiments of the present application also provide a computer-readable storage medium having stored thereon a software test program which, when executed by a processor, implements the steps of the software test method as described above.
According to the software testing method, the device, the terminal equipment and the storage medium, the intra-system interface call analysis is carried out according to the pre-acquired initial version code and the modified version code, and the intra-system interface call analysis result is generated; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result; and performing software testing according to the global influence analysis result to obtain a software testing result. According to the method, the system interface call analysis is carried out through the codes of the initial version and the changed version, and the system link log is subjected to the system interface call analysis, so that the global influence analysis result is obtained to carry out the software test, the software test result is obtained, the global influence analysis of the code change during the software test is realized, and the accuracy of the software test is improved.
Drawings
FIG. 1 is a schematic diagram of functional modules of a terminal device to which a software testing apparatus of the present application belongs;
FIG. 2 is a flow chart of a first exemplary embodiment of a software testing method of the present application;
FIG. 3 is a flow chart of a second exemplary embodiment of a software testing method of the present application;
FIG. 4 is a schematic flow chart of the software testing method of the present application for analyzing the version codes before and after modification to obtain the external influence interface;
FIG. 5 is a flow chart of a third exemplary embodiment of a software testing method of the present application;
FIG. 6 is a schematic flow chart of the software testing method of the present application for realizing link information registration of a distributed system;
FIG. 7 is a flow chart of the software testing method of the present application for analyzing interface call relationships between systems using a transaction system as an example;
FIG. 8 is a flow chart of a fourth exemplary embodiment of a software testing method of the present application;
FIG. 9 is a flow chart of an example of global impact analysis of code changes for the software test method of the present application.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The main solutions of the embodiments of the present application are:
performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result; and performing software testing according to the global influence analysis result to obtain a software testing result. According to the method, the system interface call analysis is carried out through the codes of the initial version and the changed version, and the system link log is subjected to the system interface call analysis, so that the global influence analysis result is obtained to carry out the software test, the software test result is obtained, the global influence analysis of the code change during the software test is realized, and the accuracy of the software test is improved.
In the embodiment of the application, considering that the related technical scheme only focuses on the interfaces with changed and influenced codes of the system, when a call relationship exists among a plurality of systems, the influence of the transformation of a single system on other related systems cannot be accurately identified, so that the evaluation reliability of the software testing range is reduced. The interface method provided by the manual identification mark system can be wrong, and meanwhile, the interface method provided by the system can not be called by an external system, so that unnecessary analysis and test work is increased.
Based on the above, the embodiment of the application provides a solution, which automatically marks the internal and external interfaces of the system by analyzing source codes, identifying labels and the like, analyzes the call relationship of codes in the system, confirms the external interfaces influenced by the changed codes, identifies the call relationship of interfaces between the systems by introducing a link log, and confirms the global influence of the changed codes by the call relationship between the internal and external interfaces of the system and the interface between the systems.
Specifically, referring to fig. 1, fig. 1 is a schematic diagram of functional modules of a terminal device to which the software testing apparatus of the present application belongs. The software testing device may be a device independent of the terminal device, capable of performing software testing, which may be carried on the terminal device in the form of hardware or software. The terminal equipment can be intelligent mobile equipment with a software testing function such as a mobile phone and a tablet personal computer, and can also be fixed terminal equipment or a server with the software testing function.
In this embodiment, the terminal device to which the software testing apparatus belongs at least includes an output module 110, a processor 120, a memory 130, and a communication module 140.
The memory 130 stores an operating system and a software test program, and the software test device may store the received and processed data information in the memory 130; the output module 110 may be a display screen, a speaker, etc. The communication module 140 may include a WIFI module, a mobile communication module, a bluetooth module, and the like, and communicates with an external device or a server through the communication module 140.
Wherein the software testing program in the memory 130 when executed by the processor performs the steps of:
performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result;
performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result;
acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and performing software testing according to the global influence analysis result to obtain a software testing result.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
comparing the initial version code with the changed version code to obtain a comparison result;
identifying according to the comparison result to obtain changed interface information;
and generating an interface call analysis result in the system according to the interface change information.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
according to the comparison result, grammar compiling is carried out on the changed version codes, and a code grammar tree is constructed;
acquiring a call relationship in the system according to the code grammar tree;
analyzing the annotation of the changed version code to acquire external interface information;
and identifying the external interface information through a preset depth-first search algorithm according to a change method in the call relation in the system, and obtaining corresponding change interface information.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
when a call request between an upstream system and a downstream system is received, generating a identifier corresponding to the call request;
generating system link information according to the identifier;
And acquiring a link log through a preset real-time stream processing frame according to the system registration link information to acquire a system link log.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
carrying out association aggregation on the system link logs according to the identifier to obtain summarized log data;
calculating according to the summarized log data to obtain an interface calling relation between systems;
and generating an intersystem interface call analysis result according to the intersystem interface call relation.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
analyzing by combining the interface information of the change of the interface call analysis result in the system and the interface call relation between the systems of the interface call analysis result between the systems to generate a global influence range matrix;
and acquiring a global influence analysis result according to the global influence range matrix.
Further, the software testing program in the memory 130, when executed by the processor, further performs the steps of:
acquiring system change service information according to the global influence analysis result;
summarizing the business log data in the system link log to obtain business index baseline data;
Generating a test case according to the system change service information and the service index baseline data;
and testing according to the test cases to obtain software test results.
According to the scheme, in particular, the system internal interface call analysis is carried out according to the pre-acquired initial version code and the modified version code, and a system internal interface call analysis result is generated; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; and acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result. According to the invention, the intra-system interface call analysis is carried out through the codes of the initial version and the changed version, the inter-system interface call analysis is carried out on the system link log, and the global influence analysis result is obtained by utilizing the intra-system interface call analysis result and the inter-system interface call analysis result, so that the global influence analysis of the code change is realized, and the accuracy of the code change influence analysis is improved.
Based on the above terminal device architecture, but not limited to the above architecture, the method embodiments of the present application are presented.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first exemplary embodiment of the software testing method of the present application. The software testing method is applied to a distributed system and comprises the following steps:
Step S10: performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result;
the execution subject of the method of this embodiment may be a software testing system, or may be a software testing device or terminal device, and this embodiment uses a software testing system as an example, where the software testing system may be integrated on a terminal device having a data processing function.
Testing is required before the code update is formally online, and analysis is required according to the influence scope of the code update so as to formulate a test case. In a distributed system, a plurality of systems are in communication connection through interfaces to jointly complete specific tasks or provide services, and inter-system interface calls may have a dependency relationship, and the change of one system may affect other systems, so that the analysis of the influence range of code update is mainly performed around the interfaces.
And carrying out interface call analysis in the system according to the pre-update primary version code and the updated change version code to obtain an interface call analysis result in the system. The step mainly involves static analysis of the code, and the analysis process can be to determine the call influence of the change on the internal interface of the system by analyzing the change of the call relation of classes, methods and the like in different versions of the code. For example, it may be identified which interfaces have been modified, added, deleted, and call paths and parameter changes for these interfaces, etc.
Step S20: performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result;
and analyzing the actual interface calling condition of each system in operation through the collected system link log data, and knowing the interface calling relation among different modules. The interface calling relation among different systems is analyzed, so that the influence condition of the change on the interface calling among the systems is known. By analyzing the data such as the system link log, the direct or indirect interface call between the systems can be determined, the call path is tracked, and whether the interface call between the systems is changed due to the change is judged. By analyzing this data, the impact of changes on inter-system interface calls can be determined. For example, it may be found that the interface of one system invokes the interface of another system, and the interface changes, resulting in the invoked system also being affected.
The system interface call analysis is very important for maintenance and evolution of the distributed system, can help developers to accurately evaluate the influence range of code change, avoid unnecessary problems and faults, and improve the overall stability and maintainability of the system.
Step S30: acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and according to the intra-system interface call analysis result and the inter-system interface call analysis result, obtaining a global influence analysis result. And identifying the influence range of the code change on the whole distributed system by considering the analysis results of the call of the interfaces inside and outside the system. In addition, the global influence analysis result can be utilized to generate an interface call relation graph, a dependency relation graph and the like for visual analysis, so that testers can understand the global influence of code change and make corresponding decisions, and if which modules need to be modified, which functions need to be retested and the like, the code change influence analysis is realized, and further the code version management and test are realized, and potential risks and problems are reduced.
Step S40: and performing software testing according to the global influence analysis result to obtain a software testing result.
And performing software testing according to the global influence analysis result to obtain a software testing result. The method comprises the steps of determining the key point and the test strategy of a test according to a global influence analysis result, providing a changed influence range and type, helping to determine the type of the test to be performed, such as a functional test, an integrated test, a performance test, a safety test and the like, and further making a corresponding test plan to ensure the comprehensiveness and the effectiveness of the test. Through reasonable in design's test case, can cover different scenes and boundary conditions of system to verify whether the action of system after the change accords with expecting, in time discover and solve potential problem, improve software system's quality and stability, promote user experience.
According to the scheme, the intra-system interface call analysis is carried out according to the pre-acquired initial version code and the modified version code, and an intra-system interface call analysis result is generated; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result; and performing software testing according to the global influence analysis result to obtain a software testing result. According to the method, the system interface call analysis is carried out through the codes of the initial version and the changed version, and the system link log is subjected to the system interface call analysis, so that the global influence analysis result is obtained to carry out the software test, the software test result is obtained, the global influence analysis of the code change during the software test is realized, and the accuracy of the software test is improved.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second exemplary embodiment of the software testing method according to the present invention.
Based on the first embodiment, a second embodiment of the present application is presented, which differs from the first embodiment in that:
in this embodiment, the step of performing intra-system interface call analysis according to the pre-acquired version source code, and generating an intra-system interface call analysis result includes:
Step S101: comparing the initial version code with the changed version code to obtain a comparison result;
step S102: identifying according to the comparison result to obtain changed interface information;
step S103: and generating an interface call analysis result in the system according to the interface change information.
Specifically, in order to analyze the influence of code modification on the call in the system interface, first, the initial version code and the modified version code are compared to obtain a comparison result. The comparison may be performed by a version control tool or a comparison tool, for example, using Git for code comparison. By comparison, it can be determined which specific changes, including new, modified or deleted code lines, have occurred between the initial version and the changed version, and the comparison result may include contents such as change file information, change start/end line number, and changed code.
And then, identifying the interface affected by the change based on the comparison result, and obtaining related change interface information. The change interface may be an external interface of a system for calling code units such as functions, methods, classes and modules to realize service functions, the change interface may be modified, added or deleted due to code change, the comparison result is identified, change interface information may be obtained according to rules such as grammar and semantics, and the change interface information may include information such as position, parameter, return value type and the like of the change interface.
And finally, utilizing the obtained changed interface information and combining other related information in the code base to generate an intra-system interface calling analysis result. The analysis result of the interface call in the system shows the influence condition of the code change on the interface call outside the system. For example, other classes or methods that invoke a change interface, as well as code segments that need to be updated, may be detected. The system can identify the affected code part according to the information such as the calling relation, the dependency relation and the like, and helps a developer understand the influence range of code change on calling in the system.
Further, as an implementation manner, the step of identifying according to the comparison result and obtaining the change interface information includes:
step S1021: according to the comparison result, grammar compiling is carried out on the changed version codes, and a code grammar tree is constructed;
step S1022: acquiring a call relationship in the system according to the code grammar tree;
step S1023: analyzing the annotation of the changed version code to acquire external interface information;
step S1024: and identifying the external interface information through a preset depth-first search algorithm according to a change method in the call relation in the system, and obtaining corresponding change interface information.
Specifically, first, the modified version code is compiled in grammar, and a code syntax tree is constructed. The grammar compiling is to perform operations such as lexical analysis and grammar analysis on a source code to construct a code grammar tree of the code, the code grammar tree represents the structure and organization mode of the code, the code can be represented in a hierarchical structure, each grammar unit (such as functions, methods, classes, variables and the like) of the code is represented by nodes and edges, nesting and relations among the grammar units are convenient for subsequent analysis operations, and the constructed code grammar tree can be an abstract grammar tree (AST).
And then, obtaining the calling relation in the system according to the code grammar tree. The call relation among the code units in the code can be analyzed based on the code grammar tree, and by analyzing the nodes and edges of the grammar tree, the code units can be determined to call other code units or be called by other code units, and a call relation diagram among the system codes can be established, so that the understanding of the call flow in the system is facilitated.
Then, the annotation in the modified version code is parsed to obtain the information of the external interface. Where annotations are typically used to describe and describe code, the annotations may contain information such as references to external interfaces, descriptions, or call patterns. By resolving the code annotation, relevant external interface information can be extracted to help understand the association of the modified version code with the external interface.
And finally, according to a method for changing in the call relation in the system, identifying external interface information through a depth-first search algorithm, and identifying changed interface information. The method for changing the call relationship in the system is analyzed, and the external interface information is combined for matching, so that the code units are changed interfaces, and relevant changed interface information such as interface positions, parameters, return values and the like can be obtained.
More specifically, as shown in fig. 4, fig. 4 is a schematic flow chart of analyzing the version code before and after the change to obtain the external influence interface, and the steps include:
first, the code of the latest initial version on the line and the latest changed version of the test environment is acquired.
Then, by comparing two codes, the changes of the front version and the rear version are analyzed, a changed file is obtained, and the line numbers of the beginning and the ending of the changes and the changed code content are obtained.
Then compiling the source code of the latest version, constructing a grammar tree, and structuring and storing the method call relation in the program in a graph mode.
The code annotations are then analyzed, automatically identifying the externally provided interface of the program.
And finally, identifying the affected external interface through a depth-first search method by structuring the stored method calling relation and the identified changed method.
According to the embodiment, through the scheme, specifically, the initial version code and the changed version code are compared, and a comparison result is obtained; identifying according to the comparison result to obtain changed interface information; and generating an interface call analysis result in the system according to the interface change information. The longitudinal analysis of the code calling relationship in the system is realized, the external interface influenced by the changed code is confirmed, corresponding processing and adjustment are carried out, and the stability, the correctness and the consistency of the system after the code is changed are ensured.
Referring to fig. 5, fig. 5 is a flowchart illustrating a third exemplary embodiment of a software testing method according to the present invention.
Based on the first embodiment, a third embodiment of the present application is presented, which differs from the first embodiment in that:
in this embodiment, the step of performing the inter-system interface call analysis according to the pre-acquired system link log and generating the inter-system interface call analysis result further includes:
step S201: when a call request between an upstream system and a downstream system is received, generating a identifier corresponding to the call request;
step S202: generating system link information according to the identifier;
step S203: and acquiring a link log through a preset real-time stream processing frame according to the system registration link information to acquire a system link log.
Specifically, to achieve analysis of interface call relationships between systems, first, in order to accurately track and distinguish different call requests in subsequent link tracking and analysis, a flag is generated for each request when a call request between upstream and downstream systems is received. Wherein the identifier may be a unique UUID or other unique string.
Then, link information of the system to which each call request relates is obtained from the generated identifier. The system link information may include information such as an identifier of the call request, a name of the calling party system, a name of the called party system, an interface name, and a call time, and may be implemented by storing the information in a log file, a database, or the like, or may be implemented by registering in a Kafka cluster.
And finally, acquiring a link log through a preset real-time stream processing frame to acquire a system link log. The real-time stream processing framework can be a real-time data stream processing framework similar to Apache Kafka or Apache Flink, can receive and process a large amount of system log data, can realize efficient data filtering, conversion, aggregation and other operations, can meet the requirements of instantaneity and expandability, and helps testers to better understand and optimize inter-system interface call. In this step, the log data may be filtered and matched by calling the request identifier to determine the call link and detailed call information related to each request, and the obtained system link log will be used as the basic data for the subsequent inter-system interface call analysis.
Further, as an implementation manner, the step of performing inter-system interface call analysis according to the pre-acquired system link log, and generating an inter-system interface call analysis result includes:
step S204: carrying out association aggregation on the system link logs according to the identifier to obtain summarized log data;
step S205: calculating according to the summarized log data to obtain an interface calling relation between systems;
step S206: and generating an intersystem interface call analysis result according to the intersystem interface call relation.
Specifically, first, a link log of the system is subjected to association aggregation operation according to the identifier, so as to obtain summarized log data. The corresponding log records are filtered and associated according to the identifier of each call request so as to collect the system log data related to the call request, and the collected log data can include but is not limited to: system identification, interface information, etc. The aggregate operations may include organization of data by system identification, interfaces, identifiers of different call requests, removal of duplicate logs, and so forth.
And then, calculating according to the summarized log data to obtain the relation called by the interface between the systems. Wherein, by analyzing the call link information in the summary log data, the call relation among the systems, such as which system calls the interface of which system, can be determined. The calculation mode can be implemented by methods such as statistical analysis, data mining algorithm and the like so as to obtain a comprehensive interface calling relationship between systems.
And finally, generating an interface calling analysis result between the systems according to the interface calling relation between the systems. Various forms of analysis reports, charts, or visual presentations may be generated as needed for presenting relationships and performance metrics for interface calls within the system, and analysis results may include, but are not limited to: call directed graphs among systems, hot spot interface analysis, abnormal call analysis, performance optimization suggestions and the like.
More specifically, as shown in fig. 6, fig. 6 is a schematic flow chart of implementing link information registration by the distributed system, and specific steps include:
a) When a request enters the system, a globally unique identifier is generated for the request as a flag for the request.
b) When the system A calls the system B, the unique identifier is transmitted to the system B, the processing time, interface, server information, response code and the like of the system A are recorded, and the information returned by the system B, including the response code, response time, interface and the like of the system B, is recorded.
c) Each system registers link information to Kafka, and through the transmission of the unique identifier, a call link with complete service scene and time consuming and error reporting information among the systems can be constructed.
As shown in fig. 7, fig. 7 is a flow chart illustrating analysis of interface calling relations between systems by using a transaction system as an example, and uses SparkStreaming data processing to receive link logs of the transaction system, and finally aggregate the logs into summary data in system+interface+time dimension, wherein summary indexes include transaction number, success rate, response time, response code, error number and the like, and calculate baseline data of each index. According to the link logs registered by each system under the same identifier of the association aggregation, the upstream and downstream relations of interfaces in each system can be calculated, so that calling relations among interfaces of different systems are generated, and an inter-system interface calling directed graph is formed.
According to the scheme, particularly, when a call request between an upstream system and a downstream system is received, a identifier corresponding to the call request is generated; generating system registration link information according to the identifier; and acquiring a link log through a preset real-time stream processing frame according to the system registration link information to acquire a system link log. The tester can better know the calling condition of the interface between the systems to prepare test cases, so that the system performance is optimized, and the user experience is improved.
Referring to fig. 8, fig. 8 is a flowchart illustrating a fourth exemplary embodiment of a software testing method according to the present invention.
Based on the third embodiment, a fourth embodiment of the present application is presented, which differs from the third embodiment in that:
in this embodiment, the step of obtaining the global impact analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result includes:
step S301: analyzing by combining the interface information of the change of the interface call analysis result in the system and the interface call relation between the systems of the interface call analysis result between the systems to generate a global influence range matrix;
step S302: and acquiring a global influence analysis result according to the global influence range matrix.
Specifically, in order to implement global impact analysis, first, change interface information in an intra-system interface call analysis result and inter-system interface call relations in an inter-system interface call analysis result are combined and analyzed to generate a global impact range matrix, so as to determine which inter-system interface call relations are affected by changes of which interfaces in the system. All the changed interfaces can be marked in the interface call relation matrix, and the corresponding interface call relations among the systems can be further analyzed to determine the call nodes and links involved in the interfaces.
And finally, obtaining a global influence analysis result according to the global influence range matrix. The influence range can be aggregated and analyzed by methods such as statistical analysis, data mining algorithm and the like, so that a global influence analysis result is obtained. Global impact analysis results may include, but are not limited to: the number of the inter-system interface calling relations, the performance index change condition, the potential risk analysis and the like, which are influenced by the changed interfaces, can help the test to better know the global influence range of the code change, and further more accurately formulate corresponding optimization and test strategies.
Further, as an implementation manner, the step of performing a software test according to the global impact analysis result, and obtaining a software test result includes:
step S401: acquiring system change service information according to the global influence analysis result;
step S402: summarizing the business log data in the system link log to obtain business index baseline data;
step S403: generating a test case according to the system change service information and the service index baseline data;
step S404: and testing according to the test cases to obtain software test results.
Specifically, first, system change service information is acquired according to a global impact analysis result. The specific service functions and modules related to the system change can be further analyzed according to the change interface and the interface-interface calling relationship determined by the global influence analysis result, the system change service information comprises the affected service functions, the corresponding change range, the potential service function influence possibly caused and other information, and the influence range and the possible risk of the system change can be better understood through the acquisition of the system change service information.
And then, summarizing the business log data in the system link log to obtain business index baseline data. The service log in the system link log records detailed information and related service data called by corresponding interfaces of the system service function, and the service log data can be cleaned, aggregated and counted to obtain key service indexes of the system. The business index baseline data refer to basic values such as an average value or a range of business performance indexes which are displayed by the system in normal operation, are an important reference basis in the process of testing the performance of the system, and are collected and analyzed before the system is changed, so that a tester can be helped to check whether a test result meets expectations.
And then, generating test cases according to the system change business information and business index baseline data. According to the system change service information and the service index baseline data, the service function or module can be determined to be tested, the range of specific test cases is generated, the content of service data and the like required by the test can also comprise different test types required by interface test, functional test, performance test and the like, and a tester can write corresponding test cases according to requirements and guidance in a test range report so as to ensure comprehensive test and verification of system change. Business index baseline data typically includes various key performance indicators, user behavior indicators, business transaction indicators, and the like. The specific index may vary from one business scenario to another, for example:
performance index: such as request processing time, response time, throughput, etc., are used to measure the performance and efficiency of the system.
User behavior index: such as the number of user accesses, the number of active users, the retention rate of users, etc., for knowing the behavior habits and the use conditions of the users.
Business transaction index: such as order quantity, transaction amount, conversion rate, etc., for evaluating the operational status and profitability of the service.
And finally, testing according to the generated test case to obtain a software test result. When executing the test case, the automatic test tool can be used for simulating the behavior of an actual user to obtain a test result, and the test result can be success, failure or encountering a problem. A test case is considered successful if it performs smoothly and achieves the expected results. If the test case fails to execute, i.e. the result does not accord with the expected result, or an abnormal condition is encountered in the executing process, the test case is considered to be failed. The software test results comprise recording test case numbers, descriptions, execution results, time stamps, encountered problems, abnormal conditions and the like, and are used for counting and analyzing the overall conditions of the test and providing the overall conditions for developers to repair the problems when necessary. In addition, the stability and reliability of the system can be evaluated by counting the number of successful and failed test cases and calculating indexes such as the test passing rate. Meanwhile, for each failed test case, the reasons of the problems can be further analyzed according to the needs and provided for a developer to repair.
More specifically, as shown in fig. 9, fig. 9 is a schematic flow chart of an example of code change global impact analysis, and specific steps include:
And step 1, comparing and identifying the code changed in the current project as a system B-method B3 according to the code version.
And step 2, identifying an external interface 'system B-interface B2' of which the B system is affected based on the intra-system call relation analyzed in the step 10.
And step 3, analyzing the obtained inter-system interface call relationship through the step 20, and identifying that the system B-interface B2 affects the upstream system A-interface A1 and the system A-interface A2.
And 4, identifying that the system B-interface B2 affects the downstream system C-interface C3 and the system C-interface C4 through the inter-system interface call relation obtained through analysis in the step 20.
Through the steps 1-4, the upstream and downstream of the influence can be identified through the change of a certain method in the system, so that influence analysis is provided for development test, coverage test range is confirmed, and the like.
Based on the analyzed flow and baseline data, the affected interfaces and businesses are monitored and compared with the baseline data in the system production process, and abnormal conditions such as flow loss, success rate reduction and the like in the online process are accurately mastered. The external influence interface of the code change in the longitudinal analysis system, the interface calling relation between the systems and the affected external upstream and downstream systems and interfaces are transversely identified, and the matrix diagram is generated and displayed by longitudinal and transverse combination, so that the global influence range of the system change is visually presented.
According to the scheme, the method and the device specifically analyze through combining the change interface information of the intra-system interface call analysis result and the inter-system interface call relation of the inter-system interface call analysis result to generate a global influence range matrix; and acquiring a global influence analysis result according to the global influence range matrix. The method is beneficial to a tester to better evaluate the influence of the change on the system, and correspondingly adjusts the test strategy and the test cases so as to ensure comprehensive test coverage and the quality and stability of the software system.
In addition, the embodiment of the application also provides a software testing device, which comprises:
the system internal interface call analysis module is used for carrying out system internal interface call analysis according to the pre-acquired initial version code and the modified version code to generate a system internal interface call analysis result;
the system interface call analysis module is used for carrying out system interface call analysis according to a pre-acquired system link log to generate a system interface call analysis result;
the global influence analysis module is used for acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
And the software testing module is used for carrying out software testing according to the global influence analysis result to obtain a software testing result.
The principle and implementation process of the software test are implemented in this embodiment, please refer to the above embodiments, and are not repeated here.
In addition, the embodiment of the application also provides a terminal device, which comprises a memory, a processor and a software test program stored on the memory and capable of running on the processor, wherein the software test program realizes the steps of the software test method when being executed by the processor.
Because the software test program is executed by the processor and adopts all the technical schemes of all the embodiments, the software test program has at least all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a software test program, and the software test program realizes the steps of the software test method when being executed by a processor.
Because the software test program is executed by the processor and adopts all the technical schemes of all the embodiments, the software test program has at least all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
Compared with the prior art, the software testing method, the device, the terminal equipment and the storage medium provided by the embodiment of the application perform intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generate an intra-system interface call analysis result; performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result; acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result; and performing software testing according to the global influence analysis result to obtain a software testing result. According to the method, the system interface call analysis is carried out through the codes of the initial version and the changed version, and the system link log is subjected to the system interface call analysis, so that the global influence analysis result is obtained to carry out the software test, the software test result is obtained, the global influence analysis of the code change during the software test is realized, and the accuracy of the software test is improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.
Claims (10)
1. A software testing method, wherein the software testing method is applied to a distributed system, and comprises the following steps:
performing intra-system interface call analysis according to the pre-acquired initial version code and the modified version code, and generating an intra-system interface call analysis result;
performing intersystem interface call analysis according to a pre-acquired system link log to generate an intersystem interface call analysis result;
acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and performing software testing according to the global influence analysis result to obtain a software testing result.
2. The software testing method of claim 1, wherein the step of performing intra-system interface call analysis based on the pre-acquired version source code, and generating intra-system interface call analysis results comprises:
comparing the initial version code with the changed version code to obtain a comparison result;
identifying according to the comparison result to obtain changed interface information;
and generating an interface call analysis result in the system according to the interface change information.
3. The software testing method according to claim 2, wherein the step of identifying based on the comparison result and obtaining the change interface information includes:
According to the comparison result, grammar compiling is carried out on the changed version codes, and a code grammar tree is constructed;
acquiring a call relationship in the system according to the code grammar tree;
analyzing the annotation of the changed version code to acquire external interface information;
and identifying the external interface information through a preset depth-first search algorithm according to a change method in the call relation in the system, and obtaining corresponding change interface information.
4. The software testing method according to claim 1, wherein the step of performing intersystem interface call analysis based on the pre-acquired system link log, and generating an intersystem interface call analysis result further comprises:
when a call request between an upstream system and a downstream system is received, generating a identifier corresponding to the call request;
generating system link information according to the identifier;
and acquiring a link log through a preset real-time stream processing frame according to the system registration link information to acquire a system link log.
5. The software testing method of claim 4, wherein the step of performing an intersystem interface call analysis based on the pre-acquired system link log, and generating an intersystem interface call analysis result comprises:
Carrying out association aggregation on the system link logs according to the identifier to obtain summarized log data;
calculating according to the summarized log data to obtain an interface calling relation between systems;
and generating an intersystem interface call analysis result according to the intersystem interface call relation.
6. The software testing method of claim 5, wherein the step of obtaining the global impact analysis result based on the intra-system interface call analysis result and the inter-system interface call analysis result comprises:
analyzing by combining the interface information of the change of the interface call analysis result in the system and the interface call relation between the systems of the interface call analysis result between the systems to generate a global influence range matrix;
and acquiring a global influence analysis result according to the global influence range matrix.
7. The software testing method of claim 6, wherein the step of performing the software test based on the global impact analysis result to obtain the software test result comprises:
acquiring system change service information according to the global influence analysis result;
summarizing the business log data in the system link log to obtain business index baseline data;
Generating a test case according to the system change service information and the service index baseline data;
and testing according to the test cases to obtain software test results.
8. A software testing apparatus, the apparatus comprising:
the system internal interface call analysis module is used for carrying out system internal interface call analysis according to the pre-acquired initial version code and the modified version code to generate a system internal interface call analysis result;
the system interface call analysis module is used for carrying out system interface call analysis according to a pre-acquired system link log to generate a system interface call analysis result;
the global change influence analysis module is used for acquiring a global influence analysis result according to the intra-system interface call analysis result and the inter-system interface call analysis result;
and the software testing module is used for carrying out software testing according to the global influence analysis result to obtain a software testing result.
9. A terminal device, characterized in that the terminal device comprises: a memory, a processor and a software test program stored on the memory and executable on the processor, the software test program being configured to implement the steps of the software test method of any one of claims 1 to 7.
10. A storage medium having stored thereon a software test program which when executed by a processor performs the steps of the software test method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311364071.5A CN117573510A (en) | 2023-10-19 | 2023-10-19 | Software testing method, device, terminal equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311364071.5A CN117573510A (en) | 2023-10-19 | 2023-10-19 | Software testing method, device, terminal equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117573510A true CN117573510A (en) | 2024-02-20 |
Family
ID=89863282
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311364071.5A Pending CN117573510A (en) | 2023-10-19 | 2023-10-19 | Software testing method, device, terminal equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117573510A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118170415A (en) * | 2024-05-15 | 2024-06-11 | 成都融见软件科技有限公司 | Source code hierarchical structure acquisition method, electronic device and medium |
-
2023
- 2023-10-19 CN CN202311364071.5A patent/CN117573510A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118170415A (en) * | 2024-05-15 | 2024-06-11 | 成都融见软件科技有限公司 | Source code hierarchical structure acquisition method, electronic device and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10586053B2 (en) | Method for automatically detecting security vulnerability based on hybrid fuzzing, and apparatus thereof | |
CN107665171B (en) | Automatic regression testing method and device | |
KR101051600B1 (en) | Systems for performing code inspection on abap source code | |
US8276126B2 (en) | Determining causes of software regressions based on regression and delta information | |
EP2333669B1 (en) | Bridging code changes and testing | |
CN108563768B (en) | Data conversion method, device, equipment and storage medium for different data models | |
US20160041893A1 (en) | System and method for display of software quality | |
US8312440B2 (en) | Method, computer program product, and hardware product for providing program individuality analysis for source code programs | |
Zhang et al. | Non-parametric statistical fault localization | |
CN107239396A (en) | A kind of Software Evolution appraisal procedure measured based on code cyclomatic complexity | |
CN114095273A (en) | Deep learning-based internet vulnerability mining method and big data mining system | |
CN117573510A (en) | Software testing method, device, terminal equipment and storage medium | |
Bán et al. | Recognizing antipatterns and analyzing their effects on software maintainability | |
CN115145751A (en) | Method, device, equipment and storage medium for positioning fault root cause of micro-service system | |
US20130205010A1 (en) | Workload patterns for realistic load recreation in performance testing | |
Dalton et al. | Is exceptional behavior testing an exception? an empirical assessment using java automated tests | |
Wang et al. | Microservice architecture recovery based on intra-service and inter-service features | |
CN117215959A (en) | Software testing method, device, equipment and storage medium | |
CN116991736A (en) | Static code analysis method, device, system and storage medium | |
CN109508204B (en) | Front-end code quality detection method and device | |
CN116627804A (en) | Test method, system, electronic equipment and storage medium based on artificial intelligence | |
CN116069667A (en) | Test case auxiliary positioning method and device based on code analysis | |
Wang et al. | Correlating context-awareness and mutation analysis for pervasive computing systems | |
Betka et al. | Towards practical application of mutation testing in industry—traditional versus extreme mutation testing | |
US11526775B2 (en) | Automatically evaluating application architecture through architecture-as-code |
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 |