CN108829575B - Test case recommendation method, electronic device and readable storage medium - Google Patents

Test case recommendation method, electronic device and readable storage medium Download PDF

Info

Publication number
CN108829575B
CN108829575B CN201810345026.8A CN201810345026A CN108829575B CN 108829575 B CN108829575 B CN 108829575B CN 201810345026 A CN201810345026 A CN 201810345026A CN 108829575 B CN108829575 B CN 108829575B
Authority
CN
China
Prior art keywords
tested
http request
software system
test case
test
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
CN201810345026.8A
Other languages
Chinese (zh)
Other versions
CN108829575A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810345026.8A priority Critical patent/CN108829575B/en
Priority to PCT/CN2018/102405 priority patent/WO2019200808A1/en
Publication of CN108829575A publication Critical patent/CN108829575A/en
Application granted granted Critical
Publication of CN108829575B publication Critical patent/CN108829575B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The invention relates to a test case recommendation method, an electronic device and a readable storage medium, wherein the method comprises the following steps: in the process that a preset test case executes a test on a dynamic link of a software system to be tested, establishing a mapping relation between each test case and an HTTP request according to a preset rule and establishing a mapping relation between the HTTP request and a method chain in the software system to be tested; when the code in the software system to be tested is changed, analyzing the affected method chain by changing the code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; determining a test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request; and recommending the determined test case as a test case for executing the test on the software system to be tested. The method and the system can perform accurate test case recommendation aiming at the change codes, maximally utilize test execution resources and improve test efficiency.

Description

