CN116594918B - Test case change influence analysis method, device, equipment and storage medium - Google Patents

Test case change influence analysis method, device, equipment and storage medium Download PDF

Info

Publication number
CN116594918B
CN116594918B CN202310880777.0A CN202310880777A CN116594918B CN 116594918 B CN116594918 B CN 116594918B CN 202310880777 A CN202310880777 A CN 202310880777A CN 116594918 B CN116594918 B CN 116594918B
Authority
CN
China
Prior art keywords
test case
interface method
interface
mapping
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310880777.0A
Other languages
Chinese (zh)
Other versions
CN116594918A (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 Post Consumer Finance Co ltd
Original Assignee
China Post Consumer Finance 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 Post Consumer Finance Co ltd filed Critical China Post Consumer Finance Co ltd
Priority to CN202310880777.0A priority Critical patent/CN116594918B/en
Publication of CN116594918A publication Critical patent/CN116594918A/en
Application granted granted Critical
Publication of CN116594918B publication Critical patent/CN116594918B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of software system testing, and discloses a method, a device, equipment and a storage medium for analyzing the change influence of a test case. The method is based on Java Agent technology to carry out code implantation on the interface method, and trace inquiry is carried out on the interface method related to the whole test case by calling the link identifier and the test case identifier, and all the interface methods related to the same test case identifier are combined, so that a user can obtain an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method through a test inquiry instruction, the interface method list related to the test case is automatically and efficiently tracked and recorded, the analysis and mastering of the influence condition of the interface method change on the test case change by software testers and software developers are greatly facilitated, the software test coverage rate is improved, the software test omission rate is reduced, and the software quality is further improved.

Description

Test case change influence analysis method, device, equipment and storage medium
Technical Field
The present invention relates to the field of software system testing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for analyzing an influence of a test case change.
Background
In the daily Java software system test, a tester cannot clearly know which system interfaces are called by Http call or RPC call initiated by one test case, so that when the system interfaces are changed, the interfaces cannot be accurately and quickly analyzed to influence which test cases.
In the prior art, a system interface call flow chart and a system interface list of a test case are manually maintained, when the change influence analysis of system interface modification is carried out, the system interface lists corresponding to all the test cases are analyzed one by one, and a test case list of a changed system interface design is obtained, so that related testers can carry out test case analysis and test case regression coverage test. However, since the method is required to register and compare by means of manual work, the method is very time-consuming and easy to miss, and in addition, the interface list information registered when the system call flow is changed cannot be found and updated in time, so that incomplete testing is easily caused by incomplete analysis of the influence surface, and further, the system production fault occurs.
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 invention mainly aims to provide a test case change influence analysis method, a device, equipment and a storage medium, and aims to solve the technical problems that in the prior art, java software system test needs to be registered and compared manually, so that the test is very time-consuming and easy to miss, in addition, interface list information registered when a system call flow is changed cannot be found and updated in time, and the test is incomplete due to incomplete influence surface analysis, so that system production faults occur.
In order to achieve the above object, the present invention provides a test case change influence analysis method, which includes the steps of:
code implantation is carried out on an interface method based on Java Agent technology, a calling link identifier is generated when the interface method is called, a calling link interface method mapping of the calling link identifier and the interface method is generated, and the calling link identifier is transmitted in the whole calling link;
calling the interface method of the test case, obtaining a test case identifier corresponding to the test case, and generating a call link test case mapping of the call link identifier and the test case identifier;
Merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database;
when a test query instruction of a user is received, carrying out data query according to the test query instruction, and outputting a query result list so that the user can carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
Optionally, the step of code implantation for the interface method based on the Java Agent technology and generating the calling link identifier when the interface method is called includes:
when a Java virtual machine is started, loading a Java class of a system;
the method comprises the steps that a class method is rewritten through a custom Transformer, wherein the custom Transformer is used for judging whether a currently loaded interface method is a call entry method or not, and the interface method comprises an Http interface method or an RPC interface method;
If yes, generating a new calling link identification when calling the interface method.
Optionally, the method is rewritten by a custom transducer, where the custom transducer is used to determine whether the currently loaded interface method is a call entry method, and after the step of the interface method includes an Http interface method or an RPC interface method, the method further includes:
if not, acquiring the calling link identification from the interface method.
Optionally, after the step of obtaining the test case identifier corresponding to the test case and generating the call link test case mapping between the call link identifier and the test case identifier by using the interface method for calling the test case, the method further includes:
and asynchronously sending the call link test case mapping and the call link interface method mapping through a message middleware, storing the call link test case mapping into a relational database, and storing the call link interface method mapping into a non-relational database.
Optionally, the step of merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping in a database includes:
And combining all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping at regular intervals to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into the relational database.
Optionally, the step of merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping includes:
periodically obtaining an interface method list corresponding to the same test case identifier according to the call link test case mapping and the call link interface method mapping;
splicing the full path class name, the method name and the full path input parameter name of each interface method to obtain an interface method character string;
performing duplication elimination treatment on the interface method character string to obtain an interface method character string subjected to duplication elimination;
and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal.
Optionally, when a test query instruction of a user is received, performing data query according to the test query instruction, and outputting a query result list, so that the user performs analysis and regression coverage test according to the query result list, where the query result list includes an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method, and the method includes:
when a test query instruction input by a user based on a query page is received through a query interface, carrying out data query according to the test query instruction, obtaining and outputting a query result list, so that the user can carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
In order to achieve the above object, the present invention also provides a test case modification influence analysis device including:
the code implantation module is used for implanting codes into the interface method based on Java Agent technology, generating a calling link identifier when the interface method is called, and generating a calling link interface method mapping of the calling link identifier and the interface method, wherein the calling link identifier is transmitted in the whole calling link;
The identification tracking module is used for calling the interface method of the test case, obtaining a test case identification corresponding to the test case and generating a call link test case mapping between the call link identification and the test case identification;
the data storage module is used for merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database;
and the data query module is used for carrying out data query according to the test query instruction when receiving the test query instruction of the user and outputting a query result list so as to enable the user to carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
In addition, in order to achieve the above object, the present invention also proposes a test case change influence analysis apparatus, the apparatus including: the system comprises a memory, a processor and a test case change influence analysis program stored on the memory and capable of running on the processor, wherein the test case change influence analysis program is configured to realize the steps of the test case change influence analysis method.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having stored thereon a test case change influence analysis program that, when executed by a processor, implements the steps of the test case change influence analysis method as described above.
The analysis equipment of the invention carries out code implantation on the interface method based on Java Agent technology, acquires the test case identifier corresponding to the test case when the interface method of the test case is called, generates a call link identifier, generates a call link interface method mapping of the call link identifier and the interface method, and generates a call link test case mapping of the call link identifier and the test case identifier; combining all interface methods related to the same test case identification according to the call link test case mapping and the call link interface method mapping to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into a database; when a test query instruction of a user is received, data query is performed according to the test query instruction, and a query result list is output, so that the user performs analysis and regression coverage test according to the query result list. Because the interface method is code implanted based on Java Agent technology, and the interface method related to the whole test case is tracked and inquired by calling the link identifier and the test case identifier, all the interface methods related to the same test case identifier are combined, so that an interface method list related to the test case can be automatically, efficiently and accurately tracked and recorded, the software tester and the software developer can conveniently analyze and master the influence condition of the interface method change on the test case change, the software test coverage rate is improved, the software test omission rate is reduced, the software quality is improved, and the possibility of software faults is reduced.
Drawings
FIG. 1 is a schematic diagram of a test case modification effect analysis device of a hardware running environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for analyzing influence of test case modification according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a method for analyzing influence of test case modification according to the present invention;
FIG. 4 is a flowchart of an application scenario of the test case change impact analysis method of the present invention;
FIG. 5 is a block diagram showing a first embodiment of a test case change influence analysis apparatus according to the present invention.
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.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a test case modification influence analysis device of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the test case change influence analysis apparatus may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in FIG. 1 does not constitute a limitation on the test case change impact analysis apparatus, and may include more or fewer components than illustrated, or may combine certain components, or may be a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a test case change influence analysis program may be included in the memory 1005 as one type of storage medium.
In the test case modification influence analysis apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the test case change influence analysis device of the present invention may be provided in the test case change influence analysis device, where the test case change influence analysis device calls the test case change influence analysis program stored in the memory 1005 through the processor 1001, and executes the test case change influence analysis method provided by the embodiment of the present invention.
The embodiment of the invention provides a test case change influence analysis method, and referring to fig. 2, fig. 2 is a flow chart of a first embodiment of the test case change influence analysis method.
In this embodiment, the test case change influence analysis method includes the following steps:
step S10: code implantation is carried out on an interface method based on Java Agent technology, a calling link identifier is generated when the interface method is called, the calling link identifier and a calling link interface method mapping of the interface method are generated, and the calling link identifier is transmitted in the whole calling link.
It should be noted that, the execution body of the method of this embodiment may be a terminal device having functions of software testing, data analysis, and program running, such as a personal computer, a server, or the like, or may be an electronic device having the same or similar functions, such as the above-described test case change influence analysis device. Hereinafter, this embodiment and the following embodiments will be described with reference to a test case change influence analysis device (hereinafter referred to as an analysis device).
It will be appreciated that Java Agent technology is a high-level functionality of Java that allows developers to change the bytecode of a program at runtime, thereby enabling the ability to change and enhance program behavior at runtime. The technology is widely applied to the fields of performance monitoring, heat deployment, AOP and the like. The Java Agent can intercept and modify byte codes before loading Java files, and can change the byte codes of loaded classes in the running period.
It should be appreciated that the call links may be call relationships between a series of interdependent functions or methods. The method can help the user to know the execution flow inside the software system, find potential problems and improve the quality and maintainability of the code. For example, the following function call relationships exist in the system: main () calls function1 (), function1 () calls function2 (), then there will be a corresponding call link main () - > function1 () - > function2 ().
It should be noted that, the calling link identifier may uniquely identify a calling link ID of a calling link, and the calling link ID may be transferred in the whole calling link, so as to obtain an interface method involved in the calling link.
Specifically, the step of code implantation for the interface method based on the Java Agent technology and generating the calling link identifier when the interface method is called includes:
when a Java virtual machine is started, loading a Java class of a system; the class method is rewritten through a self-defined self-attention mechanism, wherein the self-defined self-attention mechanism is used for judging whether the interface method loaded currently is a call entry method or not, and the interface method comprises an Http interface method or an RPC interface method; if yes, generating a new calling link identifier when the interface method is called, and tracking the pair link identifier and the test case identifier.
It is understood that a Java virtual machine (Java Virtual Machine, JVM for short) is an abstract computer that can run all Java programs. The JVM may be used in a software implementation of a computing device, capable of fully implementing the execution of programs written in the Java programming language, and may be understood as a runtime environment, such that Java code may be executed on a variety of platforms.
It should be appreciated that in the Java programming language, java classes may be a type of user-defined compound type that may contain data (member variables) and actions to manipulate the data (member methods). The class is the basis for Java programming language implementation of object-oriented programming and provides a way to encapsulate implementation details, providing only the necessary interface methods to use the functionality of this class.
It should be noted that, the custom transducer described in this embodiment is a custom transducer that implements a java. And whether the currently loaded class is the interface method currently loaded or not can be judged by the custom transducer, if so, a new calling link ID is generated, if not, the calling link ID is obtained from the interface method parameters, and the calling link ID and the test case ID are tracked.
It should be explained that the interface method is an Http interface method or an RPC interface method, that is, the interface method includes an Http interface method or an RPC interface method.
In a specific implementation, the JVM starts and loads a Java class of the system; the class method is rewritten through a custom transducer which realizes a java. Lang. Instrument. ClassFileTransformer interface; judging whether the currently loaded class is an Http or RPC interface method class or not through a custom transducer; if yes, generating a new calling link identifier when the interface method is called, and if not, acquiring a calling link ID from the interface method parameters; the call link ID and the test case ID are tracked.
It will be appreciated that when a call is performed, the call link ID may be passed through the call link, so that a mapping relationship between the call link ID and the interface method, that is, the call link interface method mapping, may be obtained.
Step S20: and calling the interface method of the test case, obtaining a test case identifier corresponding to the test case, and generating a call link test case mapping of the call link identifier and the test case identifier.
It can be understood that a test case is a set of documents related to or written for executing a software system test, and the test case mainly comprises contents such as test input, execution conditions, expected results and the like. The test case is an important basis for executing the test, and has the characteristics of effectiveness, repeatability, easiness in organization, clearness, simplicity, maintainability and the like.
It should be appreciated that the steps of generating the call link identifier and generating the call link interface method map of the call link identifier and the interface method may be performed when the interface method related to the test case is called.
The test case identifier may be a test case ID capable of uniquely identifying the test case, and the interface method related to the test case in the execution process may be obtained through the test case ID and the call link ID.
In a specific implementation, when executing a test case call interface method, analysis equipment acquires a test case ID; judging whether the interface method is a call entry method according to the custom transducer, if so, generating a new call link identifier when the interface method is called, and if not, acquiring a call link ID from the interface method parameters; the analysis device transmits the calling link ID and calls the next Http method interface and RPC method interface, records the calling link test case mapping of the test case ID and the test case identification of the calling link ID, and the calling link interface method mapping of the calling link identification and the interface method.
Step S30: and merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database.
It should be noted that, according to the call link test case mapping and the call link interface method mapping, all interface methods related to the test case can be obtained, and corresponding test case interface method mapping is established.
It can be appreciated that all interface methods involved in the test case can be obtained from the test case ID and test case interface method map, and a merged test case interface method list map is generated.
It should be understood that the interface method related to the test case can be tracked through the call link ID related in the test case execution process. Specifically, the analysis device may obtain the call links involved in each test case according to the call link test case mapping, and may obtain the interface methods involved in each call link through the call link interface method mapping, so as to obtain the interface methods involved in each test case.
Further, in order to integrate interface methods related to a test case ID in an analysis device at regular intervals, the step of merging all the interface methods related to the same test case ID according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping in a database includes:
And combining all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping at regular intervals to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into the relational database.
It can be appreciated that the above-described merged test case interface method list map may be used to characterize the merged test case and the interface methods to which the test case relates.
In this embodiment, the analysis system merges the call link data of the same test case ID of the previous day every early morning to obtain all interface method lists related to the test case ID, and stores the interface method lists in the database.
In a specific implementation, the analysis device merges all interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and stores the merged test case interface method list mapping into a database.
Step S40: when a test query instruction of a user is received, carrying out data query according to the test query instruction, and outputting a query result list so that the user can carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
It should be noted that, the analysis device may be provided with a query interface, and the user may generate a test query instruction through the remote terminal or a query page provided on the analysis device, and input the test query instruction through the query interface.
It will be appreciated that when a test query instruction input by a user based on a query page or a remote terminal is received through the query interface, a database query may be performed according to the test query instruction.
It should be noted that, the test query instruction may be an instruction for querying an interface method corresponding to the test case, or may be an instruction for querying all test cases that call the interface method, which is not limited in this embodiment.
It should be understood that the analysis device may visually display the query result list through the display page, or may send the query result list to the remote terminal of the user, where the query list may include an interface method list corresponding to the same test case identifier and/or a test case identifier list corresponding to the same interface method, so that the user may purposefully analyze and perform a regression coverage test on the test case related to the changed interface method, thereby improving the test coverage rate and reducing the test omission rate, and avoiding the influence of the system interface change on the upstream and downstream interfaces.
It will be appreciated that analytical and regression overlay tests are two test methods commonly used in software testing that can be used to verify the correctness and stability of a software system. Analytical testing mainly focuses on static code and design problems, and problems can be found and solved as early as possible. The regression overlay test is more focused on verifying the influence range of modification, and ensures the overall quality and stability of the software system. In the process of software development and testing, the two testing methods are usually combined to ensure the quality and reliability of the software.
In a specific implementation, when receiving a test query instruction of a user, the analysis equipment performs data query according to the test query instruction and outputs a query result list so that the user performs analysis and regression coverage test according to the query result list.
The method comprises the steps that code implantation is carried out on an interface method by analyzing equipment based on Java Agent technology, test case identifications corresponding to test cases are obtained when the interface method of the test cases is called, call link identifications are generated, call link interface method mapping of the call link identifications and the interface method is generated, and call link test case mapping of the call link identifications and the test case identifications is generated; combining all interface methods related to the same test case identification according to the call link test case mapping and the call link interface method mapping to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into a database; when a test query instruction of a user is received, data query is performed according to the test query instruction, and a query result list is output, so that the user performs analysis and regression coverage test according to the query result list. Because the interface method is code implanted based on Java Agent technology, and the interface method related to the whole test case is tracked and inquired by calling the link identifier and the test case identifier, all the interface methods related to the same test case identifier are combined, so that an interface method list related to the test case can be automatically, efficiently and accurately tracked and recorded, the software tester and the software developer can conveniently analyze and master the influence condition of the interface method change on the test case change, the software test coverage rate is improved, the software test omission rate is reduced, the software quality is improved, and the possibility of software faults is reduced.
Based on the first embodiment of the test case modification influence analysis method according to the present invention as described above, a second embodiment of the test case modification influence analysis method according to the present invention is proposed for merging interface methods related to the same test case identification.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of a test case modification influence analysis method according to the present invention.
As shown in fig. 3, the step of merging all the interface methods related to the same test case identifier according to the call link test case map and the call link interface method map to obtain a merged test case interface method list map includes:
step S31: and periodically acquiring an interface method list corresponding to the same test case identifier according to the call link test case mapping and the call link interface method mapping.
It may be appreciated that the analysis device may periodically obtain, according to the test case identifier, a list of call link interface methods corresponding to the test case, where the list of call link interface methods includes an interface method related to the test case, and the list of call link interface methods may be established according to the test case interface method mapping described above, which is not limited in this embodiment.
In a specific implementation, the analysis device periodically acquires an interface method list corresponding to the test case identifier according to the call link test case mapping and the call link interface method mapping.
Step S32: and splicing the full-path class name, the method name and the full-path input parameter name of each interface method to obtain an interface method character string.
It can be understood that when the interface method list corresponding to the test case identifier is obtained, all the interface methods in the interface method list can be spliced. Specifically, the full path class name, the method name and the full path input parameter name of each calling link interface method are spliced into a character string.
It can be understood that the full path name of the interface method refers to the complete path and class name of the interface class to which the interface method belongs; when an interface method is used, the interface method can be referenced and invoked by the full path class name of the interface. The method name of the interface method is the name of the method defined in the interface. The full path input parameter name of an interface method is typically used to specify the complete type of parameter in the interface method or function.
In a specific implementation, the analysis device splices the full path class name, the method name and the full path input parameter name of each interface method in the interface method list corresponding to the same test case identifier to obtain an interface method character string.
Step S33: and carrying out de-duplication treatment on the interface method character string to obtain the interface method character string after de-duplication.
It can be understood that when the above-mentioned interface method character string is obtained, the value of the interface method character string can be put into a Set for performing the duplication removal processing, so as to obtain the duplication-removed interface method character string.
It should be noted that Set is a Set in Java, and it does not allow for duplicate elements. Thus, when an interface method string is added to a Set, if the same string already exists, the string will not be repeatedly added.
It can be appreciated that the Set can implement very convenient deduplication operation on the interface method string.
In a specific implementation, the analysis equipment performs de-duplication processing on the interface method character string to obtain the interface method character string after de-duplication.
Step S34: and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal.
It can be understood that when the deduplication is completed, a new test case interface method list map can be generated according to the test case identification and the interface method character string after the deduplication, that is, the test case interface method list map is combined.
In a specific implementation, the analysis device generates a combined test case interface method list map according to the test case identification and the interface method character string after de-duplication.
The embodiment obtains an interface method list corresponding to the same test case identifier by periodically calling a link test case map and a link interface method map; splicing the full path class name, the method name and the full path input parameter name of each interface method to obtain an interface method character string; performing duplication elimination treatment on the interface method character string to obtain an interface method character string subjected to duplication elimination; and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal. The interface methods related to the same test case are combined and de-duplicated to obtain the list mapping of the interface methods of the combined test case, so that a user can analyze and master the condition of changing influence surfaces of the interface method changes on the test case, the software test coverage rate is improved, the software test omission rate is reduced, and the software quality is improved to avoid the occurrence of software production faults.
Further, in order to store the call link interface method mapping and the merge test case interface method list mapping, the step of calling the interface method of the test case, obtaining the test case identifier corresponding to the test case, and generating the call link identifier and the call link test case mapping of the test case identifier further includes:
And asynchronously sending the call link test case mapping and the call link interface method mapping through a message middleware, storing the call link test case mapping into a relational database, and storing the call link interface method mapping into a non-relational database.
The step of merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database, comprises the following steps:
and combining all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping at regular intervals to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into the relational database.
It should be noted that message middleware is a software solution for decoupling and communicating between components of an asynchronous processing system. Message middleware may act as a messenger and a processor in the system for messaging and processing between the different components.
It will be appreciated that the relational database (Relational Database) is a relational model-based database that uses tabular forms to organize and store data. It organizes the data into a table, each table consisting of rows and columns, each row representing a data record and each column representing a data field. Common relational databases may include MySQL, oracle, SQL Server, etc.
It should be understood that a non-relational database (NoSQL) is a database management system different from a conventional Relational Database (RDBMS). The unstructured database is designed to handle large-scale, unstructured or semi-structured data. Common non-relational databases include MongoDB, cassandra, redis, couchbase, etc., which have advantages in terms of flexibility, scalability and high performance of data models, and are suitable for storage and processing requirements of unstructured and semi-structured data.
Referring to fig. 4, fig. 4 is a flowchart of an application scenario of the test case modification influence analysis method of the present invention.
As shown in fig. 4, at the time of software start, the analysis device performs code implantation on Http and RPC interface methods through Java Agent.
Further, the analysis device executes the test case and invokes the Http or RPC interface method to obtain the test case ID.
Further, the analysis device judges whether the called interface method is a call entry method, if so, a new call link ID is generated; if not, acquiring the calling link ID from the Http and RPC interface method parameters.
Further, when executing the test case, the analysis device transmits a call link ID and calls the next Http and RPC interface method, records the test case ID and a call link test case mapping of the call link ID, and a call link interface method mapping of the call link ID and interface method, until the test case call is ended.
Further, when the analysis equipment calls the link test case mapping and the link interface method mapping, the analysis equipment asynchronously sends the call link test case mapping and the call link interface method mapping through the message middleware and stores the call link test case mapping and the call link interface method mapping into the relational database and the non-relational database respectively.
Further, the analysis device periodically merges the interface methods of the same test case ID mapping, and stores the generated merged test case interface method list mapping into the relational database, so that a user can query the interface method related to the test case or the test case related to the interface method.
Further, when receiving a test query instruction of a user, the analysis device queries an interface method list related to the test case ID or a test case list related to the interface method according to the test query instruction, and feeds back the queried result to the user, so that the user can analyze and return to the coverage test according to the queried result.
In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a test case change influence analysis program, and the test case change influence analysis program realizes the steps of the test case change influence analysis method when being executed by a processor.
Based on the first embodiment of the test case change influence analysis method, the first embodiment of the test case change influence analysis device is provided, and referring to fig. 5, fig. 5 is a block diagram of the first embodiment of the test case change influence analysis device.
As shown in fig. 5, the test case change influence analysis device provided by the embodiment of the present invention includes:
the code implantation module 501 is configured to perform code implantation on an interface method based on a Java Agent technology, generate a call link identifier when the interface method is called, and generate a call link interface method mapping of the call link identifier and the interface method, where the call link identifier is transferred in the whole call link;
The identifier tracking module 502 is used for calling the interface method of the test case, obtaining a test case identifier corresponding to the test case, and generating a call link test case mapping between the call link identifier and the test case identifier;
the data storage module 503 is configured to combine all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a combined test case interface method list mapping, and store the combined test case interface method list mapping in a database;
and the data query module 504 is used for carrying out data query according to the test query instruction when receiving the test query instruction of the user, and outputting a query result list so as to enable the user to carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
Further, the code implantation module 501 is further configured to load a Java class of the system when the Java virtual machine is started; the method comprises the steps that a class method is rewritten through a custom Transformer, wherein the custom Transformer is used for judging whether a currently loaded interface method is a call entry method or not, and the interface method comprises an Http interface method or an RPC interface method; if yes, generating a new calling link identification when calling the interface method.
Further, the code implantation module 501 is further configured to obtain a call link identifier from the interface method if not.
Further, the data query module 504 is further configured to, when receiving, through a query interface, a test query instruction input by a user based on a query page, perform a data query according to the test query instruction, obtain and output a query result list, so that the user performs analysis and regression overlay testing according to the query result list, where the query result list includes an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
The method comprises the steps that code implantation is carried out on an interface method by analyzing equipment based on Java Agent technology, test case identifications corresponding to test cases are obtained when the interface method of the test cases is called, call link identifications are generated, call link interface method mapping of the call link identifications and the interface method is generated, and call link test case mapping of the call link identifications and the test case identifications is generated; combining all interface methods related to the same test case identification according to the call link test case mapping and the call link interface method mapping to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into a database; when a test query instruction of a user is received, data query is performed according to the test query instruction, and a query result list is output, so that the user performs analysis and regression coverage test according to the query result list. Because the interface method is code implanted based on Java Agent technology, and the interface method related to the whole test case is tracked and inquired by calling the link identifier and the test case identifier, all the interface methods related to the same test case identifier are combined, so that an interface method list related to the test case can be automatically, efficiently and accurately tracked and recorded, the software tester and the software developer can conveniently analyze and master the influence condition of the interface method change on the test case change, the software test coverage rate is improved, the software test omission rate is reduced, the software quality is improved, and the possibility of software faults is reduced.
Further, based on the first embodiment of the test case modification influence analysis apparatus according to the present invention, a second embodiment of the test case modification influence analysis apparatus according to the present invention is proposed.
In this embodiment, the data storage module 503 is further configured to obtain an interface method list corresponding to the same test case identifier periodically according to the call link test case mapping and the call link interface method mapping; splicing the full path class name, the method name and the full path input parameter name of each interface method to obtain an interface method character string; performing duplication elimination treatment on the interface method character string to obtain an interface method character string subjected to duplication elimination; and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal.
Further, the data storage module 503 is further configured to asynchronously send the call link test case mapping and the call link interface method mapping through a message middleware, store the call link test case mapping in a relational database, and store the call link interface method mapping in a non-relational database.
The data storage module 503 is further configured to combine all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping at regular intervals, obtain a combined test case interface method list mapping, and store the combined test case interface method list mapping in the relational database.
The embodiment obtains an interface method list corresponding to the same test case identifier by periodically calling a link test case map and a link interface method map; splicing the full path class name, the method name and the full path input parameter name of each interface method to obtain an interface method character string; performing duplication elimination treatment on the interface method character string to obtain an interface method character string subjected to duplication elimination; and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal. The interface methods related to the same test case are combined and de-duplicated to obtain the list mapping of the interface methods of the combined test case, so that a user can analyze and master the condition of changing influence surfaces of the interface method changes on the test case, the software test coverage rate is improved, the software test omission rate is reduced, and the software quality is improved to avoid the occurrence of software production faults.
Other embodiments or specific implementation manners of the test case modification influence analysis device of the present invention may refer to the above method embodiments, and will not be described herein.
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. read-only memory/random-access memory, magnetic disk, optical disk), comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, 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 (8)

