UI-based interface acquisition method and device, and storage medium

CN115344483BActive Publication Date: 2026-09-22DEBON SECURITIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210950884.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-09
Publication Date
2026-09-22
Estimated Expiration
2042-08-09

AI Technical Summary

Technical Problem

[0004]本申请的实施例提供了一种基于UI的接口获取方法、装置以及存储介质,以至少解决现有技术中存在的通过接口流量回放的方式测试被测应用,导致的无法确切获取变化的接口的技术问题

Benefits of technology

[0009]在本申请实施例中,计算设备通过获取被测版本的应用程序的第一接口数据,并且获取基线版本的应用程序的第二接口数据。之后计算设备将第一接口数据与第二接口数据进行比对,从而可以准确获取已经改变的接口数据,实现了对接口数据进行监控的技术效果。与现有技术相比,本技术方案避免了录制全部的接口数据,从而录制的接口无法拆分归集,导致了无法确切获取变化的接口的情况。进而解决了现有技术中存在的通过接口流量回放的方式测试被测应用,导致的无法确切获取变化的接口的技术问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115344483B_ABST
    Figure CN115344483B_ABST
Patent Text Reader

Abstract

The application discloses a UI-based interface acquisition method and device and a storage medium. The interface acquisition method comprises the following steps: acquiring first interface data of a target interface by using a preset UI automation test script, wherein the first interface data comprises address data and request data; comparing the first interface data with second interface data of a baseline version by using a preset comparison tool; and acquiring third interface data in the case that the first interface data is inconsistent with the second interface data, wherein the third interface data is interface data inconsistent with the second interface data in the first interface data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information technology, and in particular to a UI-based interface acquisition method, apparatus, and storage medium. Background Technology

[0002] In software testing, UI automation testing and API testing are typically two relatively independent testing methods. Although the application under test is the same, the two methods conduct UI-level and API-level testing from different perspectives. Furthermore, there are many connections between the two during testing. Therefore, when testing UI pages using UI automation testing methods, user page operations are monitored to generate API data traffic. Later, when testing APIs, this API data traffic can be used to backtest the application under test through "API traffic replay," thus completing the API testing. However, using the existing "API traffic replay" method to backtest the application under test only records all API data in a disorganized manner. This means the recorded APIs cannot be broken down and categorized, leading to the problem of not being able to accurately identify changed APIs.

[0003] There is currently no effective solution to the technical problem in the existing technology of testing the application under test by replaying interface traffic, which makes it impossible to accurately obtain the changed interfaces. Summary of the Invention

[0004] The embodiments of this application provide a UI-based interface acquisition method, apparatus, and storage medium to at least solve the technical problem in the prior art where testing the application under test by replaying interface traffic results in the inability to accurately acquire changed interfaces.

[0005] According to one aspect of the embodiments of this application, an interface acquisition method is provided, comprising: acquiring first interface data of a target interface using a preset UI automation test script, wherein the first interface data includes address data and request data; comparing the first interface data with second interface data of a baseline version using a preset comparison tool; and acquiring third interface data when the first interface data and the second interface data are inconsistent, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0006] According to another aspect of the embodiments of this application, a storage medium is also provided, the storage medium including a stored program, wherein, when the program is executed, the method described in any one of the above methods is executed by a processor.

[0007] According to another aspect of the embodiments of this application, an interface acquisition device is also provided, comprising: a first acquisition module, configured to acquire first interface data of a target interface using a UI automated test script, wherein the first interface data includes address data and request data; a data comparison module, configured to compare the first interface data with second interface data of a baseline version using a preset comparison tool; and a second acquisition module, configured to acquire third interface data when the first interface data and the second interface data are inconsistent, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0008] According to another aspect of the embodiments of this application, an interface acquisition device is also provided, including: a processor; and a memory connected to the processor, configured to provide the processor with instructions to perform the following processing steps: acquiring first interface data of a target interface using a UI automation test script, wherein the first interface data includes address data and request data; comparing the first interface data with second interface data of a baseline version using a preset comparison tool; and acquiring third interface data if the first interface data and the second interface data are inconsistent, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0009] In this embodiment, the computing device acquires first interface data of the application under test and second interface data of the application baseline. The computing device then compares the first and second interface data to accurately identify the changed interface data, achieving the technical effect of monitoring interface data. Compared with existing technologies, this solution avoids recording all interface data, which makes it impossible to break down and categorize the recorded interfaces, leading to the inability to accurately identify changed interfaces. This solves the technical problem in existing technologies where testing the application under test via interface traffic replay results in the inability to accurately identify changed interfaces. Attached Figure Description

