CN110716859A - Method for automatically pushing test cases for modified codes and related device - Google Patents

Method for automatically pushing test cases for modified codes and related device Download PDF

Info

Publication number
CN110716859A
CN110716859A CN201910818770.XA CN201910818770A CN110716859A CN 110716859 A CN110716859 A CN 110716859A CN 201910818770 A CN201910818770 A CN 201910818770A CN 110716859 A CN110716859 A CN 110716859A
Authority
CN
China
Prior art keywords
code
interface
modified
abstract class
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910818770.XA
Other languages
Chinese (zh)
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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201910818770.XA priority Critical patent/CN110716859A/en
Publication of CN110716859A publication Critical patent/CN110716859A/en
Pending legal-status Critical Current

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
    • 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

Abstract

The disclosure relates to a method and a related device for automatically pushing a test case for modifying a code, belonging to the technical field of testing, wherein the method comprises the following steps: acquiring code modification information from a code modification archive, wherein the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code; acquiring a second abstract class of an interface for calling the modification code; judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class; and acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relation, and pushing the pre-pushed test case to a user. The method and the device can automatically and accurately judge the test case suitable for the modified code based on the modified code, the code functions, the classes and the relation of the test case, and effectively ensure the functional integrity and the high test efficiency of the test.

Description