Test case recommendation method, electronic device and readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a test case recommendation method, an electronic device and a readable storage medium.
Background
In the existing software test, an important index for measuring the test quality is the code coverage rate, namely the tested proportion of the source code. However, code coverage data can only represent which codes have been tested and cannot represent whether they have been tested with the appropriate test cases. For example, when a system under test is tested by using a test case, a dynamic link of the system under test needs to be tested. The dynamic link refers to a method chain and the like which are passed in a dynamic process that a system to be tested initiates an http request to a web server. In the prior art, corresponding test cases cannot be recommended to testers in a targeted manner according to a method chain and an http request related in the dynamic process, all test cases can be generally executed or part of test cases can be manually selected by experienced testers to perform testing, and accurate and proper test cases cannot be automatically recommended to perform testing, so that the testing efficiency is low.
Disclosure of Invention
The invention aims to provide a test case recommendation method, an electronic device and a readable storage medium, and aims to improve the test efficiency.
In order to achieve the above object, the present invention provides an electronic device, which includes a memory and a processor, wherein the memory stores a test case recommendation system operable on the processor, and the test case recommendation system, when executed by the processor, implements the following steps:
in the process that a preset test case executes a test on a dynamic link of a software system to be tested, establishing a mapping relation between each test case and an HTTP request according to a preset rule and establishing a mapping relation between the HTTP request and a method chain in the software system to be tested;
when the code in the software system to be tested is changed, analyzing the affected method chain through the changed code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; determining a test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request;
and recommending the determined test case as a test case for executing the test on the software system to be tested.
Preferably, the step of establishing a mapping relationship between each test case and the HTTP request according to a preset rule and a mapping relationship between the HTTP request and a method chain in the software system to be tested in the process of executing a test on a dynamic link of the software system to be tested by a preset test case includes:
recording an HTTP request entering a software system to be tested and a method chain passed by the HTTP request in the process of executing the test on the software system to be tested by a preset test case;
associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; and correlating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request.
Preferably, the step of recording, in the process of executing the test on the software system to be tested by the preset test case, the HTTP request entering the software system to be tested and the method chain through which the HTTP request passes includes:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; and recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent.
Preferably, when a code change occurs in the software system to be tested, the method chain for analyzing the influence by changing the code includes:
acquiring submission codes recorded by a preset version management tool corresponding to a software system to be tested, and analyzing all change codes among the submission codes of different versions of the software system to be tested; the preset version management tool comprises an open source code version control system SVN, a CVS and a distributed version control system GIT;
and determining the method chain associated with all the change codes as the affected method chain.
In addition, in order to achieve the above object, the present invention further provides a test case recommendation method, including:
in the process that a preset test case executes a test on a dynamic link of a software system to be tested, establishing a mapping relation between each test case and an HTTP request according to a preset rule and establishing a mapping relation between the HTTP request and a method chain in the software system to be tested;
when the code in the software system to be tested is changed, analyzing the affected method chain through the changed code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; determining a test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request;
and recommending the determined test case as a test case for executing the test on the software system to be tested.
Preferably, the step of establishing a mapping relationship between each test case and the HTTP request according to a preset rule and a mapping relationship between the HTTP request and a method chain in the software system to be tested in the process of executing a test on a dynamic link of the software system to be tested by a preset test case includes:
recording an HTTP request entering a software system to be tested and a method chain passed by the HTTP request in the process of executing the test on the software system to be tested by a preset test case;
associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; and correlating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request.
Preferably, the step of recording, in the process of executing the test on the software system to be tested by the preset test case, the HTTP request entering the software system to be tested and the method chain through which the HTTP request passes includes:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; and recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent.
Preferably, when a code change occurs in the software system to be tested, the method chain for analyzing the influence by changing the code includes:
acquiring submission codes recorded by a preset version management tool corresponding to a software system to be tested, and analyzing all change codes among the submission codes of different versions of the software system to be tested; the preset version management tool comprises an open source code version control system SVN, a CVS and a distributed version control system GIT;
and determining the method chain associated with all the change codes as the affected method chain.
Preferably, the preset test cases include interface test cases and/or Web test cases.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium storing a test case recommendation system, which is executable by at least one processor to cause the at least one processor to perform the steps of the test case recommendation method as described above.
According to the test case recommendation method, the test case recommendation system and the readable storage medium, when the code in the software system to be tested is changed, the affected method chain is analyzed through the changed code; determining an HTTP request corresponding to the affected method chain according to a mapping relation between the HTTP request and the method chain established in advance; and determining the test case mapped by the HTTP request corresponding to the affected method chain for recommendation according to the mapping relation between the established test case and the HTTP request. Because the mapping relation between each test case and the HTTP request and the mapping relation between the HTTP request and the method chain in the software system to be tested can be established in advance in the process of executing the test on the dynamic link of the software system to be tested by the test cases, when a code change occurs in the software system to be tested, the incidence relation analysis between the affected method chain corresponding to the code change and the HTTP request and the test cases can be carried out, and the recommendation of the test cases can be carried out according to the incidence relation among the affected method chain, the HTTP request and the test cases, so that the accurate recommendation of the test cases can be carried out aiming at the changed code, the test execution resources can be utilized to the maximum extent, and the test efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of an operating environment of a preferred embodiment of a test case recommendation system 10 according to the present invention;
fig. 2 is a flowchart illustrating a test case recommendation method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
The invention provides a test case recommendation system. Please refer to fig. 1, which is a schematic diagram of an operating environment of a test case recommendation system 10 according to a preferred embodiment of the present invention.
In the present embodiment, the test case recommendation system 10 is installed and operated in the electronic device 1. The electronic device 1 may include, but is not limited to, a memory 11, a processor 12, and a display 13. Fig. 1 only shows the electronic device 1 with components 11-13, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may alternatively be implemented.
The memory 11 is at least one type of readable computer storage medium, and the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a hard disk or a memory of the electronic device 1. The memory 11 may also be an external storage device of the electronic apparatus 1 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic apparatus 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic apparatus 1. The memory 11 is used for storing application software installed in the electronic device 1 and various types of data, such as program codes of the test case recommendation system 10. The memory 11 may also be used to temporarily store data that has been output or is to be output.
The processor 12 may be, in some embodiments, a Central Processing Unit (CPU), microprocessor or other data Processing chip, and is configured to run program codes stored in the memory 11 or process data, such as executing the test case recommendation system 10.
The display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like in some embodiments. The display 13 is used for displaying information processed in the electronic device 1 and for displaying a visual user interface, such as a change code marking a software system to be tested, a test case finally recommended to be executed, and the like. The components 11-13 of the electronic device 1 communicate with each other via a system bus.
The test case recommendation system 10 includes at least one computer readable instruction stored in the memory 11 that is executable by the processor 12 to implement embodiments of the present application.
Wherein, the test case recommendation system 10 when executed by the processor 12 implements the following steps:
step S1, during the process of testing the dynamic link of the software system to be tested by the preset test case, establishing a mapping relationship between each test case and the HTTP request according to the preset rule, and a mapping relationship between the HTTP request and the method chain in the software system to be tested.
In the embodiment, in the process of executing a test on a software system to be tested by a preset test case, an HTTP request entering the software system to be tested and a method chain passed by the HTTP request are recorded; associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; and correlating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request. For example, in the process of testing a software system to be tested by a test case a, recording an HTTP request b entering the software system to be tested and a method chain c passed by the HTTP request b; associating the HTTP request b with the method chain c, and establishing a mapping relation between the HTTP request and the method chain; and the test case a is associated with the HTTP request b, a mapping relation between the test case and the HTTP request is established, and finally, the mapping relation between the test case a and the HTTP request b as well as the method chain c can be established. The test cases preset in the present embodiment include, but are not limited to, interface test cases, Web (Web page) test cases, and the like. The preset test case may be a test case written in a targeted and autonomous manner, or an existing test case may be called, for example, a statement coverage test case, a judgment coverage test case, a condition coverage test case, a judgment condition coverage test case, a condition combination coverage test case, a path coverage test case, and the like designed for codes implementing different functions are not limited herein.
Step S2, when the code in the software system to be tested changes, analyzing the affected method chain by changing the code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; and determining the test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request.
And step S3, recommending the determined test case as a test case for executing the test on the software system to be tested.
In this embodiment, when the code of the software system to be tested changes, the test case is used to execute the test. Firstly, determining change codes in a software system to be tested, for example, acquiring submission codes recorded by a preset version management tool (such as an SVN (version control system), a CVS (virtual component system) or a GIT (distributed version control system) of an open source code) corresponding to the software system to be tested, and analyzing all the change codes among the submission codes of different versions of the software system to be tested; then, the method chain to which all change codes are associated is determined, i.e., as the affected method chain.
For example, when a code is submitted to the SVN, the SVN may record and analyze all code change records between two software versions on the SVN, for example, the codes of the two software versions may be compared, and the different code portions between the two software versions may be used as change codes. The affected methods (chains) are then analyzed by changing the code, for example, in one embodiment, by counting past code coverage test data of the software system under test, the method chain associated with each partial function code can be determined, for example, the method chain corresponding to the code for implementing the "register" function is "a", the method chain corresponding to the code for implementing the "log in" function is "B", and so on. Determining an affected method chain for change codes between two software versions includes: (1) and when the change code is a change (modification or update) to the same function code between two software versions, for example, a change is made to a "registered" function code portion in a previous software version to form a next software version, determining that the method chain affected by the change code is "a". (2) And when the changed code is the addition or deletion of different function codes between two software versions, for example, the 'login' function code is added or deleted in the former software version to form the latter software version, the method chain influenced by the changed code is determined to be 'B'. In conclusion, the method chain associated with the change code can be determined as the affected method chain.
After the affected method chains are analyzed by the change codes, the appropriate test cases can be recommended according to the incidence mapping relation among the test cases, the method chains and the HTTP requests which are dynamically determined in the execution process of each test case. Specifically, the HTTP request corresponding to the affected method chain may be determined according to the determined mapping relationship between the method chain and the HTTP request; and determining a test case corresponding to the HTTP request according to the determined mapping relation between the HTTP request and the test case, and taking the determined test case as a recommended test case to be executed.
Compared with the prior art, in the embodiment, when the code in the software system to be tested is changed, the affected method chain is analyzed through the changed code; determining an HTTP request corresponding to the affected method chain according to a mapping relation between the HTTP request and the method chain established in advance; and determining the test case mapped by the HTTP request corresponding to the affected method chain for recommendation according to the mapping relation between the established test case and the HTTP request. Because the mapping relation between each test case and the HTTP request and the mapping relation between the HTTP request and the method chain in the software system to be tested can be established in advance in the process of executing the test on the dynamic link of the software system to be tested by the test cases, when a code change occurs in the software system to be tested, the incidence relation analysis between the affected method chain corresponding to the code change and the HTTP request and the test cases can be carried out, and the recommendation of the test cases can be carried out according to the incidence relation among the affected method chain, the HTTP request and the test cases, so that the accurate recommendation of the test cases can be carried out aiming at the changed code, the test execution resources can be utilized to the maximum extent, and the test efficiency is improved.
In an alternative embodiment, based on the above embodiment, when the test case recommendation system 10 is executed by the processor 12 in the step S1, the method includes the following steps:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; and recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent.
In this embodiment, first, an association mapping relationship between a test case, a method chain, and an HTTP request is dynamically determined in the process of executing each test case. Specifically, the Java bytecode toolkit can be configured to serve as a Java agent, and the Java is an open-source Java bytecode operation tool and is mainly used for modifying and processing compiled class files. In the embodiment, the java ssist toolkit is firstly configured as a java agent, and when a web (website) server is started, the java agent is utilized to perform interception before or during loading of a class file of the software system to be tested. For example, the bytecode is modified to enhance the method (chain) in the software system code to be tested, so as to record the related information (such as name, number, etc.) of the method (chain); and the filter of the software system to be tested is enhanced so as to capture the relevant information of the HTTP request.
For example, in the execution process of a test case, an HTTP request entering the software system to be tested may be recorded, and a method (chain) through which the HTTP request entering the software system to be tested passes is stored, so that the HTTP request and the method chain are associated, that is, a mapping relationship between the method chain and the HTTP request may be established. And the executed test cases are associated with the HTTP requests entering the software system to be tested in the test case execution process, and after a plurality of test cases are executed in sequence, the mapping relation between the HTTP requests and the test cases can be established.
As shown in fig. 2, fig. 2 is a schematic flowchart of an embodiment of a test case recommendation method of the present invention, and the test case recommendation method includes the following steps:
step S10, during the process of testing the dynamic link of the software system to be tested by the preset test case, establishing a mapping relationship between each test case and the HTTP request according to the preset rule, and a mapping relationship between the HTTP request and the method chain in the software system to be tested.
In the embodiment, in the process of executing a test on a software system to be tested by a preset test case, an HTTP request entering the software system to be tested and a method chain passed by the HTTP request are recorded; associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; and correlating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request. For example, in the process of testing a software system to be tested by a test case a, recording an HTTP request b entering the software system to be tested and a method chain c passed by the HTTP request b; associating the HTTP request b with the method chain c, and establishing a mapping relation between the HTTP request and the method chain; and the test case a is associated with the HTTP request b, a mapping relation between the test case and the HTTP request is established, and finally, the mapping relation between the test case a and the HTTP request b as well as the method chain c can be established. The test cases preset in the present embodiment include, but are not limited to, interface test cases, Web (Web page) test cases, and the like. The preset test case may be a test case written in a targeted and autonomous manner, or an existing test case may be called, for example, a statement coverage test case, a judgment coverage test case, a condition coverage test case, a judgment condition coverage test case, a condition combination coverage test case, a path coverage test case, and the like designed for codes implementing different functions are not limited herein.
Step S20, when the code in the software system to be tested changes, analyzing the affected method chain by changing the code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; and determining the test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request.
And step S30, recommending the determined test case as a test case for executing the test on the software system to be tested.
In this embodiment, when the code of the software system to be tested changes, the test case is used to execute the test. Firstly, determining change codes in a software system to be tested, for example, acquiring submission codes recorded by a preset version management tool (such as an SVN (version control system), a CVS (virtual component system) or a GIT (distributed version control system) of an open source code) corresponding to the software system to be tested, and analyzing all the change codes among the submission codes of different versions of the software system to be tested; then, the method chain to which all change codes are associated is determined, i.e., as the affected method chain.
For example, when a code is submitted to the SVN, the SVN may record and analyze all code change records between two software versions on the SVN, for example, the codes of the two software versions may be compared, and the different code portions between the two software versions may be used as change codes. The affected methods (chains) are then analyzed by changing the code, for example, in one embodiment, by counting past code coverage test data of the software system under test, the method chain associated with each partial function code can be determined, for example, the method chain corresponding to the code for implementing the "register" function is "a", the method chain corresponding to the code for implementing the "log in" function is "B", and so on. Determining an affected method chain for change codes between two software versions includes: (1) and when the change code is a change (modification or update) to the same function code between two software versions, for example, a change is made to a "registered" function code portion in a previous software version to form a next software version, determining that the method chain affected by the change code is "a". (2) And when the changed code is the addition or deletion of different function codes between two software versions, for example, the 'login' function code is added or deleted in the former software version to form the latter software version, the method chain influenced by the changed code is determined to be 'B'. In conclusion, the method chain associated with the change code can be determined as the affected method chain.
After the affected method chains are analyzed by the change codes, the appropriate test cases can be recommended according to the incidence mapping relation among the test cases, the method chains and the HTTP requests which are dynamically determined in the execution process of each test case. Specifically, the HTTP request corresponding to the affected method chain may be determined according to the determined mapping relationship between the method chain and the HTTP request; and determining a test case corresponding to the HTTP request according to the determined mapping relation between the HTTP request and the test case, and taking the determined test case as a recommended test case to be executed.
Compared with the prior art, in the embodiment, when the code in the software system to be tested is changed, the affected method chain is analyzed through the changed code; determining an HTTP request corresponding to the affected method chain according to a mapping relation between the HTTP request and the method chain established in advance; and determining the test case mapped by the HTTP request corresponding to the affected method chain for recommendation according to the mapping relation between the established test case and the HTTP request. Because the mapping relation between each test case and the HTTP request and the mapping relation between the HTTP request and the method chain in the software system to be tested can be established in advance in the process of executing the test on the dynamic link of the software system to be tested by the test cases, when a code change occurs in the software system to be tested, the incidence relation analysis between the affected method chain corresponding to the code change and the HTTP request and the test cases can be carried out, and the recommendation of the test cases can be carried out according to the incidence relation among the affected method chain, the HTTP request and the test cases, so that the accurate recommendation of the test cases can be carried out aiming at the changed code, the test execution resources can be utilized to the maximum extent, and the test efficiency is improved.
In an alternative embodiment, on the basis of the above embodiment, the step S10 includes:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; and recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent.
In this embodiment, first, an association mapping relationship between a test case, a method chain, and an HTTP request is dynamically determined in the process of executing each test case. Specifically, the Java bytecode toolkit can be configured to serve as a Java agent, and the Java is an open-source Java bytecode operation tool and is mainly used for modifying and processing compiled class files. In the embodiment, the java ssist toolkit is firstly configured as a java agent, and when a web (website) server is started, the java agent is utilized to perform interception before or during loading of a class file of the software system to be tested. For example, the bytecode is modified to enhance the method (chain) in the software system code to be tested, so as to record the related information (such as name, number, etc.) of the method (chain); and the filter of the software system to be tested is enhanced so as to capture the relevant information of the HTTP request.
For example, in the execution process of a test case, an HTTP request entering the software system to be tested may be recorded, and a method (chain) through which the HTTP request entering the software system to be tested passes is stored, so that the HTTP request and the method chain are associated, that is, a mapping relationship between the method chain and the HTTP request may be established. And the executed test cases are associated with the HTTP requests entering the software system to be tested in the test case execution process, and after a plurality of test cases are executed in sequence, the mapping relation between the HTTP requests and the test cases can be established.
In addition, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a test case recommendation system, and the test case recommendation system is executable by at least one processor, so that the at least one processor executes the steps of the test case recommendation method in the above embodiments, and the specific implementation processes of the test case recommendation method, such as steps S10, S20, S30, are as described above, and are not described herein again.
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 apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, and are not to be construed as limiting the scope of the invention. The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. Additionally, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
Those skilled in the art can implement the invention in various modifications, such as features from one embodiment can be used in another embodiment to yield yet a further embodiment, without departing from the scope and spirit of the invention. Any modification, equivalent replacement and improvement made within the technical idea of using the present invention should be within the scope of the right of the present invention.