[0010] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0011] Figure 1 This is a hardware structure block diagram of a computing device used to implement the method described in Embodiment 1 of this application;

[0012] Figure 2 This is a flowchart illustrating the interface acquisition method according to the first aspect of Embodiment 1 of this application;

[0013] Figure 3This is a schematic diagram of the interface acquisition device according to Embodiment 2 of this application; and

[0014] Figure 4 This is a schematic diagram of the interface acquisition device according to Embodiment 3 of this application. Detailed Implementation

[0015] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0016] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0017] Example 1

[0018] According to this embodiment, an embodiment of an interface acquisition method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0019] The method embodiments provided in this example can be executed on mobile terminals, computer terminals, servers, or similar computing devices. Figure 1 A hardware structure block diagram of a computing device for implementing an interface acquisition method is shown. For example... Figure 1As shown, a computing device may include one or more processors (processors may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), memory for storing data, and transmission devices for communication functions. In addition, it may also include: a display, input / output interfaces (I / O interfaces), a universal serial bus (USB) port (which may be included as one of the ports in the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, a computing device may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0020] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits can be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits can be a single, independent processing module, or wholly or partially integrated into any other element in the computing device. As involved in the embodiments of this application, the data processing circuit serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0021] The memory can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the interface acquisition method in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the interface acquisition method of the aforementioned application. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the computing device via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0022] The transmission device is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the computing device's communications provider. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0023] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows users to interact with the user interface of the computing device.

[0024] It should be noted here that, in some optional embodiments, the above... Figure 1 The computing device shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computing devices.

[0025] In the above operating environment, according to the first aspect of this embodiment, an interface acquisition method is provided, which is composed of... Figure 1 The computing device shown is implemented. Figure 2 A flowchart illustrating the method is shown below. (Refer to...) Figure 2 As shown, the method includes:

[0026] S202: Use a pre-set UI automation test script to obtain the first interface data of the target interface, wherein the first interface data includes address data and request data;

[0027] S204: Compare the first interface data with the baseline version of the second interface data using a preset comparison tool; and

[0028] S206: If the first interface data and the second interface data are inconsistent, obtain the third interface data, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0029] Specifically, the computing device uses a preset UI automation test script to test the application, for example, the application being tested is version A. During the testing of this version of the application, multiple interfaces of the application (i.e., target interfaces) and interface data (i.e., first interface data) of these multiple interfaces (i.e., target interfaces) are acquired. The interface data (i.e., first interface data) acquired by the computing device includes address data (e.g., full data) and request data (S202).

[0030] Furthermore, before testing application version A, the computing device also tested a baseline version of the application corresponding to application version A using a preset UI automation test script, and acquired the interface data (i.e., second interface data) of the baseline version of the application during the test. The application under test and the application under baseline are the same application, but the application under test is an application modified based on the application under baseline.

[0031] Furthermore, the computing device compares the interface data (i.e., the first interface data) of application version A with the interface data (i.e., the second interface data) of the baseline version application using a preset comparison tool (S204). The comparison tool may be, for example, an interface comparison script.

[0032] Further, the computing device determines whether the interface data (i.e., the first interface data) of application version A is the same as the interface data (i.e., the second interface data) of the baseline version application. Then, the computing device records the interface data (i.e., the third interface data) of application version A that is inconsistent with the interface data of the baseline version application (S206). There can be multiple interface data, and the number is not limited here.

[0033] As described in the background section, UI automation testing and API testing are typically two relatively independent testing methods in software testing. Although the application under test is the same, the two methods conduct UI-level and API-level testing from different perspectives. Furthermore, there are many connections between the two during testing. Therefore, when testing UI pages using UI automation testing methods, user page operations are monitored to generate API data traffic. Later, when testing APIs, this API data traffic can be used to backtest the application under test through "API traffic replay," thus completing the API testing. However, using the existing "API traffic replay" method to backtest the application under test only records all API data in a disorganized manner, making it impossible to break down and categorize the recorded APIs, resulting in the inability to accurately identify changed APIs.

[0034] To address the aforementioned technical problems, the technical solution of this application embodiment involves a computing device acquiring first interface data of the application under test and second interface data of the application in a baseline version. The computing device then compares the first and second interface data to accurately identify the changed interface data, achieving the technical effect of monitoring interface data. Compared to existing technologies, this solution avoids recording all interface data, which results in the inability to break down and aggregate the recorded interfaces, leading to the inability to accurately identify changed interfaces. This solves the technical problem in existing technologies where testing the application under test via interface traffic replay results in the inability to accurately identify changed interfaces.

