CN116594876A - Interface testing method, device, equipment and storage medium - Google Patents

Interface testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN116594876A
CN116594876A CN202310522175.8A CN202310522175A CN116594876A CN 116594876 A CN116594876 A CN 116594876A CN 202310522175 A CN202310522175 A CN 202310522175A CN 116594876 A CN116594876 A CN 116594876A
Authority
CN
China
Prior art keywords
test script
interface
target
field
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310522175.8A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310522175.8A priority Critical patent/CN116594876A/en
Publication of CN116594876A publication Critical patent/CN116594876A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure provides an interface testing method, device, equipment and storage medium, which can be applied to the technical field of software testing and the technical field of finance. The method comprises the following steps: the method comprises the steps of obtaining a code change operation log of an application program, wherein the code change operation log comprises a first source code before version change of the application program and a second source code after version change of the application program. The code change field is obtained by scanning the first source code and the second source code. And according to the code change field, obtaining an initial test script of the target interface by querying the interface test script library. And changing the initial test script according to the code change field to obtain the target test script. And executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.

Description

Interface testing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of software testing technology and the field of financial technology, and in particular, to an interface testing method, apparatus, device, medium, and program product.
Background
With the continuous rise of the complexity of software systems, the quality and progress of projects are difficult to ensure by traditional functional tests. Testing the full code typically results in unnecessary code modifications and testing as the program version changes. And when the interface code is changed, the test script is required to be rewritten to execute the interface test, so that the efficiency is low.
Disclosure of Invention
In view of the foregoing, the present disclosure provides an interface testing method, apparatus, device, medium, and program product.
According to a first aspect of the present disclosure, there is provided an interface testing method, including:
the method comprises the steps of obtaining a code change operation log of an application program, wherein the code change operation log comprises a first source code before version change of the application program and a second source code after version change of the application program. The code change field is obtained by scanning the first source code and the second source code. And according to the code change field, obtaining an initial test script of the target interface by querying the interface test script library. And changing the initial test script according to the code change field to obtain the target test script. And executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.
According to an embodiment of the present disclosure, according to a code change field, a change is made to an initial test script to obtain a target test script, including:
and determining the change position in the initial test script according to the field type of the code change field. And extracting a field to be changed from the initial test script according to the change position. And executing changing operation on the initial test script according to the code changing field and the field to be changed to obtain the target test script.
According to an embodiment of the present disclosure, according to a code change field and a field to be changed, a change operation is performed on an initial test script to obtain a target test script, including:
and under the condition that the field to be changed is empty, inserting a code change field in the position of the field to be changed to obtain the target test script. And under the condition that the field to be changed is not null, changing the field to be changed into the code change field to obtain the target test script.
According to an embodiment of the present disclosure, the above method further includes:
under the condition that the field type of the code change field is determined to be the interface name, interface name change information is determined; and sending interface name change information to the target object.
According to an embodiment of the present disclosure, according to a code change field, an initial test script of a target interface is obtained by querying an interface test script library, including:
determining a target interface by querying an interface test script library according to the code change field; and obtaining an initial test script by querying the interface test script library according to the target interface.
According to an embodiment of the present disclosure, according to a target test script, a test operation is performed on a target interface to obtain a test result for the target interface, including:
And according to the target interface, obtaining the target application module by inquiring the association relation between the application module and the interface. And deploying the target test script on the target application module. And obtaining a test result by running the target test script.
According to an embodiment of the present disclosure, the target interface includes a plurality of, further including:
and according to the target interface, obtaining the association relation between the target interface and the target test script by inquiring the interface test script library. And generating a test script operation list according to the target interface, the association relation and the target test script.
A second aspect of the present disclosure provides an interface test apparatus, comprising: the device comprises an acquisition module, a scanning module, a query module, a change module and a test module. The acquisition module is used for acquiring a code change operation log of the application program, wherein the code change operation log comprises a first source code before the version of the application program is changed and a second source code after the version of the application program is changed. And the scanning module is used for obtaining a code change field by scanning the first source code and the second source code. And the query module is used for obtaining the initial test script of the target interface by querying the interface test script library according to the code change field. And the change module is used for changing the initial test script according to the code change field to obtain the target test script. And the test module is used for executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.
According to an embodiment of the present disclosure, the modification module includes a first determination unit, an extraction unit, and a modification unit. The first determining unit is used for determining the change position in the initial test script according to the field type of the code change field. And the extraction unit is used for extracting the field to be changed from the initial test script according to the change position. And the changing unit is used for executing changing operation on the initial test script according to the code changing field and the field to be changed to obtain the target test script.
According to an embodiment of the present disclosure, the change unit includes an insert subunit and a change subunit. And the inserting subunit is used for inserting the code change field in the position of the field to be changed under the condition that the field to be changed is empty, so as to obtain the target test script. And the change subunit is used for changing the field to be changed into the code change field under the condition that the field to be changed is not empty, so as to obtain the target test script.
According to an embodiment of the disclosure, the modification module further comprises a second determination unit and a transmission unit. And the second determining unit is used for determining the interface name change information under the condition that the field type of the code change field is determined to be the interface name. And the sending unit is used for sending the interface name change information to the target object.
According to an embodiment of the present disclosure, the query module includes a first query unit and a second query unit. The first query unit is used for determining the target interface by querying the interface test script library according to the code change field. And the second query unit is used for obtaining an initial test script by querying the interface test script library according to the target interface.
According to an embodiment of the present disclosure, the test module includes a third query unit, a deployment unit, and an execution unit. And the third query unit is used for obtaining the target application module by querying the association relation between the application module and the interface according to the target interface. And the deployment unit is used for deploying the target test script on the target application module. And the operation unit is used for obtaining a test result by operating the target test script.
According to an embodiment of the disclosure, the test module further comprises a fourth query module and a generation unit. And the fourth query module is used for obtaining the association relation between the target interface and the target test script by querying the interface test script library according to the target interface. And the generating unit is used for generating a test script operation list according to the target interface, the association relation and the target test script.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above method.
According to the interface testing method, the device, the equipment, the medium and the program product, the code change operation log of the application program is obtained, and the code change operation log comprises a first source code before the version change of the application program and a second source code after the version change of the application program. And scanning the first source code and the second source code to obtain a code change field. And then according to the code change field, obtaining an initial test script of the target interface by querying the interface test script library. And changing the initial test script according to the code change field to obtain the target test script. And finally, executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface. Testing an interface corresponding to a code changed during program version upgrading; and according to the code change field, carrying out self-adaptive corresponding change on the test script of the interface, and automatically generating the test script which can be used for testing the upgraded interface. Therefore, the problem of low testing efficiency caused by unnecessary code modification and testing is at least partially solved, the accurate interface testing is realized, and the efficiency is improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of an interface testing method, apparatus, device, medium and program product according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow chart of making changes to an initial test script in accordance with an embodiment of the present disclosure;
FIG. 4 schematically illustrates a logic diagram of an interface testing method according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a block diagram of an interface testing apparatus according to an embodiment of the present disclosure; and
fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement an interface testing method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the technical scheme of the disclosure, the related data (such as including but not limited to personal information of a user) are collected, stored, used, processed, transmitted, provided, disclosed, applied and the like, all conform to the regulations of related laws and regulations, necessary security measures are adopted, and the public welcome is not violated.
Generally, when a program version is changed, the related functional testing technology is to test the whole code, so that unnecessary code modification and testing can be generated. And when the interface code is changed, the test script is required to be rewritten to execute the interface test, so that the efficiency is low.
In view of this, an embodiment of the present disclosure provides an interface testing method, including: the method comprises the steps of obtaining a code change operation log of an application program, wherein the code change operation log comprises a first source code before version change of the application program and a second source code after version change of the application program. The code change field is obtained by scanning the first source code and the second source code. And according to the code change field, obtaining an initial test script of the target interface by querying the interface test script library. And changing the initial test script according to the code change field to obtain the target test script. And executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.
Fig. 1 schematically illustrates an application scenario diagram of an interface testing method according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is a medium used to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 through the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages, etc. Various communication client applications, such as a shopping class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that, the method for testing an interface provided by the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, an interface testing apparatus provided by embodiments of the present disclosure may be generally disposed in the server 105. An interface testing method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, an interface testing apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
An interface test method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 4 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flow chart of an interface testing method according to an embodiment of the disclosure.
As shown in fig. 2, an interface test of this embodiment includes operations S210 to S250.
In operation S210, a code change operation log of the application program is acquired.
In operation S220, a code change field is obtained by scanning the first source code and the second source code.
In operation S230, according to the code change field, an initial test script of the target interface is obtained by querying the interface test script library.
In operation S240, the initial test script is changed according to the code change field, and the target test script is obtained.
In operation S250, according to the target test script, a test operation is performed on the target interface, and a test result for the target interface is obtained.
According to an embodiment of the present disclosure, a first source code before a version change of an application program and a second source code after the version change of the application program are included in a code change operation log. For example: and obtaining a code change operation log by monitoring the code submission condition. The code change operation log may be obtained from a code operation tool, which may be a version control system such as SVN, git, etc.
According to embodiments of the present disclosure, the first source code may refer to the last code and the second source code may refer to the code that changed the last code. For example: and scanning the first source code and the second source code through Tscan code, and obtaining a code change occurrence field through comparison among codes. Where TscanCode is a static code scanning tool, the scanning tool is not limited to this.
According to the embodiment of the disclosure, corresponding correspondence exists among the application, the module, the interface, the source code and the interface test script, and the information is stored. According to the corresponding relation among the interface, the source code and the interface test script, according to the code change field, the initial test script of the target interface corresponding to the code change field can be obtained by inquiring the interface test script library.
According to the embodiment of the disclosure, the initial test script is changed according to the code change field, so that a target test script corresponding to the second source code is obtained. For example: and according to the code change field, changing the initial test script by using an automatic test platform of Java+HttpClient+TestNG to obtain a target test script corresponding to the second source code. Wherein Java is a computer language. Httpcharge is a client programming toolkit that can be used to provide an efficient, up-to-date, functional rich support for the HTTP protocol, and it supports up-to-date versions and suggestions of the HTTP protocol. TestNG, testing Next Generation (next generation testing technology) can be used for unit testing as well as for integrated testing. The automatic test platform can also be HttpClient+TestNG+Jenkins, wherein Jenkins is a continuous integration tool and is mainly used for continuously and automatically constructing/testing software items and monitoring the operation of external tasks. The automated test platform is not limited thereto.
According to the embodiment of the disclosure, according to the target test script, an automatic test platform is applied to execute test operation on the target interface, so as to obtain a test result aiming at the target interface.
According to an embodiment of the present disclosure, by acquiring a code change operation log of an application program, the code change operation log includes a first source code before a version change of the application program and a second source code after the version change of the application program. And scanning the first source code and the second source code to obtain a code change field. And then according to the code change field, obtaining an initial test script of the target interface by querying the interface test script library. And changing the initial test script according to the code change field to obtain the target test script. And finally, executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface. Testing an interface corresponding to a code changed during program version upgrading; and according to the code change field, carrying out self-adaptive corresponding change on the test script of the interface, and automatically generating the test script which can be used for testing the upgraded interface. Therefore, the method at least partially solves the problems of unnecessary code modification and test, realizes accurate interface test and improves the efficiency.
FIG. 3 schematically illustrates a flow chart of making changes to an initial test script in accordance with an embodiment of the present disclosure.
As shown in fig. 3, an interface test of this embodiment includes operations S310 to S330.
In operation S310, a change location in the initial test script is determined according to a field type of the code change field.
In operation S320, a field to be changed is extracted from the initial test script according to the change position.
In operation S330, a change operation is performed on the initial test script according to the code change field and the field to be changed, thereby obtaining a target test script.
According to the embodiment of the disclosure, due to the corresponding correspondence among the interface, the source code and the interface test script, the change position in the initial test script can be determined according to the field type of the code change field. For example: the field type of the code change field is a closed (closed indicates that the object () method can legally copy a certain instance according to the field), and the initial test script corresponding to the type can be found according to the field type closed to determine the position of the change. The field type may also be String, font, cacheResponse (channel to acquire resources from ResponseCache), etc.
According to the embodiment of the disclosure, according to the change position, a field corresponding to the code change field in the initial test script is extracted, that is, the extracted field is the field to be changed.
According to the embodiment of the disclosure, according to the code change field and the field to be changed, a change operation is executed on the initial test script at the automatic test platform to obtain the target test script.
According to the embodiment of the disclosure, according to the corresponding correspondence among the interface, the source code and the interface test script, the change position in the initial test script can be determined according to the field type of the code change field. And then, the change operation can be executed on the field to be changed in the initial test script through the change position, so that the accurate change of the interface test script is realized, and the test efficiency can be improved.
According to an embodiment of the present disclosure, according to a code change field and a field to be changed, a change operation is performed on an initial test script to obtain a target test script, including:
and under the condition that the field to be changed is empty, inserting a code change field in the position of the field to be changed to obtain the target test script. And under the condition that the field to be changed is not null, changing the field to be changed into the code change field to obtain the target test script.
According to the embodiment of the disclosure, when a field to be changed of an original test script is empty, a code change field is inserted into a position of the field to be changed, and a target test script is obtained. Wherein the field to be changed is null refers to a code field without such field type in the original test script.
According to the embodiment of the disclosure, when a field to be changed of an original test script is not empty, the field to be changed is updated to a code change field, and a target test script is obtained. Where the field to be altered is not null refers to a code field in the original test script that has such a field type.
According to the embodiment of the disclosure, the code changing operation is executed according to the conditions, so that unnecessary code analysis and modification can be reduced, and the changing efficiency is improved.
According to an embodiment of the present disclosure, the above method further includes:
under the condition that the field type of the code change field is determined to be the interface name, interface name change information is determined; and sending interface name change information to the target object.
According to embodiments of the present disclosure, an interface name of a field type of a code change field may be determined according to a correspondence between the interface and the code change field. Therefore, in the case that the field type of the code change field is determined to be the interface name, change information of the interface name can be transmitted to the target object. Wherein the target object may be a maintainer or a related person of the code change field. The transmission mode may be automatic transmission by the mail service system.
According to the embodiment of the disclosure, the interface name change information can be accurately determined according to the corresponding relation between the interface and the code change field, so that the information accuracy is improved.
According to an embodiment of the present disclosure, according to a code change field, an initial test script of a target interface is obtained by querying an interface test script library, including:
determining a target interface by querying an interface test script library according to the code change field; and obtaining an initial test script by querying the interface test script library according to the target interface.
According to the embodiment of the disclosure, according to the corresponding relation among the code change field, the interface test script and the interface, the interface corresponding to the code change field, namely the target interface, can be determined by inquiring the interface test script library corresponding to the code change field according to the code change field.
According to the embodiment of the disclosure, according to the target interface, the interface test script library is queried, and an initial test script of the target interface can be obtained.
According to the embodiment of the disclosure, the corresponding target interface and the initial test script library can be quickly queried from the interface test script library according to the corresponding relation among the code change field, the interface test script and the interface, so that the speed of functional test is increased.
According to an embodiment of the present disclosure, according to a target test script, a test operation is performed on a target interface to obtain a test result for the target interface, including:
and according to the target interface, obtaining the target application module by inquiring the association relation between the application module and the interface. And deploying the target test script on the target application module. And obtaining a test result by running the target test script.
According to the embodiment of the disclosure, the target application module is obtained by querying the application module corresponding to the target interface. For example: the target interface is an AudioClip interface (an audio clip, which can be used for playing a simple abstract of the audio clip), and the application module corresponding to the target interface is a tune application module, i.e. the target application module of the AudioClip interface is a tune application module.
According to an embodiment of the present disclosure, a target test script is deployed to a target application module. For example: the target interface is an AudioClip interface, and then the corresponding application module is a tuning application module. And changing the original test script to obtain a target test script, and deploying the target test script of the AudioClip interface to the sound modulation application module.
According to the embodiment of the disclosure, due to the association relation between the application module and the interface, the target test script can be deployed to the corresponding target application module, so that sustainable integrated test of the application module is sunk to the interface layer, accurate interface test is realized, and efficiency is improved.
According to an embodiment of the present disclosure, the target interface includes a plurality of, further including:
and according to the target interface, obtaining the association relation between the target interface and the target test script by inquiring the interface test script library. And generating a test script operation list according to the target interface, the association relation and the target test script.
According to an embodiment of the present disclosure, a plurality of field types may be included in the code change field, and a target interface corresponding thereto may include a plurality of field types.
According to the embodiment of the disclosure, according to the corresponding relation between the interface and the interface test script, according to the target interface, the association relation between the target interface and the target test script is obtained by inquiring the interface test script library. Wherein the association relationship may be a nested relationship, a calling relationship, etc.
According to the embodiment of the disclosure, a test script running list is formed by the target interface, the target test script and the corresponding association relation. For example: the target interface A and the target interface B have a calling relationship, and the target test script A and the target test script B can be operated together. The target test script corresponding to the target interface A is the target test script A, and the target test script corresponding to the target interface B is the target test script B.
According to the embodiment of the disclosure, the test script running list is generated according to the corresponding relation between the interfaces and the interface test scripts, so that ordered test is realized, the test integrity is enhanced, and the test efficiency is improved.
Fig. 4 schematically illustrates a logic diagram of an interface testing method according to an embodiment of the present disclosure.
As shown in FIG. 4, this embodiment 400 includes operations S401-S410
In operation S401, a code change operation log of an application program is acquired.
In operation S402, a code change field is obtained by scanning the first source code and the second source code.
In operation S403, according to the code change field, the initial test script of the target interface is obtained by querying the interface test script library.
In operation S404, a change location in the initial test script is determined according to a field type of the code change field.
In operation S405, a field to be changed is extracted from the initial test script according to the change position.
In operation S406, it is determined whether the field to be changed is empty.
In operation S407, a code change field is inserted at the position of the field to be changed.
In operation S408, the field to be changed is changed to a code change field.
In operation S409, a target test script is obtained.
In operation S410, according to the target test script, a test operation is performed on the target interface, and a test result for the target interface is obtained.
Based on the above-mentioned interface test method, the present disclosure also provides an interface test device. The device will be described in detail below in connection with fig. 5.
Fig. 5 schematically illustrates a block diagram of an interface testing apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, an interface testing apparatus 500 of this embodiment includes an acquisition module 510, a scanning module 520, a query module 530, a modification module 540, and a testing module 550.
The obtaining module 510 is configured to obtain a code change operation log of an application program. In an embodiment, the obtaining module 510 may be configured to perform the operation S210 described above, which is not described herein.
The scanning module 520 is configured to obtain the code change field by scanning the first source code and the second source code. In an embodiment, the scanning module 520 may be configured to perform the operation S220 described above, which is not described herein.
The query module 530 is configured to obtain an initial test script of the target interface by querying the interface test script library according to the code change field. In an embodiment, the query module 530 may be configured to perform the operation S230 described above, which is not described herein.
The changing module 540 is configured to change the initial test script according to the code change field, so as to obtain the target test script. In an embodiment, the modification module 540 may be configured to perform the operation S240 described above, which is not described herein.
The test module 550 is configured to execute a test operation on the target interface according to the target test script, so as to obtain a test result for the target interface. In an embodiment, the test module 550 may be configured to perform the operation S250 described above, which is not described herein.
According to an embodiment of the present disclosure, the modification module includes a first determination unit, an extraction unit, and a modification unit. The first determining unit is used for determining the change position in the initial test script according to the field type of the code change field. And the extraction unit is used for extracting the field to be changed from the initial test script according to the change position. And the changing unit is used for executing changing operation on the initial test script according to the code changing field and the field to be changed to obtain the target test script.
According to an embodiment of the present disclosure, the change unit includes an insert subunit and a change subunit. And the inserting subunit is used for inserting the code change field in the position of the field to be changed under the condition that the field to be changed is empty, so as to obtain the target test script. And the change subunit is used for changing the field to be changed into the code change field under the condition that the field to be changed is not empty, so as to obtain the target test script.
According to an embodiment of the disclosure, the modification module further comprises a second determination unit and a transmission unit. And the second determining unit is used for determining the interface name change information under the condition that the field type of the code change field is determined to be the interface name. And the sending unit is used for sending the interface name change information to the target object.
According to an embodiment of the present disclosure, the query module includes a first query unit and a second query unit. The first query unit is used for determining the target interface by querying the interface test script library according to the code change field. And the second query unit is used for obtaining an initial test script by querying the interface test script library according to the target interface.
According to an embodiment of the present disclosure, the test module includes a third query unit, a deployment unit, and an execution unit. And the third query unit is used for obtaining the target application module by querying the association relation between the application module and the interface according to the target interface. And the deployment unit is used for deploying the target test script on the target application module. And the operation unit is used for obtaining a test result by operating the target test script.
According to an embodiment of the disclosure, the test module further comprises a fourth query module and a generation unit. And the fourth query module is used for obtaining the association relation between the target interface and the target test script by querying the interface test script library according to the target interface. And the generating unit is used for generating a test script operation list according to the target interface, the association relation and the target test script.
Any of the acquisition module 510, the scanning module 520, the query module 530, the alteration module 540, and the test module 550 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules, according to embodiments of the present disclosure. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module. According to embodiments of the present disclosure, at least one of the acquisition module 510, the scanning module 520, the query module 530, the alteration module 540, and the test module 550 may be implemented, at least in part, as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, at least one of the acquisition module 510, the scanning module 520, the query module 530, the altering module 540, and the testing module 550 may be at least partially implemented as a computer program module that, when executed, performs the corresponding functions.
Fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement an interface testing method according to an embodiment of the disclosure.
As shown in fig. 6, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. The processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 601 may also include on-board memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or the RAM 603. Note that the program may be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 600 may also include an input/output (I/O) interface 605, the input/output (I/O) interface 605 also being connected to the bus 604. The electronic device 600 may also include one or more of the following components connected to an input/output (I/O) interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to an input/output (I/O) interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: 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), 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 context of this disclosure, 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. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 602 and/or RAM 603 and/or one or more memories other than ROM 602 and RAM 603 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to implement the item recommendation method provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and/or installed from the removable medium 611. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through 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., connected via the Internet using an Internet service provider).
The flowcharts 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 disclosure. 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.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (11)