1. A method for analyzing the influence of a change in a test case, the method comprising:
code implantation is carried out on an interface method based on Java Agent technology, a calling link identifier is generated when the interface method is called, a calling link interface method mapping of the calling link identifier and the interface method is generated, and the calling link identifier is transmitted in the whole calling link;
calling the interface method of the test case, obtaining a test case identifier corresponding to the test case, and generating a call link test case mapping of the call link identifier and the test case identifier;
merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database;
When a test query instruction of a user is received, carrying out data query according to the test query instruction, and outputting a query result list so that the user can carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method;
the step of code implantation for the interface method based on Java Agent technology and generating a calling link identifier when the interface method is called comprises the following steps:
when a Java virtual machine is started, loading a Java class of a system;
the method comprises the steps that a class method is rewritten through a custom Transformer, wherein the custom Transformer is used for judging whether a currently loaded interface method is a call entry method or not, and the interface method comprises an Http interface method or an RPC interface method;
if yes, generating a new calling link identifier when the interface method is called;
if not, acquiring the calling link identification from the interface method.
2. The method for analyzing the influence of test case modification according to claim 1, wherein after the step of obtaining the test case identifier corresponding to the test case and generating the call link test case mapping between the call link identifier and the test case identifier, the method further comprises:
And asynchronously sending the call link test case mapping and the call link interface method mapping through a message middleware, storing the call link test case mapping into a relational database, and storing the call link interface method mapping into a non-relational database.
3. The method for analyzing the influence of test case modification according to claim 2, wherein the step of merging all the interface methods related to the same test case identifier according to the call link test case map and the call link interface method map to obtain a merged test case interface method list map, and storing the merged test case interface method list map in a database includes:
and combining all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping at regular intervals to obtain a combined test case interface method list mapping, and storing the combined test case interface method list mapping into the relational database.
4. The method for analyzing the influence of test case modification according to claim 3, wherein the step of periodically merging all the interface methods related to the same test case identifier according to the call link test case map and the call link interface method map to obtain a merged test case interface method list map includes:
Periodically obtaining an interface method list corresponding to the same test case identifier according to the call link test case mapping and the call link interface method mapping;
splicing the full path class name, the method name and the full path input parameter name of each interface method to obtain an interface method character string;
performing duplication elimination treatment on the interface method character string to obtain an interface method character string subjected to duplication elimination;
and generating a combined test case interface method list map according to the test case identification and the interface method character string after duplication removal.
5. The method for analyzing influence of test case modification as claimed in claim 4, wherein when receiving a test query command of a user, the method performs data query according to the test query command and outputs a query result list, so that the user performs analysis and regression overlay test according to the query result list, and the query result list includes a list of interface methods corresponding to the same test case identifier or a list of test case identifiers corresponding to the same interface method, and the method comprises the steps of:
when a test query instruction input by a user based on a query page is received through a query interface, carrying out data query according to the test query instruction, obtaining and outputting a query result list, so that the user can carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method.
6. A test case change influence analysis device, characterized in that the test case change influence analysis device includes:
the code implantation module is used for implanting codes into the interface method based on Java Agent technology, generating a calling link identifier when the interface method is called, and generating a calling link interface method mapping of the calling link identifier and the interface method, wherein the calling link identifier is transmitted in the whole calling link;
the identification tracking module is used for calling the interface method of the test case, obtaining a test case identification corresponding to the test case and generating a call link test case mapping between the call link identification and the test case identification;
the data storage module is used for merging all the interface methods related to the same test case identifier according to the call link test case mapping and the call link interface method mapping to obtain a merged test case interface method list mapping, and storing the merged test case interface method list mapping into a database;
the data query module is used for carrying out data query according to the test query instruction when receiving the test query instruction of the user and outputting a query result list so as to enable the user to carry out analysis and regression coverage test according to the query result list, wherein the query result list comprises an interface method list corresponding to the same test case identifier or a test case identifier list corresponding to the same interface method;
The code implantation module is also used for loading the Java class of the system when the Java virtual machine is started; the method comprises the steps that a class method is rewritten through a custom Transformer, wherein the custom Transformer is used for judging whether a currently loaded interface method is a call entry method or not, and the interface method comprises an Http interface method or an RPC interface method; if yes, generating a new calling link identifier when the interface method is called; if not, acquiring the calling link identification from the interface method.
7. A test case change influence analysis apparatus, the apparatus comprising: a memory, a processor, and a test case change impact analysis program stored on the memory and executable on the processor, the test case change impact analysis program configured to implement the steps of the test case change impact analysis method of any one of claims 1 to 5.
8. A storage medium having stored thereon a test case change impact analysis program which, when executed by a processor, implements the steps of the test case change impact analysis method according to any one of claims 1 to 5.
CN202310880777.0A 2023-07-18 2023-07-18 Test case change influence analysis method, device, equipment and storage medium Active CN116594918B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310880777.0A CN116594918B (en) 2023-07-18 2023-07-18 Test case change influence analysis method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310880777.0A CN116594918B (en) 2023-07-18 2023-07-18 Test case change influence analysis method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116594918A CN116594918A (en) 2023-08-15
CN116594918B true CN116594918B (en) 2024-01-26