Method for automatically pushing test cases for modified codes and related device
Technical Field
The present disclosure relates to the field of test technologies, and in particular, to a method and a related apparatus for automatically pushing a test case for a modified code.
Background
When the application system performs the function test, the related function test of the system can be performed according to different test cases. The system often needs to change such as upgrading and modification, code modification is carried out, codes are modified or modified by multiple persons, some development is unknown, if some optimization requirements exist, functional points influenced by development positioning are insufficient, test omission can be caused, if development does not clearly influence the range, all functional processes need to be verified and tested, and a lot of manpower is invested, and key functions can still not be tested. In the prior art, each time a test case is written or searched according to a modified code, and then testing is performed, so that a large amount of time is consumed, and the defects of test missing, inaccurate testing and the like are caused.
Therefore, a new method and related apparatus for automatically pushing test cases for modified code are needed.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The purpose of the present disclosure is to provide a scheme for automatically pushing a test case for a modified code, so as to ensure the integrity and reliability of a function test of the modified code on the basis of at least ensuring the test case for the modified code to be automatically and accurately pushed to a certain extent.
According to one aspect of the present disclosure, a method for automatically pushing a test case for modifying code is provided, which includes:
acquiring code modification information from a code modification archive, wherein the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code;
acquiring a second abstract class of an interface for calling a modified code according to the interface for modifying the code in the code modification information;
judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class;
and acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the codes.
In an exemplary embodiment of the present disclosure, the second abstract class includes:
all abstract classes of the interface of the modified code are called.
In an exemplary embodiment of the present disclosure, the second abstract class further includes:
and calling more than a preset number of abstract classes of an abstract method in the interface of the modified code.
In an exemplary embodiment of the present disclosure, the determining, according to the calling relationship between the first abstract class and the second abstract class, an association relationship between a code function of the modified code and a code function of an interface of the modified code includes:
acquiring a plurality of preset call relations which can be associated with the test case in all call relations of the first abstract class and the second abstract class;
and judging the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the plurality of calling relationships.
In an exemplary embodiment of the present disclosure, the determining, according to the call relation, an association relation between a code function of a modified code associated with the first abstract class and a code function of an interface of a modified code associated with the second abstract class includes:
acquiring the importance degree of each calling relation according to the number of calling objects of each calling relation and the preset strength of each calling relation in the calling relations;
and when the importance degree of the calling relationship exceeds a preset threshold value, judging the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the calling relationship.
In an exemplary embodiment of the present disclosure, the obtaining, according to the association relationship, a pre-pushed test case from test cases associated with a code function of an interface of the modified code, and pushing the pre-pushed test case to a user as the test case of the modified code includes:
acquiring the association relationship between the code function of the modified code and the code function of the interface of the modified code;
acquiring a part of test cases with the incidence relation from all the test cases associated with the code function of the interface for modifying the codes, and taking the part of test cases as pre-pushed test cases;
and pushing the pre-pushed test case to a user as the test case of the modified code.
In an exemplary embodiment of the present disclosure, the code modification information further includes an abstract method of modifying code, the method further including:
acquiring a third abstract class for calling the abstract method of the modified code according to the abstract method of the modified code;
judging the incidence relation between the code function of the modified code and the code function of the abstract method of the modified code according to the calling relation between the first abstract class and the third abstract class;
and acquiring a pre-pushed test case from the test cases associated with the code function of the abstract method for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case of the modified codes.
According to one aspect of the present disclosure, an apparatus for automatically pushing test cases for modifying code is provided, which includes:
the code modification system comprises an acquisition module, a storage module and a modification module, wherein the acquisition module is used for acquiring code modification information from a code modification archive, and the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code;
the analysis module is used for acquiring a second abstract class of an interface for calling the modified code according to the interface for modifying the code in the code modification information;
the judging module is used for judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class;
and the pushing module is used for acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the codes.
According to an aspect of the present disclosure, there is provided a computer-readable storage medium having a program for automatically pushing test cases for modifying code stored thereon, wherein the program for automatically pushing test cases for modifying code implements any one of the methods described above when executed by a processor.
According to an aspect of the present disclosure, there is provided an electronic apparatus, comprising:
a processor; and
the memory is used for storing a program of the processor, which automatically pushes a test case for modifying the code; wherein the processor is configured to perform any of the above methods via execution of the program that automatically pushes test cases for modified code.
The invention discloses a method and a device for automatically pushing a test case for modifying a code, wherein firstly, code modification information is obtained from a code modification archive, and the code modification information comprises a modified code, a modified code interface and a first abstract class associated with the modified code; by acquiring the code modification information of the first abstract class including the modification code, the interface of the modification code and the association of the modification code, the test case suitable for the modification code can be accurately judged according to the case-function-code corresponding relation. Then, acquiring a second abstract class of the interface for calling the modified code according to the interface for modifying the code in the code modification information; finding out which classes call the interface of the modified piece of code, i.e. the second abstract class, allows performing a relational analysis of the first abstract class and the second abstract class in subsequent steps. Then, judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class; the incidence relation between the code functions corresponding to the two classes can be accurately analyzed through the calling relation between the first abstract class and the second abstract class, and then the incidence relation between the code function of the modified code corresponding to the two classes and the code function of the interface of the modified code can be accurately guided. And finally, acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case serving as the test case for modifying the codes to a user. The test case is written for testing the function points of the codes, and the applicable test case for modifying the codes can be automatically and accurately judged through the relation between the functions of the codes, so that the accuracy and the high efficiency of the function test of the modified codes are effectively ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
FIG. 1 schematically illustrates a flow diagram of a method for automatically pushing test cases for modifying code.
FIG. 2 is a diagram schematically illustrating an example of an application scenario of a method for automatically pushing test cases for modifying code.
Fig. 3 schematically shows a flowchart of an association relation determination method between code functions.
FIG. 4 is a block diagram of an apparatus for automatically pushing test cases for modifying code.
FIG. 5 schematically illustrates an example block diagram of an electronic device for implementing the above-described method for automatically pushing test cases for modifying code.
FIG. 6 schematically illustrates a computer-readable storage medium for implementing the above-described method for automatically pushing test cases for modifying code.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The present exemplary embodiment first provides a method for automatically pushing a test case for code modification, where the method for automatically pushing a test case for code modification may be executed on a server, or may be executed on a server cluster or a cloud server, and of course, a person skilled in the art may also execute the method of the present invention on another platform according to a requirement, and this is not particularly limited in the present exemplary embodiment. Referring to fig. 1, the method for automatically pushing test cases for modifying code may include the following steps:
step S110, code modification information is obtained from a code modification archive, and the code modification information comprises a modification code, a modification code interface and a first abstract class associated with the modification code;
step S120, acquiring a second abstract class of the interface for calling the modified code according to the interface for modifying the code in the code modification information;
step S130, judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class;
step S140, according to the association relationship, obtaining a pre-pushed test case from the test cases associated with the code function of the interface for modifying the code, and pushing the pre-pushed test case to the user as the test case for modifying the code.
Firstly, code modification information is obtained from a code modification archive, wherein the code modification information comprises a modified code, a code modification interface and a first abstract class associated with the modified code; by acquiring the code modification information of the first abstract class including the modification code, the interface of the modification code and the association of the modification code, the test case suitable for the modification code can be accurately judged according to the case-function-code corresponding relation. Then, acquiring a second abstract class of the interface for calling the modified code according to the interface for modifying the code in the code modification information; finding out which classes call the interface of the modified piece of code, i.e. the second abstract class, allows performing a relational analysis of the first abstract class and the second abstract class in subsequent steps. Then, judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class; the incidence relation between the code functions corresponding to the two classes can be accurately analyzed through the calling relation between the first abstract class and the second abstract class, and then the incidence relation between the code function of the modified code corresponding to the two classes and the code function of the interface of the modified code can be accurately guided. And finally, acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case serving as the test case for modifying the codes to a user. The test case is written for testing the function points of the codes, and the applicable test case for modifying the codes can be automatically and accurately judged through the relation between the functions of the codes, so that the accuracy and the high efficiency of the function test of the modified codes are effectively ensured.
In the following, the steps in the method for automatically pushing test cases for modifying code described above in this exemplary embodiment will be explained and explained in detail with reference to the drawings.
In step S110, code modification information is obtained from the code modification archive, where the code modification information includes modification code, an interface of the modification code, and a first abstract class associated with the modification code.
In the embodiment of the present example, referring to fig. 2, the server 201 obtains code modification information, which may be code modification information generated in system upgrade and change, from a code modification archive stored on the server 202, and the code modification information may include at least a modification code, an interface of the modification code, and a first abstract class associated with the modification code. The server 201 may be any terminal having program instructions executed thereon, such as a mobile phone, a computer, etc.; the terminal device 202 may be any terminal having the functions of executing and storing an application system, such as a mobile phone, a computer, and the like.
The code modification archive stores relevant information of each code modification, wherein the relevant information comprises modified code, an interface of the modified code, a method for modifying the code, a first abstract class associated with the modified code and the like, and the information is associated with the modified code. Each modified code has a corresponding interface and abstract class for modifying the code, and the abstract class is often used for representing abstract concepts obtained in the analysis and design of the problem field, and is an abstraction of a series of concrete concepts which look different but are essentially the same, and at least can comprise a global constant and an abstract method. The interface for modifying the code is that when only the global constants and the abstract methods exist in the abstract class, the abstract class can be defined as the interface. An interface is a collection of abstract methods. By acquiring the code modification information of the first abstract class including the modification code, the interface of the modification code and the association of the modification code, the test case suitable for the modification code can be accurately judged according to the case-function-code corresponding relation.
In step S120, a second abstract class of the interface for calling the modified code is obtained according to the interface for modifying the code in the code modification information.
In the embodiment of the present example, the relationship analysis between the first abstract class and the second abstract class can be performed in the subsequent step by finding out which classes call the interface of the modified piece of code, that is, the second abstract class. The code is scanned by the script, so that the class calling the interface of the modified code, namely the second abstract class, can be found out.
In one embodiment of this example, the second abstract class includes:
all abstract classes of the interface of the modified code are called.
If an abstract class only realizes part of methods of an interface, namely inherits part of methods of the interface, the class is necessarily an abstract class, and conversely, the abstract class can realize part of methods or one method of the interface or can not realize the method; the method in one interface can be called by a plurality of abstract classes, and the calling relation between all the second abstract classes and the first abstract class can be carried out in the subsequent steps by acquiring all the abstract classes of the interface for calling the modified code, so that the judgment is more comprehensive.
In an embodiment of this example, the second abstract class further comprises:
and calling more than a preset number of abstract classes of an abstract method in the interface of the modified code.
If an abstract class only realizes part of methods of an interface, namely inherits part of methods of the interface, the class is necessarily an abstract class, and conversely, the abstract class can realize part of methods or one method of the interface or can not realize the method; one abstract class may call several methods in the interface, the more the number of the called methods is, the stronger the relevance is, and the efficiency of subsequent analysis can be effectively improved by obtaining the abstract class of which the method in the interface calling the modified code exceeds the predetermined threshold, that is, the part of the abstract class of which the relevance exceeds the predetermined threshold.
In step S130, an association relationship between the code function of the modified code and the code function of the interface of the modified code is determined according to the calling relationship between the first abstract class and the second abstract class.
In the present exemplary embodiment, the code function, i.e., the user story, refers to a function that is desired by the user from the user's perspective. By obtaining the call relationship between the first abstract class associated with the modified code and the second abstract class associated with the interface of the modified code, that is, the call relationships such as inheritance, implementation, combination, aggregation, association, dependency, and the like, the association relationship between the code function of the modified code and the code function of the interface of the modified code can be determined. For example, the second abstract class inherits the first abstract class, which means that the second abstract class obtains the function of the first abstract class, and simultaneously, the second abstract class can also extend the function of the second abstract class, that is, the code function of the interface of the modified code associated with the second abstract class includes the code function of the modified code associated with the first abstract class. The incidence relation between the code functions corresponding to the two classes can be accurately analyzed through the calling relation between the first abstract class and the second abstract class, and then the incidence relation between the code function of the modified code corresponding to the two classes and the code function of the interface of the modified code can be accurately guided.
In an implementation manner of this example, the determining, according to the calling relationship between the first abstract class and the second abstract class, an association relationship between the code function of the modified code and the code function of the interface of the modified code, as shown in fig. 3, includes step S310 and step S320:
in step S310, a plurality of predetermined call relations that can be associated with the test case are obtained from all call relations of the first abstract class and the second abstract class;
in step S320, an association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class is determined according to the plurality of call relationships.
By obtaining the calling relationship between the first abstract class associated with the modified code and the second abstract class associated with the interface of the modified code, namely, the calling relationships such as inheritance, implementation, combination, aggregation, association, dependency and the like, the association relationship between the code function of the modified code and the code function of the interface of the modified code can be judged, for example, the second abstract class inherits the first abstract class, so that the second abstract class can expand the function of the second abstract class while obtaining the function of the first abstract class, namely, the code function of the interface of the modified code associated with the second abstract class contains the code function of the modified code associated with the first abstract class. However, the implementation relation in the calling relation indicates that one class implements the function of another class, and association can be performed on the code function, but association is not strong on the test cases in the subsequent steps. Therefore, the predetermined plurality of call relations which can be associated with the test cases are call relations such as combination, aggregation, association and the like which can be firstly associated through guiding the code functions and can accurately guide the test case association in the subsequent steps. Therefore, the efficiency of obtaining the association relation among the code functions and the guidance reliability for carrying out test case association in the subsequent steps can be effectively ensured.
In an embodiment of the present example, the determining, according to the plurality of call relations, an association relation between a code function of a modified code associated with the first abstract class and a code function of an interface of a modified code associated with the second abstract class includes:
acquiring the importance degree of each calling relation according to the number of calling objects of each calling relation and the preset strength of each calling relation in the calling relations;
and when the importance degree of the calling relationship exceeds a preset threshold value, judging the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the calling relationship.
The importance degree of each call relation is a numerical value of the importance of each call relation acting between the first abstract class and the second abstract class, and the higher the importance degree is, the more critical the guidance of the test case in the subsequent step is. The number of the call objects of each call relation is two in the relations between the system user and the B2C member and the B2E member, for example, the larger the number of the call objects is, the more compact the call relation is at present. The preset strength of the call relation is that according to the conventional call strength sequence of each call relation, the sequence is generally as follows: inheriting, combining, aggregating, associating and depending, wherein the strength value preset for each calling relationship according to the sequence, such as 10, 20.
And obtaining the importance degree of each call relation according to the number of call objects of each call relation and the preset strength of each call relation in the plurality of call relations, wherein the importance degree of each call relation can be obtained by multiplying the number of objects by the preset strength of the call relations. Or adding the number of the calling objects and the preset strength of the calling relationship to obtain the importance degree of each calling relationship.
Thus, when the importance degree of the calling relationship exceeds a preset threshold value, the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class can be judged according to the calling relationship. Therefore, the incidence relation is not judged when the calling relation is weak at present, the judgment efficiency can be effectively improved, and the judgment accuracy is improved.
In an embodiment of this example, the obtaining, according to the association relationship, a pre-pushed test case from test cases associated with a code function of the interface for modifying code, and pushing the pre-pushed test case to a user as the test case for modifying code includes:
acquiring the association relationship between the code function of the modified code and the code function of the interface of the modified code;
acquiring a part of test cases with the incidence relation from all the test cases associated with the code function of the interface for modifying the codes, and taking the part of test cases as pre-pushed test cases;
and pushing the pre-pushed test case to a user as the test case of the modified code.
All the test cases associated with the code functions of the interface for modifying the code may be many, and by acquiring the partial test cases with the association relationship from all the test cases associated with the code functions of the interface for modifying the code, in most cases, one use case may contain a plurality of user stories, namely the code functions. The partial test cases are used as the pre-pushed test cases, so that the partial test cases suitable for the modified codes can be accurately obtained, and the correlation correctness of the test cases is effectively ensured.
In step S140, according to the association relationship, a pre-pushed test case is obtained from the test cases associated with the code function of the interface for modifying the code, and is pushed to the user as the test case for modifying the code.
In the embodiment of the present example, according to the association relationship between the code function of the modified code and the code function of the interface of the modified code, for example, the code function of the interface of the modified code associated with the second abstract class includes the code function of the modified code associated with the first abstract class, and when the association relationship is that the pre-pushed test case is obtained from the test cases associated with the code function of the interface of the modified code, the test case that may include the code function of the code implementing the modified code may be obtained, and the test case that may include the code function implementing the modified code is pushed to the user as the test case of the modified code. Therefore, the test case suitable for the modified code can be accurately judged according to the modified code, the code function, the class and the relation of the test case.
In one embodiment of this example, the code modification information further includes an abstract method of modifying code, the method further comprising:
acquiring a third abstract class for calling the abstract method of the modified code according to the abstract method of the modified code;
judging the incidence relation between the code function of the modified code and the code function of the abstract method of the modified code according to the calling relation between the first abstract class and the third abstract class;
and acquiring a pre-pushed test case from the test cases associated with the code function of the abstract method for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case of the modified codes.
The code modification information obtained from the code archive can also be a modified code, an abstract method for modifying the code and a first abstract class associated with the modified code, wherein the abstract method for modifying the code is one of interfaces (set of abstract methods) of the modified code, so that the method is more targeted, the judgment range is narrowed, and the association efficiency and the association accuracy of the test case are effectively improved.
The present disclosure also provides a device for automatically pushing test cases for modifying codes. Referring to fig. 4, the automatic deleting apparatus for useless resources may include an obtaining module 410, an analyzing module 420, a judging module 430, and a pushing module 440. Wherein:
the obtaining module 410 may be configured to obtain code modification information from a code modification archive, where the code modification information includes modification code, an interface of the modification code, and a first abstract class associated with the modification code;
the analysis module 420 may be configured to obtain, according to the interface of the modified code in the code modification information, a second abstract class of the interface that calls the modified code;
the determining module 430 may be configured to determine, according to the calling relationship between the first abstract class and the second abstract class, an association relationship between the code function of the modified code and the code function of the interface of the modified code;
the pushing module 440 may be configured to obtain a pre-pushed test case from the test cases associated with the code function of the interface for modifying the code according to the association relationship, and push the pre-pushed test case to the user as the test case for modifying the code.
The specific details of each module in the apparatus for automatically pushing a test case for modifying a code have been described in detail in the corresponding method for automatically pushing a test case for modifying a code, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the invention is described below with reference to fig. 5. The electronic device 500 shown in fig. 5 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: the at least one processing unit 510, the at least one memory unit 520, and a bus 530 that couples various system components including the memory unit 520 and the processing unit 510.
Wherein the storage unit stores program code that is executable by the processing unit 510 to cause the processing unit 510 to perform steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification. For example, the processing unit 510 may execute step S110 as shown in fig. 1: acquiring code modification information from a code modification archive, wherein the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code; s120: acquiring a second abstract class of an interface for calling a modified code according to the interface for modifying the code in the code modification information; step S130: judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class; step S140: and acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the codes.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203.
Storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 700 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a client to interact with the electronic device 500, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. As shown, the network adapter 560 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
Referring to fig. 6, a program product 600 for implementing the above method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the client computing device, partly on the client device, as a stand-alone software package, partly on the client computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the client computing device over any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., over the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method for automatically pushing test cases for modifying codes is characterized by comprising the following steps:
acquiring code modification information from a code modification archive, wherein the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code;
acquiring a second abstract class of an interface for calling a modified code according to the interface for modifying the code in the code modification information;
judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class;
and acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the codes.
2. The method of claim 1, wherein the second abstract class comprises:
all abstract classes of the interface of the modified code are called.
3. The method of claim 1, wherein the second abstract class further comprises:
and calling more than a preset number of abstract classes of an abstract method in the interface of the modified code.
4. The method according to claim 1, wherein the determining the association relationship between the code function of the modified code and the code function of the interface of the modified code according to the calling relationship between the first abstract class and the second abstract class comprises:
acquiring a plurality of preset call relations which can be associated with the test case in all call relations of the first abstract class and the second abstract class;
and judging the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the plurality of calling relationships.
5. The method according to claim 4, wherein the determining an association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the plurality of call relations comprises:
acquiring the importance degree of each calling relation according to the number of calling objects of each calling relation and the preset strength of each calling relation in the calling relations;
and when the importance degree of the calling relationship exceeds a preset threshold value, judging the association relationship between the code function of the modified code associated with the first abstract class and the code function of the interface of the modified code associated with the second abstract class according to the calling relationship.
6. The method according to claim 1, wherein the obtaining a pre-pushed test case from the test cases associated with the code function of the interface for modifying the code according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the code comprises:
acquiring the association relationship between the code function of the modified code and the code function of the interface of the modified code;
acquiring a part of test cases with the incidence relation from all the test cases associated with the code function of the interface for modifying the codes, and taking the part of test cases as pre-pushed test cases;
and pushing the pre-pushed test case to a user as the test case of the modified code.
7. The method of claim 1, wherein the code modification information further comprises an abstract method of modifying code, the method further comprising:
acquiring a third abstract class for calling the abstract method of the modified code according to the abstract method of the modified code;
judging the incidence relation between the code function of the modified code and the code function of the abstract method of the modified code according to the calling relation between the first abstract class and the third abstract class;
and acquiring a pre-pushed test case from the test cases associated with the code function of the abstract method for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case of the modified codes.
8. An apparatus for automatically pushing test cases for modifying code, comprising:
the code modification system comprises an acquisition module, a storage module and a modification module, wherein the acquisition module is used for acquiring code modification information from a code modification archive, and the code modification information comprises a modification code, an interface of the modification code and a first abstract class associated with the modification code;
the analysis module is used for acquiring a second abstract class of an interface for calling the modified code according to the interface for modifying the code in the code modification information;
the judging module is used for judging the incidence relation between the code function of the modified code and the code function of the interface of the modified code according to the calling relation between the first abstract class and the second abstract class;
and the pushing module is used for acquiring a pre-pushed test case from the test cases associated with the code function of the interface for modifying the codes according to the association relationship, and pushing the pre-pushed test case to a user as the test case for modifying the codes.
9. A computer-readable storage medium on which a program for automatically pushing test cases for modifying code is stored, wherein the program for automatically pushing test cases for modifying code implements the method of any one of claims 1 to 7 when executed by a processor.
10. An electronic device, comprising:
a processor; and
the memory is used for storing a program of the processor, which automatically pushes a test case for modifying the code; wherein the processor is configured to perform the method of any of claims 1-7 via execution of the program that automatically pushes test cases for modified code.
CN201910818770.XA 2019-08-30 2019-08-30 Method for automatically pushing test cases for modified codes and related device Pending CN110716859A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910818770.XA CN110716859A (en) 2019-08-30 2019-08-30 Method for automatically pushing test cases for modified codes and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910818770.XA CN110716859A (en) 2019-08-30 2019-08-30 Method for automatically pushing test cases for modified codes and related device