Claims (6)

1. An electronic device comprising a memory, a processor, the memory having stored thereon a test case recommendation system executable on the processor, the test case recommendation system when executed by the processor implementing the steps of:
in the process that a preset test case executes a test on a dynamic link of a software system to be tested, establishing a mapping relation between each test case and an HTTP request according to a preset rule and establishing a mapping relation between the HTTP request and a method chain in the software system to be tested;
when the code in the software system to be tested is changed, analyzing the affected method chain through the changed code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; determining a test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request;
recommending the determined test case as a test case for executing the test on the software system to be tested;
the step of establishing a mapping relationship between each test case and the HTTP request according to a preset rule and a mapping relationship between the HTTP request and a method chain in the software system to be tested in the process of executing the test on the dynamic link of the software system to be tested by the preset test case comprises the following steps:
recording an HTTP request entering a software system to be tested and a method chain passed by the HTTP request in the process of executing the test on the software system to be tested by a preset test case;
associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; associating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request;
the step of recording the HTTP request entering the software system to be tested and the method chain passed by the HTTP request in the process of executing the test on the software system to be tested by the preset test case comprises the following steps:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent; intercepting by the Java agent before or during loading of the class file of the software system to be tested so as to enhance the method chain in the code of the software system to be tested and record the relevant information of the method chain.
2. The electronic device of claim 1, wherein analyzing the affected method chain by changing code when a code change occurs in the software system under test comprises:
acquiring submission codes recorded by a preset version management tool corresponding to a software system to be tested, and analyzing all change codes among the submission codes of different versions of the software system to be tested; the preset version management tool comprises an open source code version control system SVN, a CVS and a distributed version control system GIT;
and determining the method chain associated with all the change codes as the affected method chain.
3. A test case recommendation method is characterized by comprising the following steps:
in the process that a preset test case executes a test on a dynamic link of a software system to be tested, establishing a mapping relation between each test case and an HTTP request according to a preset rule and establishing a mapping relation between the HTTP request and a method chain in the software system to be tested;
when the code in the software system to be tested is changed, analyzing the affected method chain through the changed code; determining an HTTP request corresponding to the affected method chain according to the established mapping relation between the HTTP request and the method chain; determining a test case mapped by the HTTP request corresponding to the affected method chain according to the mapping relation between the established test case and the HTTP request;
recommending the determined test case as a test case for executing the test on the software system to be tested;
the step of establishing a mapping relationship between each test case and the HTTP request according to a preset rule and a mapping relationship between the HTTP request and a method chain in the software system to be tested in the process of executing the test on the dynamic link of the software system to be tested by the preset test case comprises the following steps:
recording an HTTP request entering a software system to be tested and a method chain passed by the HTTP request in the process of executing the test on the software system to be tested by a preset test case;
associating the HTTP request entering the software system to be tested with a method chain through which the HTTP request passes, and establishing a mapping relation between the HTTP request and the method chain; associating the executed test case with the HTTP request entering the software system to be tested, and establishing a mapping relation between the test case and the HTTP request;
the step of recording the HTTP request entering the software system to be tested and the method chain passed by the HTTP request in the process of executing the test on the software system to be tested by the preset test case comprises the following steps:
configuring a Java bytecode tool as a Java agent, and when a preset Web server is started and a preset test case executes a test process on a software system to be tested, enhancing a filter of the software system to be tested by using the Java agent so as to capture an HTTP request entering the software system to be tested; recording a method chain passed by the HTTP request entering the software system to be tested by using the Java agent; intercepting by the Java agent before or during loading of the class file of the software system to be tested so as to enhance the method chain in the code of the software system to be tested and record the relevant information of the method chain.
4. The test case recommendation method of claim 3, wherein analyzing the affected method chain by changing code when code change occurs in the software system under test comprises:
acquiring submission codes recorded by a preset version management tool corresponding to a software system to be tested, and analyzing all change codes among the submission codes of different versions of the software system to be tested; the preset version management tool comprises an open source code version control system SVN, a CVS and a distributed version control system GIT;
and determining the method chain associated with all the change codes as the affected method chain.
5. The test case recommendation method of claim 3, wherein the preset test cases comprise interface test cases and/or Web test cases.
6. A computer-readable storage medium, having stored thereon a test case recommendation system which, when executed by a processor, performs the steps of the test case recommendation method of any of claims 3-5.
CN201810345026.8A 2018-04-17 2018-04-17 Test case recommendation method, electronic device and readable storage medium Active CN108829575B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810345026.8A CN108829575B (en) 2018-04-17 2018-04-17 Test case recommendation method, electronic device and readable storage medium
PCT/CN2018/102405 WO2019200808A1 (en) 2018-04-17 2018-08-27 Test case recommendation method, electronic device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810345026.8A CN108829575B (en) 2018-04-17 2018-04-17 Test case recommendation method, electronic device and readable storage medium