[0035] Optionally, the operation of obtaining the first interface data of the target interface using the UI automated test script includes: filtering the interface test data according to preset keywords to obtain the interface information of the target interface; parsing the interface information of the target interface to obtain the address data and request data of the target interface; and parsing the address data into a pure interface address file and the request data into a pure interface request file.

[0036] Specifically, the computing device pre-sets URL keywords and then filters the interface test data using these keywords to intercept the matched interfaces (i.e., the target interfaces) and obtain their interface information. This interface information includes at least the URL corresponding to the target interface and its parameters. The computing device then parses the interface information of the target interface to obtain its address data and request data. The address data is the complete parsed data. Further, the computing device writes the address data and stores it as a plain interface address file. And the computing device writes the request data and stores it as a plain interface request file.

[0037] This technical solution intercepts interfaces and generates pure interface address files and pure interface request files based on the intercepted interface information, thereby achieving the technical effect of monitoring interfaces and accurately obtaining the required interface information.

[0038] Optionally, the operation of comparing the first interface data with the baseline version of the second interface data using a preset comparison tool includes: comparing the pure interface address file of the target interface with the pure interface address file of the baseline version; and comparing the pure interface request file of the target interface with the pure interface request file of the baseline version.

[0039] Specifically, the computing device pre-tests the baseline version of the application using UI automation. During this process, it acquires interface information from multiple interfaces for interface testing. The computing device then parses this interface information to obtain the interface address data and request data. The computing device then writes the address data and stores it as a plain interface address file. Conversely, the computing device writes the request data and stores it as a plain interface request file.

[0040] Furthermore, the computing device obtains the pure interface address file and pure interface request file of application version A. Using a preset comparison tool, it compares the pure interface address file of application version A with the pure interface address file of the baseline version application to determine whether the interface addresses in the pure interface address file of application version A are consistent with those in the baseline version application. The computing device also compares the pure interface request file of application version A with the pure interface request file of the baseline version application to determine whether the requests in the pure interface request file of application version A are consistent with those in the pure interface request file of the baseline version application. The pure interface address file and pure interface request file of the tested version application are generated based on the interface information of the target interface.

[0041] Therefore, this technical solution only needs to compare two versions of the pure interface address file or pure interface request file during comparison, without having to locate the data to be compared within the file. This avoids comparing interfaces one by one, thus achieving out-of-order comparison, saving computing power, and reducing memory consumption. Furthermore, the above method can also remove noise, thereby reducing interference.

[0042] Optionally, the method further includes: using a UI automation test script to obtain the response message of the target interface, and parsing the response message into interface request and response files; and using a request interface script to parse the interface request and response files to generate an interface automation test script.

[0043] Specifically, the computing device pre-sets URL keywords and then filters the interface test data using these keywords to intercept the matched interfaces (i.e., the target interfaces) and obtain their interface information. This interface information includes the URL and parameters corresponding to the target interface. The computing device then parses the interface information of the target interface to obtain its response message. Further, the computing device composes the response message and stores it as an interface request and response file. Finally, the computing device uses a pre-written request interface script to parse the interface request and response file, thereby generating an automated interface test script.

[0044] This technical solution generates API automation test scripts simultaneously with UI automation testing. Therefore, when subsequent API automation testing is needed, there's no need to rewrite the scripts; the generated scripts are sufficient to complete the tests. Furthermore, no modifications are required to the API test scripts before use. This saves significant manpower and resources and improves testing efficiency.

[0045] Optionally, before obtaining the first interface data of the target interface, the method further includes: using the identifiers pre-set in the test cases to segment the test cases and obtain the interface test data corresponding to the test cases.

[0046] Specifically, the computing device first acquires the test cases for the application to be tested. There can be multiple test cases, and each test case has pre-set identifiers at the beginning and end. When the computing device recognizes the beginning and end identifiers of each test case, it calls relevant methods to segment each test case, thus obtaining interface test data corresponding to each test case. Then, based on the target interface corresponding to the interface test data, the computing device obtains a pure interface address file, a pure interface request file, and interface request and response files. Each interface test data set includes these three types of files.

[0047] This technical solution segments test cases, enabling rapid location of target interfaces and improving the efficiency of UI automation testing.

[0048] Furthermore, during the UI automation testing of the application under test, the computing device acquires and stores the association between the front-end pages and interfaces of the application under test. For example, the computing device can implement the corresponding function of the front-end page 1 by calling the interface associated with the front-end page 1 (e.g., interface 1), thus establishing an association between the front-end page 1 and the interface 1.