1. An interface testing method, comprising:
acquiring a code change operation log of an application program, wherein the code change operation log comprises a first source code before the version of the application program is changed and a second source code after the version of the application program is changed;
Obtaining a code change field by scanning the first source code and the second source code;
according to the code change field, obtaining an initial test script of the target interface by inquiring an interface test script library;
changing the initial test script according to the code change field to obtain a target test script; and
and executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.
2. The method of claim 1, wherein the modifying the initial test script according to the code modification field to obtain a target test script comprises:
determining a change position in the initial test script according to the field type of the code change field;
extracting a field to be changed from the initial test script according to the change position; and
and executing changing operation on the initial test script according to the code changing field and the field to be changed to obtain the target test script.
3. The method of claim 2, wherein performing a change operation on the initial test script according to the code change field and the field to be changed to obtain the target test script comprises:
Inserting the code change field in the position of the field to be changed under the condition that the field to be changed is empty, so as to obtain the target test script; and
and under the condition that the field to be changed is not empty, changing the field to be changed into the code change field to obtain the target test script.
4. The method of claim 2, further comprising:
under the condition that the field type of the code change field is determined to be the interface name, interface name change information is determined;
and sending the interface name change information to the target object.
5. The method of claim 1, wherein the obtaining the initial test script of the target interface by querying an interface test script library according to the code change field comprises:
determining a target interface by querying the interface test script library according to the code change field; and
and according to the target interface, obtaining the initial test script by inquiring the interface test script library.
6. The method of claim 1, wherein the performing a test operation on the target interface according to the target test script to obtain a test result for the target interface comprises:
According to the target interface, obtaining a target application module by inquiring the association relation between the application module and the interface;
deploying the target test script on the target application module; and
and obtaining the test result by running the target test script.
7. The method of claim 6, the target interface comprising a plurality, the further comprising:
according to the target interface, obtaining the association relation between the target interface and the target test script by inquiring an interface test script library; and
and generating a test script operation list according to the target interface, the association relation and the target test script.
8. An interface testing apparatus, comprising:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a code change operation log of an application program, and the code change operation log comprises a first source code before version change of the application program and a second source code after version change of the application program;
the scanning module is used for obtaining a code change field by scanning the first source code and the second source code;
the query module is used for obtaining an initial test script of the target interface by querying the interface test script library according to the code change field;
The changing module is used for changing the initial test script according to the code changing field to obtain a target test script; and
and the test module is used for executing test operation on the target interface according to the target test script to obtain a test result aiming at the target interface.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.
CN202310522175.8A 2023-05-10 2023-05-10 Interface testing method, device, equipment and storage medium Pending CN116594876A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310522175.8A CN116594876A (en) 2023-05-10 2023-05-10 Interface testing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310522175.8A CN116594876A (en) 2023-05-10 2023-05-10 Interface testing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116594876A true CN116594876A (en) 2023-08-15