Publications (2)

Publication Number Publication Date
CN108829575A CN108829575A (en) 2018-11-16
CN108829575B true CN108829575B (en) 2021-08-24

Family

ID=64155426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810345026.8A Active CN108829575B (en) 2018-04-17 2018-04-17 Test case recommendation method, electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN108829575B (en)
WO (1) WO2019200808A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258876B (en) * 2018-11-30 2023-08-01 中国移动通信集团浙江有限公司 Accurate regression testing method and device under micro-service architecture
CN110413506B (en) * 2019-06-19 2023-02-03 平安普惠企业管理有限公司 Test case recommendation method, device, equipment and storage medium
CN115905031B (en) * 2023-03-14 2023-06-23 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101393807B1 (en) * 2012-11-22 2014-05-12 슈어소프트테크주식회사 Apparatus for regression testing of software and method thereof
CN103870384A (en) * 2012-12-11 2014-06-18 航天信息股份有限公司 Test case presumption method and system
CN104657256A (en) * 2013-11-19 2015-05-27 阿里巴巴集团控股有限公司 Method and device for collecting mapping relation between cases and codes
CN105205000A (en) * 2015-10-12 2015-12-30 用友网络科技股份有限公司 Method and system for positioning influenced code scope in software development
CN107515826A (en) * 2017-08-28 2017-12-26 广州阿里巴巴文学信息技术有限公司 Test case accurate recommendation method, device, system, equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9419884B1 (en) * 2012-12-28 2016-08-16 Emc Corporation Intelligent automated testing method for restful web services
US10942839B2 (en) * 2016-10-28 2021-03-09 Ingram Micro Inc. System and method for debugging applications on a developer workstation
CN107341098B (en) * 2017-07-13 2020-06-19 携程旅游信息技术(上海)有限公司 Software performance testing method, platform, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101393807B1 (en) * 2012-11-22 2014-05-12 슈어소프트테크주식회사 Apparatus for regression testing of software and method thereof
CN103870384A (en) * 2012-12-11 2014-06-18 航天信息股份有限公司 Test case presumption method and system
CN104657256A (en) * 2013-11-19 2015-05-27 阿里巴巴集团控股有限公司 Method and device for collecting mapping relation between cases and codes
CN105205000A (en) * 2015-10-12 2015-12-30 用友网络科技股份有限公司 Method and system for positioning influenced code scope in software development
CN107515826A (en) * 2017-08-28 2017-12-26 广州阿里巴巴文学信息技术有限公司 Test case accurate recommendation method, device, system, equipment and storage medium