[0049] If the interface associated with the front-end page changes, the computing device determines the front-end page associated with that interface based on pre-stored associations between front-end pages and interfaces. Then, based on the determined front-end page, the computing device performs UI automation testing or interface testing on that front-end page.

[0050] Therefore, this technical solution records the relationship between front-end pages and interfaces through UI automation testing. When an interface changes, it can accurately locate the front-end pages that are related to that interface, so that only those front-end pages can be tested. This simplifies the testing process, allows for quick testing of front-end pages that are related to the changed interface, and achieves precise testing of front-end pages.

[0051] In addition, refer to Figure 1 As shown, according to a second aspect of this embodiment, a storage medium is provided. The storage medium includes a stored program, wherein, when the program is executed, a processor performs any of the methods described above.

[0052] Therefore, according to this embodiment, the computing device acquires first interface data of the application under test and second interface data of the application baseline. The computing device then compares the first and second interface data to accurately identify the changed interface data, achieving the technical effect of monitoring interface data. Compared with existing technologies, this solution avoids recording all interface data, which makes it impossible to break down and categorize the recorded interfaces, leading to the inability to accurately identify changed interfaces. This solves the technical problem in existing technologies where testing the application under test via interface traffic replay results in the inability to accurately identify changed interfaces.

[0053] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0054] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0055] Example 2

[0056] Figure 3An interface acquisition device 300 according to this embodiment is shown, which corresponds to the method described according to the first aspect of Embodiment 1. Reference Figure 3 As shown, the device 300 includes: a first acquisition module 310, used to acquire first interface data of a target interface using a UI automated test script, wherein the first interface data includes address data and request data; a data comparison module 320, used to compare the first interface data with second interface data of a baseline version using a preset comparison tool; and a second acquisition module 330, used to acquire third interface data when the first interface data and the second interface data are inconsistent, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0057] Optionally, the first acquisition module 310 includes: a keyword filtering submodule, used to filter the interface test data according to preset keywords to obtain the interface information of the target interface; an information parsing submodule, used to parse the interface information of the target interface to obtain the address data and request data of the target interface; and a data parsing submodule, used to parse the address data into a pure interface address file and parse the request data into a pure interface request file.

[0058] Optionally, the data comparison module 320 includes: a first comparison submodule for comparing the plain interface address file of the target interface with the plain interface address file of the baseline version; and a second comparison submodule for comparing the plain interface request file of the target interface with the plain interface request file of the baseline version.

[0059] Optionally, the device 300 further includes: a first parsing module, used to obtain the response message of the target interface using a UI automated test script, and parse the response message into an interface request and response file; and a second parsing module, used to parse the interface request and response file using a request interface script to generate an interface automated test script.

[0060] Optionally, before obtaining the first interface data of the target interface, the method further includes: using the identifiers pre-set in the test cases to segment the test cases and obtain the interface test data corresponding to the test cases.

[0061] Therefore, according to this embodiment, the computing device acquires first interface data of the application under test and second interface data of the application baseline. The computing device then compares the first and second interface data to accurately identify the changed interface data, achieving the technical effect of monitoring interface data. Compared with existing technologies, this solution avoids recording all interface data, which makes it impossible to break down and categorize the recorded interfaces, leading to the inability to accurately identify changed interfaces. This solves the technical problem in existing technologies where testing the application under test via interface traffic replay results in the inability to accurately identify changed interfaces.

[0062] Example 3

[0063] Figure 4 An interface acquisition device 400 according to this embodiment is shown, which corresponds to the method described according to the first aspect of Embodiment 1. Reference Figure 4 As shown, the device 400 includes: a processor 410; and a memory 420 connected to the processor 410, for providing the processor 410 with instructions to perform the following processing steps: obtaining first interface data of a target interface using a UI automation test script, wherein the first interface data includes address data and request data; comparing the first interface data with second interface data of a baseline version using a preset comparison tool; and obtaining third interface data if the first interface data and the second interface data are inconsistent, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

[0064] Optionally, the operation of obtaining the first interface data of the target interface using the UI automated test script includes: filtering the interface test data according to preset keywords to obtain the interface information of the target interface; parsing the interface information of the target interface to obtain the address data and request data of the target interface; and parsing the address data into a pure interface address file and the request data into a pure interface request file.

[0065] Optionally, the operation of comparing the first interface data with the baseline version of the second interface data using a preset comparison tool includes: comparing the pure interface address file of the target interface with the pure interface address file of the baseline version; and comparing the pure interface request file of the target interface with the pure interface request file of the baseline version.