Publications (1)

Publication Number Publication Date
CN110716859A true CN110716859A (en) 2020-01-21

Family

ID=69209656

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910818770.XA Pending CN110716859A (en) 2019-08-30 2019-08-30 Method for automatically pushing test cases for modified codes and related device

Country Status (1)

Country Link
CN (1) CN110716859A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626051A (en) * 2021-07-27 2021-11-09 北京达佳互联信息技术有限公司 Byte code updating method and device and electronic equipment
CN116069667A (en) * 2023-03-06 2023-05-05 天津卓朗昆仑云软件技术有限公司 Test case auxiliary positioning method and device based on code analysis

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302710A (en) * 2014-07-03 2016-02-03 腾讯科技(深圳)有限公司 Method and apparatus for determining test case in need of regression testing
CN107085555A (en) * 2017-04-19 2017-08-22 广州视源电子科技股份有限公司 Code test method, device, terminal and storage medium
CN109542779A (en) * 2018-11-12 2019-03-29 泰康保险集团股份有限公司 Test method, device and storage medium
CN110007920A (en) * 2018-01-04 2019-07-12 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment obtaining code dependence
CN110147317A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 Code test method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302710A (en) * 2014-07-03 2016-02-03 腾讯科技(深圳)有限公司 Method and apparatus for determining test case in need of regression testing
CN107085555A (en) * 2017-04-19 2017-08-22 广州视源电子科技股份有限公司 Code test method, device, terminal and storage medium
CN110007920A (en) * 2018-01-04 2019-07-12 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment obtaining code dependence
CN109542779A (en) * 2018-11-12 2019-03-29 泰康保险集团股份有限公司 Test method, device and storage medium
CN110147317A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 Code test method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626051A (en) * 2021-07-27 2021-11-09 北京达佳互联信息技术有限公司 Byte code updating method and device and electronic equipment
CN116069667A (en) * 2023-03-06 2023-05-05 天津卓朗昆仑云软件技术有限公司 Test case auxiliary positioning method and device based on code analysis