Also Published As

Publication number Publication date
WO2019200808A1 (en) 2019-10-24
CN108829575A (en) 2018-11-16

Similar Documents

Publication Publication Date Title
US8291405B2 (en) Automatic dependency resolution by identifying similar machine profiles
CN108829575B (en) Test case recommendation method, electronic device and readable storage medium
US8209658B2 (en) Method of creating signatures for classifying program failures
CN108491321B (en) Method and device for determining test case range and storage medium
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
CN110866258B (en) Rapid vulnerability positioning method, electronic device and storage medium
WO2015131804A1 (en) Call stack relationship acquiring method and apparatus
US10599558B1 (en) System and method for identifying inputs to trigger software bugs
CN108427637B (en) Test case recommendation method, electronic device and readable storage medium
CN112166419A (en) Electronic device for detecting software bugs and method for operating the same
US20150143342A1 (en) Functional validation of software
CN111158741A (en) Method and device for monitoring change of dependency relationship of business module on third-party class library
US20120054724A1 (en) Incremental static analysis
JP2016099857A (en) Fraudulent program handling system and fraudulent program handling method
CN108763054B (en) Test effect display method of test case, electronic device and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
US9064042B2 (en) Instrumenting computer program code by merging template and target code methods
EP3692456B1 (en) Binary image stack cookie protection
EP3818437B1 (en) Binary software composition analysis
CN111124894A (en) Code coverage rate processing method and device and computer equipment
US20170206355A1 (en) Dynamically-loaded code analysis device, dynamically-loaded code analysis method, and dynamically-loaded code analysis program
US9824175B1 (en) Method and system of evaluation of validity of a refinement rule for a hardware emulation
CN105243022B (en) The performance data analysis method and device of host application software system
CN113031995A (en) Rule updating method and device, storage medium and electronic equipment
CN112819621A (en) Intelligent contract resource loss testing method 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