[0066] Optionally, the device further includes: using a UI automation test script to obtain the response message of the target interface and parsing the response message into interface request and response files; and using a request interface script to parse the interface request and response files to generate an interface automation test script.

[0067] Optionally, before obtaining the first interface data of the target interface, the method further includes: using the identifiers pre-set in the test cases to segment the test cases and obtain the interface test data corresponding to the test cases.

[0068] Therefore, according to this embodiment, the computing device acquires first interface data of the application under test and second interface data of the application baseline. The computing device then compares the first and second interface data to accurately identify the changed interface data, achieving the technical effect of monitoring interface data. Compared with existing technologies, this solution avoids recording all interface data, which makes it impossible to break down and categorize the recorded interfaces, leading to the inability to accurately identify changed interfaces. This solves the technical problem in existing technologies where testing the application under test via interface traffic replay results in the inability to accurately identify changed interfaces.

[0069] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0070] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0071] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0072] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0073] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0074] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0075] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for obtaining an interface, characterized in that, include: The UI automation test script is used to obtain the first interface data of the target interface, wherein the first interface data includes address data and request data, including: The interface test data is filtered by preset keywords to obtain the interface information of the target interface; The interface information of the target interface is parsed to obtain the address data and request data of the target interface; The address data is parsed into a pure interface address file, and the request data is parsed into a pure interface request file; The first interface data is compared with the baseline version of the second interface data using a preset comparison tool, including: Compare the pure interface address file of the target interface with the pure interface address file of the baseline version; Compare the pure interface request file of the target interface with the pure interface request file of the baseline version; If the first interface data is inconsistent with the second interface data, third interface data is obtained, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

2. The method according to claim 1, characterized in that, Also includes: The UI automated test script is used to obtain the response message of the target interface, and the response message is parsed into interface request and response files; The API request and response files are parsed using the API request script to generate an automated API test script.

3. The method according to claim 1, characterized in that, Before obtaining the first interface data of the target interface, the method further includes: using the identifiers pre-set in the test cases to segment the test cases and obtain the interface test data corresponding to the test cases.

4. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, the method described in any one of claims 1 to 3 is performed by a processor.

5. An interface acquisition device, characterized in that, include: The first acquisition module is used to acquire the first interface data of the target interface using a UI automation test script, wherein the first interface data includes address data and request data, including: The interface test data is filtered by preset keywords to obtain the interface information of the target interface; The interface information of the target interface is parsed to obtain the address data and request data of the target interface; The address data is parsed into a pure interface address file, and the request data is parsed into a pure interface request file; The data comparison module is used to compare the first interface data with the baseline version of the second interface data using a preset comparison tool, including: Compare the pure interface address file of the target interface with the pure interface address file of the baseline version; Compare the pure interface request file of the target interface with the pure interface request file of the baseline version; The second acquisition module is used to acquire third interface data when the first interface data is inconsistent with the second interface data, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

6. The apparatus according to claim 5, characterized in that, The operations of obtaining the first interface data of the target interface using UI automation test scripts include: The keyword filtering submodule is used to filter the interface test data according to preset keywords to obtain the interface information of the target interface; The information parsing submodule is used to parse the interface information of the target interface to obtain the address data and request data of the target interface; The data parsing submodule is used to parse the address data into a pure interface address file and the request data into a pure interface request file.

7. The apparatus according to claim 6, characterized in that, The operation of comparing the first interface data with the baseline version of the second interface data using a preset comparison tool includes: The first comparison submodule is used to compare the pure interface address file of the target interface with the pure interface address file of the baseline version; The second comparison submodule is used to compare the pure interface request file of the target interface with the pure interface request file of the baseline version.

8. An interface acquisition device, characterized in that, include: processor; A memory, connected to the processor, for providing the processor with instructions to perform the following processing steps: The UI automation test script is used to obtain the first interface data of the target interface, wherein the first interface data includes address data and request data, including: The interface test data is filtered by preset keywords to obtain the interface information of the target interface; The interface information of the target interface is parsed to obtain the address data and request data of the target interface; The address data is parsed into a pure interface address file, and the request data is parsed into a pure interface request file; The first interface data is compared with the baseline version of the second interface data using a preset comparison tool, including: Compare the pure interface address file of the target interface with the pure interface address file of the baseline version; Compare the pure interface request file of the target interface with the pure interface request file of the baseline version; If the first interface data is inconsistent with the second interface data, third interface data is obtained, wherein the third interface data is the interface data in the first interface data that is inconsistent with the second interface data.

Citation Information

Patent Citations

  • Test method and test device for service interfaces

    CN105450464A