Family

ID=87608560

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310880777.0A Active CN116594918B (en) 2023-07-18 2023-07-18 Test case change influence analysis method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116594918B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111240955A (en) * 2018-11-28 2020-06-05 北京京东尚科信息技术有限公司 Automatic testing method and device for Http interface, storage medium and electronic device
CN111782556A (en) * 2020-08-26 2020-10-16 中国银行股份有限公司 Automatic test method and device
CN115292197A (en) * 2022-09-07 2022-11-04 中信建投证券股份有限公司 Software testing method and device, electronic equipment and storage medium
CN115905031A (en) * 2023-03-14 2023-04-04 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190391908A1 (en) * 2018-06-22 2019-12-26 Ca, Inc. Methods and devices for intelligent selection of channel interfaces

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111240955A (en) * 2018-11-28 2020-06-05 北京京东尚科信息技术有限公司 Automatic testing method and device for Http interface, storage medium and electronic device
CN111782556A (en) * 2020-08-26 2020-10-16 中国银行股份有限公司 Automatic test method and device
CN115292197A (en) * 2022-09-07 2022-11-04 中信建投证券股份有限公司 Software testing method and device, electronic equipment and storage medium
CN115905031A (en) * 2023-03-14 2023-04-04 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于数据模型的接口用例自动生成;虞砺琨;左万娟;于倩;陈华南;黄晨;;测控技术(07);全文 *