Family

ID=87603830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310522175.8A Pending CN116594876A (en) 2023-05-10 2023-05-10 Interface testing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116594876A (en)

Similar Documents

Publication Publication Date Title
CN109359194B (en) Method and apparatus for predicting information categories
CN111221521A (en) Method and device for generating log code, computer system and readable storage medium
CN112463729B (en) Data file warehousing method and device, electronic equipment and medium
CN113138757A (en) Method, device, server, system and medium for automatically generating front-end code
CN113535577B (en) Application testing method and device based on knowledge graph, electronic equipment and medium
CN114237651A (en) Installation method and device of cloud native application, electronic equipment and medium
CN116560661A (en) Code optimization method, device, equipment and storage medium
CN112181408A (en) Method and device for displaying view list on front page of application program
CN113448869B (en) Method and device for generating test case, electronic equipment and computer readable medium
CN115292187A (en) Method and device for automatically testing code-free page, electronic equipment and medium
CN116594876A (en) Interface testing method, device, equipment and storage medium
CN113326079A (en) Service version switching method, switching device, electronic equipment and storage medium
CN111104626B (en) Information storage method and device
CN115687093A (en) Test script generation method, device, equipment and storage medium
CN115629983A (en) Test case set generation method, device, equipment and medium
CN116401170A (en) Buried point management method, buried point management device, electronic equipment, medium and computer program product
CN116243961A (en) Version file processing method and device, electronic equipment and storage medium
CN115421738A (en) Version deployment method and device, electronic equipment and storage medium
CN115080434A (en) Case execution method, device, equipment and medium
CN115016827A (en) Method, device, electronic equipment and medium for deploying JAVA application
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
CN114064484A (en) Interface testing method and device, electronic equipment and readable storage medium
CN113360417A (en) Test method, session modifier, electronic device, and medium
CN114637689A (en) Application evaluation method, device, equipment and storage medium
CN114817007A (en) Information processing method and device, electronic equipment and computer readable storage medium

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