Similar Documents

Publication Publication Date Title
CN107506300B (en) User interface testing method, device, server and storage medium
CN110457277A (en) Service process performance analysis method, device, equipment and storage medium
CN109656815B (en) Test statement writing method, device and medium with configuration file and electronic equipment
CN107145446B (en) Application program APP test method, device and medium
CN110688096A (en) Method, device, medium and electronic equipment for constructing application program containing plug-in
CN110727437A (en) Code optimization item acquisition method and device, storage medium and electronic equipment
CN110716859A (en) Method for automatically pushing test cases for modified codes and related device
US11422917B2 (en) Deriving software application dependency trees for white-box testing
CN110597704B (en) Pressure test method, device, server and medium for application program
CN110704614B (en) Information processing method and device for predicting user group type in application
CN115022201B (en) Data processing function test method, device, equipment and storage medium
CN110609786A (en) Software testing method and device, computer equipment and storage medium
CN111949549B (en) Test request screening method, system, electronic equipment and storage medium
CN111151008B (en) Verification method and device for game operation data, configuration background and medium
CN111124423B (en) Compiling detection method, device, server and medium based on multiple platforms
CN111741046B (en) Data reporting method, data acquisition method, device, equipment and medium
CN114724725A (en) Data processing method and device, electronic equipment and storage medium
CN110674491B (en) Method and device for real-time evidence obtaining of android application and electronic equipment
CN114185805A (en) Embedded point verification method, device, equipment and storage medium
CN111124627B (en) Method and device for determining call initiator of application program, terminal and storage medium
CN113656391A (en) Data detection method and device, storage medium and electronic equipment
CN112416727A (en) Batch processing operation checking method, device, equipment and medium
CN113282504A (en) Incremental code coverage rate detection method and service development method and device
CN113626301A (en) Method and device for generating test script
CN115757077B (en) System clipping degree and service assembly minimization evaluation method

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