Also Published As

Publication number Publication date
CN116594918A (en) 2023-08-15

Similar Documents

Publication Publication Date Title
Tomassi et al. Bugswarm: Mining and continuously growing a dataset of reproducible failures and fixes
US10565089B2 (en) Identification of code features potentially associated with code behavior
US9880832B2 (en) Software patch evaluator
US20110107307A1 (en) Collecting Program Runtime Information
US9886369B2 (en) Dynamic data fabrication for database applications
US10509719B2 (en) Automatic regression identification
JP5208635B2 (en) Information processing apparatus, information processing system, programming support method and program for supporting programming
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
US10528457B2 (en) Automated unit testing in a mainframe environment
CN111209185B (en) Keyword-based automated testing method and computer-readable storage medium
US11436133B2 (en) Comparable user interface object identifications
CN103186463B (en) Determine the method and system of the test specification of software
CN112052169A (en) Test management method, system, device and computer readable storage medium
CN111737140A (en) Interface automation test method, device, equipment and computer readable storage medium
CN111221721B (en) Automatic recording and executing method and device for unit test cases
CN105677569B (en) Android automated test tools and method of testing based on event handler
CN110928777A (en) Test case processing method, device, equipment and storage medium
US8930765B2 (en) Systems and methods for feedback driven regression testing
CN116594918B (en) Test case change influence analysis method, device, equipment and storage medium
Gao et al. A systematic regression testing method and tool for software components
Ahmad et al. Identifying randomness related flaky tests through divergence and execution tracing
Lavoie et al. A case study of TTCN-3 test scripts clone analysis in an industrial telecommunication setting
CN115509913A (en) Software automation test method, device, machine readable medium and equipment
US11449412B2 (en) Automated unit testing in a mainframe CICS environment
CN113220586A (en) Automatic interface pressure test execution method, device and system

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