Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating an interface automation test case, which can automatically update the interface automation test case in time when an interface entry parameter changes.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided an interface automation test case generation method, including:
determining a target interface with changed interface codes in a code scanning mode;
determining an ingress change type of the target interface based on a JAVA reflection mechanism;
and updating the test case of the target interface according to the entry change type.
Optionally, the type of participation alteration includes at least one of: adding parameters, deleting parameters and changing parameters.
Optionally, determining a target interface with an interface code changed by means of code scanning includes:
scanning an interface within the range of an interface to be scanned to obtain a code of the interface at the current moment;
judging whether the code of the interface at the current moment is changed relative to the code of the interface at the previous moment;
and if so, determining the interface with the changed code as the target interface.
Optionally, the determining the type of the ingress change of the target interface based on the JAVA reflection mechanism includes:
traversing the business method name of the target interface in the code at the current moment:
acquiring each first input parameter in a code of the service method at the current moment;
judging whether the access parameter of the service method in the code at the last moment comprises the first input parameter; if so, acquiring a first parameter value of the first input parameter in the code at the current moment and a second parameter value of the first input parameter in the code at the last moment, judging whether the first parameter value and the second parameter value are the same, if so, determining that the first input parameter is not changed, and if not, determining that the parameter-entering change type of the first input parameter is a change parameter; otherwise, determining the parameter entering change type of the first input parameter as a newly added parameter;
acquiring each second input parameter in the code of the service method at the last moment, and judging whether the access parameter of the service method in the code at the current moment comprises the second input parameter; if not, determining that the parameter entering change type of the second input parameter is a deletion parameter.
Optionally, the method further comprises:
before judging whether the access parameters of the business method in the code at the last moment comprise the first input parameters, determining the access parameters with the first input parameters as basic types; if the first input parameter is not a reference of a basic type, splitting the first input parameter into a plurality of references of basic types;
before judging whether the access parameters of the business method in the code at the current moment comprise the second input parameters, determining the access parameters of which the second input parameters are basic types; if the second input parameter is not a reference of a basic type, splitting the second input parameter into a plurality of references of basic types.
Optionally, updating the test case of the target interface according to the type of the access change includes:
traversing each business method of the target interface, and updating the test case of the target interface aiming at each input parameter in the business method in the following modes:
when the parameter entering change type of the input parameter is a new parameter, adding the input parameter in each test case of the target interface, and/or adding the test case corresponding to the input parameter in the test case set of the target interface;
when the parameter entering change type of the input parameters is a deletion parameter, deleting the input parameters in each test case of the target interface;
and when the parameter entering change type of the input parameter is a change parameter, changing the numerical value of the input parameter in each test case of the target interface.
Optionally, when the type of the input parameter change is a delete parameter, after deleting the input parameter in each test case of the target interface, the method further includes:
judging whether the updated test case set has repeated test cases;
and if so, deleting the repeated test cases in the updated test case set.
An embodiment of the present invention further provides an interface automation test case generation apparatus, including:
the first determining module is used for determining a target interface with changed interface codes in a code scanning mode;
the second determination module is used for determining the type of the input parameter change of the target interface based on a JAVA reflection mechanism;
and the case updating module is used for updating the test case of the target interface according to the access parameter changing type.
An embodiment of the present invention further provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the interface automation test case generation method of the embodiment of the invention.
The embodiment of the invention also provides a computer readable medium, wherein a computer program is stored on the computer readable medium, and when the computer program is executed by a processor, the method for generating the interface automatic test case is realized.
One embodiment of the above invention has the following advantages or benefits: determining a target interface with changed codes in a code scanning mode, analyzing the codes of the target interface based on a JAVA reflection mechanism, determining the entry change type of the target interface, and updating the test case of the target interface according to the entry change type. The embodiment of the invention can automatically update the test case of the interface in time when the interface input parameters are changed so as to ensure the correctness of the interface test.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
At present, interface automation is realized and maintained by using technical means such as Test ng (Test Next Generation, open source automation testing framework), Jenkins (a continuous integration tool developed based on Java) and the like. When the input parameters of the interface change, the automatic interface test case cannot be automatically updated in time to verify the correctness of the interface, so that an automatic interface test case generation method is needed, so that the automatic interface test case can be automatically updated in time when the input parameters of the interface change.
Fig. 1 is a method for generating an interface automation test case according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S101: and determining a target interface with a changed interface code by a code scanning mode.
In the embodiment of the present invention, the code scanning may be performed by scanning the code of the interface within a preset time interval, that is, scanning the interface code periodically, so as to determine the target interface with the changed interface code.
In an alternative embodiment, as shown in fig. 2, step S101 includes the following steps:
step S201: scanning an interface within the range of an interface to be scanned to acquire a code of the interface at the current moment;
step S202: judging whether the code of the interface at the current moment is changed relative to the code of the interface at the previous moment, if so, executing step S203, otherwise, executing step S204;
step S203: determining an interface with changed codes as a target interface;
step S204: it is determined that there is no interface for which a code change has occurred.
In the embodiment of the invention, the target interface is determined through the change of the interface code at the current moment and the previous moment, wherein the time interval between the current moment and the previous moment can be preset, and the time interval can be the interval for scanning the interface code at regular time, for example, the preset time interval can be 1 millisecond, 1 second, 10 seconds and the like, so that the interface automatic test case can be updated in time, and the test case can be verified in time and feed back problems.
In the embodiment of the invention, the range of the interface to be scanned can be an interface in the automatic interface test range, and can also be an interface of a custom scanning rule in the automatic interface test range. When an interface within the range of the interface to be scanned is scanned, a file (such as a class file) corresponding to the interface can be scanned, so that the code of the interface at the current moment can be acquired. And then comparing the code of the interface at the current moment with the code at the previous moment, if the codes are different, determining the code of the interface to be changed as a target interface, updating the automatic test case of the interface to ensure the correctness of the test of the target interface, and if the codes are the same, determining that the interface with the changed codes does not exist, and not updating the automatic test case of the interface.
In an optional implementation manner, when scanning an interface code within a range of an interface to be scanned, the scanned code of the interface is stored, the code of the interface and the scanning time may be correspondingly stored according to an identifier of the interface, and the codes at two adjacent moments at the current moment and the previous moment are compared, so that whether the code of the interface changes can be determined, to determine whether the interface is a target interface, if so, a test case of the target interface is updated, the stored code of the target interface at the previous moment is deleted, and only the code at the current moment after the test case is updated is stored.
After the target interface with the changed code is determined, in order to verify the correctness of the target interface by automatically updating the test case of the target interface, the change of the input parameter corresponding to the code change needs to be determined.
Step S102: and determining the type of the participating change of the target interface based on a JAVA reflection mechanism.
In an embodiment of the present invention, the type of the participating change includes at least one of: adding parameters, deleting parameters and changing parameters.
In an alternative embodiment, as shown in fig. 3, step S102 includes the following steps:
step S301: traversing the business method name of the target interface in the code at the current moment;
step S302: acquiring each first input parameter of a code of a service method at the current moment;
step S303: judging whether the access parameters of the business method in the code at the last moment comprise first input parameters or not; if not, go to step S304, if yes, go to step S305;
step S304: determining the parameter entering change type of the first input parameter as a newly added parameter;
step S305: acquiring a first parameter value of a first input parameter in a code at the current moment and a second parameter value in the code at the last moment;
step S306: judging whether the first parameter value and the second parameter value are the same, if so, executing step S307, otherwise, executing step S308;
step S307: determining that the parameter entering change type of the first input parameter is not a change parameter;
step S308: and determining the parameter-entering change type of the first input parameter as a change parameter.
In an optional implementation manner, before step S303, the method includes:
determining a first input parameter as a basic type of input parameter; if the first input parameter is not a reference of a base type, splitting the first input parameter into a plurality of references of base types. The input parameter of the basic type may be a parameter having one value, the input parameter of the non-basic type may be a parameter having a plurality of values, and the basic type is, for example, a data type of java. Non-base types such as data types java.lang.object, java.util.list < java.lang.integer >, java.util.list < java.lang.string >, etc.
In the embodiment of the present invention, when determining the entry change type of the target interface, it is necessary to traverse the business method name in the code of the target interface at the current time, such as an acquisition menu (getMenu), and according to the business method name, acquire each first input parameter of the code of the business method at the current time, and when determining the basic type of the first input parameter, perform the determination again, and if the first input parameter is not the basic type, it is necessary to split the first input parameter into the entries of multiple basic types, and perform the determination again. When the judgment is made, judging whether the entry parameter of the service method in the code at the previous moment comprises a first input parameter, setting the first input parameter of the service method named getMenu at the current moment as A, B and C, if the entry parameter of the service method named getMenu at the previous moment comprises A and B, judging that the entry parameter change type of the input parameter C is a new parameter if the entry parameter of the service method at the previous moment does not comprise C, and if the entry parameter of the service method named getMenu at the previous moment comprises A, B, C and D, namely the entry parameter of the service method named getMenu at the previous moment comprises the entry parameter A, B and C at the current moment, further acquiring a first parameter value and a second parameter value corresponding to the first input parameter A, B and C at the current moment and the previous moment respectively, if the first parameter values corresponding to the entry parameter A, B and C at the current moment are 9, 10 and 11 respectively, and if the second parameter values corresponding to the previous-time entry references A, B and C are the same as the first parameter values, determining that the entry-reference change type of the first input parameter is not a changed parameter, and if the second parameter values corresponding to the previous-time entry references A, B and C are 9, 12 and 11 and are different from the first parameter values, determining that the entry-reference change type of the first input parameter is a changed parameter.
In an alternative embodiment, as shown in fig. 4, step S102 further includes the following steps:
step S401: acquiring each second input parameter in the code of the service method at the last moment;
step S402: judging whether the access parameters of the business method in the code at the current moment comprise second input parameters; if not, executing step S403, if yes, executing step S404;
step S403: determining the parameter entering change type of the second input parameter as a deletion parameter;
step S404: and determining that the type of the participation change of the second input parameter is not a deletion parameter.
In the embodiment of the present invention, before step S402, the following steps are further included:
determining the second input parameter as the input parameter of the basic type; if the second input parameter is not a reference of the base type, splitting the second input parameter into a plurality of references of the base types.
After traversing the business method name of the target interface in the code at the current moment, acquiring each second input parameter of the code at the last moment of the business method, before judging the type of the change of the input parameters of the second input parameters, confirming whether each second input parameter is a basic type, and if the second input parameter is not the basic type, splitting the second input parameter into a plurality of basic types and then judging. If the second input parameters of the code of the getMenu business method at the previous moment are A, B, C and D, if the access parameters of the getMenu business method at the current moment are A, B and C, and no access parameter D is included, determining that the access parameter change type of the second input parameters is a deletion parameter, namely deleting the access parameter D from the access parameters of the business method at the current moment, and if the access parameters of the getMenu business method at the current moment are A, B, C, D and E, determining that the access parameter change type of the second input parameters is not the deletion parameter.
When the parameter entering change type of the target interface is judged based on a JAVA reflection mechanism algorithm, whether the parameter entering change type of the first input parameter is a new parameter or a changed parameter can be judged according to each first input parameter in the code at the current moment and the parameter entering comparison at the previous moment, whether the parameter entering change type of the second input parameter is a deleted parameter can be judged according to each second input parameter in the code at the previous moment and the parameter entering comparison at the current moment, and the judgment process is executed aiming at each first input parameter and each second input parameter when the judgment is carried out, so that the parameter entering change type of the target interface can be accurately determined.
Step S103: and updating the test case of the target interface according to the access parameter change type.
In an alternative embodiment, step S103 includes:
traversing each service method of the target interface, and updating the test case of the target interface by the following modes aiming at each input parameter in the service method:
when the parameter entering change type of the input parameters is a new parameter, adding the input parameters in each test case of the target interface, and/or adding the test cases corresponding to the input parameters in the test case set of the target interface;
when the parameter entering change type of the input parameter is a deletion parameter, deleting the input parameter in each test case of the target interface;
and when the parameter input change type of the input parameter is a change parameter, changing the numerical value of the input parameter in each test case of the target interface.
In the embodiment of the invention, the test case of the target interface is updated according to different parameter-entering change types of the input parameters, if the parameter-entering change type is a newly added parameter, the test case is updated according to the type of the newly added parameter, if the newly added parameter is a basic type, the input parameters can be added in the test case, default values of the input parameters are given, and corresponding test cases can also be added at the same time; and if the newly added parameters are not the basic type, adding the input parameters and the test cases in the test case set according to the service logic. If the type of the change of the input parameters is deleting parameters, deleting the input parameters in the test cases, and simultaneously deleting the test cases corresponding to the input parameters; and if the type of the input parameter change is a change parameter, changing the test case according to the value of the input parameter.
For example, after a target interface with a changed code is determined, a JAVA reflection mechanism algorithm is adopted to analyze an entry change type of the target interface to obtain a newly added parameter a and a parameter B, and as shown in table 1, the parameter a and the parameter B are judged to determine that the parameter a is a basic type and the parameter B is a non-basic type, so that the parameter a is automatically added to the automatic test case set of the target interface and a default value of the parameter a is given (for example, the type of the parameter a is String, and the default value is given as null); and performing business logic analysis based on the parameter B, automatically adding the parameter B to the target interface automation test case, and adding a corresponding test case. The business method is named as getMenu business method, parameters A and B are newly added parameters, the parameter A (childrens!) is added in each test case to be a basic type String and is assigned to be a null ("), the parameter B is not a basic type, the numerical values of B are respectively 9, 10 and 11 and can be split into three basic types, and three test cases are added in the test case set according to business logic, so that three test cases are added in the test case set of the business method getMenu, each test case comprises the parameter A and the parameter B, and the updated test case set is obtained, and is shown in Table 1.
TABLE 1
In an optional implementation manner, when the type of the parameter change of the input parameter is a delete parameter, after deleting the input parameter in each test case of the target interface, the method further includes:
judging whether the updated test case set has repeated test cases;
and if so, deleting the repeated test cases in the updated test case set.
In the test case set, after deleting one or more input parameters, there may be one or more duplicate test cases, in which case the duplicate test cases need to be deleted. For example, in the test case set of the target interface, there are a parameter a, a parameter B, and a parameter C, if only the value of the parameter C is different in the two test cases, and the other contents are the same, that is, in one of the test cases, the values corresponding to the parameter a, the parameter B, and the parameter C are 9, 10, and 11, respectively, and in the other test case, the values corresponding to the parameter a, the parameter B, and the parameter C are 9, 10, and 12, respectively, when the parameter-in change type of the parameter C is a delete parameter, after deleting the parameter C in the two test cases, the two test cases are the same, and therefore, the same test case needs to be removed to be duplicated to improve the accuracy and efficiency of the test.
In an implementation manner of the embodiment of the present invention, in step S101, when a target interface with changed interface codes is determined by a code scanning manner, a first number of the target interfaces is determined, after a test case of updating the target interface in step S103 is executed, a second number of the target interfaces of the updated test case is obtained, whether the second number is smaller than the first number is determined, if the second number is smaller than the first number, the step S101 is returned to re-determine the first number of the target interfaces, and steps S102 and S103 are continuously executed until the second number is equal to the first number, so that it is determined that all the test cases of the target interfaces are updated, and correctness of the interface test is ensured. For example, when step S101 is executed, the first number of target interfaces is 10, and when step S103 is executed, the second number of target interfaces of the updated test case is 8, and the second number is smaller than the first number, the process returns to re-determine that the first number of target interfaces is 2, and steps S102 and S103 are continuously executed.
The method for generating the interface automatic test case provided by the embodiment of the invention determines a target interface with a changed code in a code scanning mode, analyzes the code of the target interface based on a JAVA reflection mechanism, analyzes and judges each input parameter in the business methods in the code at the current time and the last time by traversing the business methods of the target interface so as to determine the access change type of the target interface, and automatically updates the test case of the target interface according to the access change type. The method can automatically update the test case of the interface in time in a data driving mode when the interface input parameters are changed so as to ensure the correctness of the interface test. The embodiment of the invention reduces the time for manually maintaining the test case, reduces the risk of the online problem caused by incomplete coverage of the manual maintenance test case, improves the generation efficiency of the interface automatic test case, and further improves the test efficiency of the interface.
According to another aspect of the embodiments of the present invention, as shown in fig. 5, there is provided an interface automation test case generation apparatus 500, including:
a first determining module 501, which determines a target interface with a changed interface code in a code scanning manner;
a second determining module 502, configured to determine an ingress change type of the target interface based on a JAVA reflection mechanism;
and the use case updating module 503 updates the test use case of the target interface according to the access parameter changing type.
In this embodiment of the present invention, the first determining module 501 is further configured to: scanning an interface within the range of an interface to be scanned to obtain a code of the interface at the current moment; judging whether the code of the interface at the current moment is changed relative to the code of the interface at the previous moment; and if so, determining the interface with the changed code as the target interface.
In this embodiment of the present invention, the second determining module 502 is further configured to:
traversing the business method name of the target interface in the code at the current moment;
acquiring each first input parameter of a code of a service method at the current moment; judging whether the access parameters of the business method in the code at the last moment comprise first input parameters or not; if so, acquiring a first parameter value of the first input parameter in the code at the current moment and a second parameter value in the code at the last moment, judging whether the first parameter value and the second parameter value are the same, if so, determining that the first input parameter is not changed, and if not, determining that the parameter-entering change type of the first input parameter is a change parameter; otherwise, determining the parameter entering change type of the first input parameter as a newly added parameter;
acquiring each second input parameter in the code of the service method at the last moment, and judging whether the access parameter of the service method in the code at the current moment comprises the second input parameter; if not, determining that the parameter entering change type of the second input parameter is a deletion parameter.
In this embodiment of the present invention, the second determining module 502 is further configured to: before judging whether the access parameters of the business method in the code at the last moment comprise first input parameters, determining the access parameters with the first input parameters as basic types; if the first input parameter is not the entry of the basic type, splitting the first input parameter into a plurality of entries of the basic types;
before judging whether the access parameters of the business method in the code at the current moment comprise the second input parameters, determining the access parameters with the second input parameters as basic types; if the second input parameter is not a reference of the base type, splitting the second input parameter into a plurality of references of the base types.
In this embodiment of the present invention, the use case updating module 503 is further configured to: traversing each service method of the target interface, and updating the test case of the target interface by the following modes aiming at each input parameter in the service method:
when the parameter-entering change type of the input parameters is a new parameter, adding the input parameters in each test case of the target interface, and/or adding the test cases corresponding to the input parameters in the test case set of the target interface;
when the parameter entering change type of the input parameters is a deletion parameter, deleting the input parameters in each test case of the target interface;
and when the parameter input change type of the input parameter is a change parameter, changing the numerical value of the input parameter in each test case of the target interface.
In this embodiment of the present invention, the use case updating module 503 is further configured to: when the type of the input parameter change is a delete parameter, after deleting the input parameter in each test case of the target interface, the method further comprises:
judging whether the updated test case set has repeated test cases;
and if so, deleting the repeated test cases in the updated test case set.
The interface automatic test case generation device provided by the embodiment of the invention can automatically update the test case corresponding to the interface in time when the interface input parameters change, does not need manual maintenance, and avoids the on-line risk of incomplete coverage caused by manual maintenance of the test case.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus including: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by one or more processors, the one or more processors realize the interface automation test case generation method of the embodiment of the invention.
To achieve the above object, according to a further aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method for generating interface automation test cases according to the embodiments of the present invention.
Fig. 6 illustrates an exemplary system architecture 600 of an interface automated test case generation method or an interface automated test case generation apparatus to which an embodiment of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as a software testing-type application, a web browser application, a search-type application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a test server (for example only) providing support for software test class applications operated by users with the terminal devices 601, 602, 603. The test server may analyze and perform other processing on the received data such as the request for updating the test case, and feed back a processing result (for example, the updated test case — just an example) to the terminal device.
It should be noted that the interface automation test case generation method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the interface automation test case generation apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 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. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer 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 of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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. In the present invention, a computer 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. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer 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 computer readable signal medium may also be any computer readable medium that is not a computer 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 computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a first determination module, a second determination module, and a use case update module. The names of these modules do not in some cases form a limitation on the modules themselves, and for example, the first determination module may also be described as a "module that determines a target interface with a changed interface code by means of code scanning".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: determining a target interface with changed interface codes in a code scanning mode; determining an input parameter change type of a target interface based on a JAVA reflection mechanism; and updating the test case of the target interface according to the access parameter change type.
According to the technical scheme of the embodiment of the invention, the target interface with the changed code is determined in a code scanning mode, the code of the target interface is analyzed based on a JAVA reflection mechanism, the entry-entry change type of the target interface is determined, and the test case of the target interface is updated according to the entry-entry change type. The embodiment of the invention can automatically update the test case of the interface in time when the interface access parameter changes so as to ensure the correctness of the interface test. The embodiment of the invention can reduce the risk of incomplete coverage of the manual maintenance test case, improve the generation efficiency of the interface automatic test case and further improve the test efficiency of the interface.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.