Detailed Description
The technical scheme of the application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiment of the present application, unless otherwise indicated, "/" means or, for example, a/B may mean a or B, "and/or" in the text is only one association relationship describing the association object, and it means that there may be three relationships, for example, a and/or B, three cases where a exists alone, a and B exist together, and B exists alone, and further, "a plurality" means two or more in the description of the embodiment of the present application.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature.
Referring to fig. 1, fig. 1 is a system architecture diagram of an interface testing method according to an embodiment of the present application. As shown in fig. 1, the interface testing method provided by the embodiment of the application can be applied to a computer device 10. The computer device 10 is connected with a terminal device 20 with a plurality of display screens, and performs interface test on the display screens of the terminal device 20, wherein the terminal device 20 can be a vehicle, a multi-screen computer, a multi-screen medical device, a multi-screen industrial device and the like. The test script file according to which the computer device 10 performs the interface test method can be generated by an interface test tool, the display screen information of the terminal device 20 is obtained through the connection between the computer device 10 and the terminal device 20, meanwhile, the interactive operation of the user on the interface element in the display screen is monitored, the script code is automatically generated according to the interactive operation of the user on the interface element, and then the test script file is obtained. However, in the related art, the computer device 10 can monitor only one display screen of the terminal device 20, and the generated test script file can also be tested only for one display screen.
Based on the above problems, the embodiment of the application provides an interface testing method. The computer device obtains interface element layout information for a display screen by receiving an off-screen operation event for the display screen. Upon detecting an interactive operation for the interface element, element positioning information for the interface element is determined based on the interface element layout information and the display screen identification. And adding element positioning information and operation records of the interface elements into a test script file, and testing at least one display screen according to the test script file when a test instruction is received. By the method, when other display screens are operated outside the screen, the monitoring view angle of the computer equipment can be switched, so that an interface testing tool in the computer equipment can acquire the layout information of the interface elements of the plurality of display screens, and the interactive operation of a user on the interface elements in the plurality of display screens can be monitored. The interface automatic test is carried out on a plurality of display screens simultaneously, so that the labor cost is reduced, and the test efficiency is improved.
Based on the system architecture diagram shown in fig. 1, the following describes in detail the interface testing method provided by the embodiment of the present application with reference to fig. 2 to 5.
Referring to fig. 2, fig. 2 is a flow chart of an interface testing method according to an embodiment of the application. As shown in fig. 2, the method according to the embodiment of the present application may include the following steps S101 to S104.
S101, the computer equipment responds to an off-screen operation event aiming at the target display screen, and acquires interface element layout information of the target display screen.
Specifically, the computer equipment responds to an off-screen operation event of a user aiming at a target display screen in the terminal equipment, and acquires interface element layout information of the target display screen. The computer equipment is internally provided with an interface testing tool, and a display screen of the terminal equipment is monitored through the recording function of the interface testing tool. When the computer equipment captures an off-screen operation event of a user on the target display screen through the recording function of the interface testing tool, the focus of the recording function is switched to the target display screen, and the interface testing tool can acquire the layout information of the interface elements of the target display screen. The off-screen operation event is an operation event in which the touch operation occurs outside the display view of the display screen. Interface elements include, but are not limited to, buttons, sliders, input boxes, and the like, controls in the display screen. The interface element layout information is represented in a tree structure, and the tree structure clearly shows the nesting relationship among the interface elements. Each node of the tree structure is an interface element, and each node contains element attributes of the interface element, wherein the element attributes include, but are not limited to, attribute information such as element Identifier (ID), element positioning mode, element coordinates, element margin and the like.
S102, when the computer equipment detects target interaction operation aiming at target interface elements in the target display screen, determining target element positioning information of the target interface elements based on the interface element layout information and target display screen identification of the target display screen.
Specifically, when the computer device captures the target interaction operation of the user on the target interface element in the target display screen under the recording function of the interface test tool, the target element positioning information of the target interface element can be determined based on the interface element layout information and the target display screen identification of the target display screen. The interactive operation is operations such as single click, double click, long press, sliding, text input and the like. The element positioning information comprises unique identifiers such as element attributes or information of the combined identifier interface elements, and the interface test method provided by the embodiment of the application can carry out interface test on the terminal equipment with a plurality of display screens, so that in order to prevent the element positioning information of the interface elements from being repeated, the display screen identifiers are added into the existing element positioning information, so that the accuracy of element positioning is improved.
S103, adding target element positioning information and target operation records of target interface elements in the test script file by the computer equipment.
Specifically, after determining the target element positioning information, the computer device adds the target element positioning information and the target operation record of the target interface element to the test script file. The test script file is a code file automatically written by the interface test tool in the recording process and is used for subsequent automatic interface test. When the target element positioning information is determined, the interface test tool adds the target element positioning information to the test script file. Meanwhile, since one interface element can perform various interactive operations, for example, a single click operation, a double click operation and a long press operation can be performed for a button element, a target operation record of a target interface element needs to be added in the test script file. The target operation record comprises a target interface element and target interaction operation, so that when the automatic test is carried out based on the test script file, the interaction operation for the interface element can be accurately determined according to the operation record, and a corresponding operation function is further called. The operation function is an operation method pre-packaged in the test script file.
And S104, if the computer equipment receives the test instruction, testing the interface elements to be tested in at least one display screen to be tested based on the test script file.
Specifically, when the computer equipment receives a test instruction, the interface elements to be tested in at least one display screen to be tested of the terminal equipment are tested based on a test script file generated by the interface test tool. And during testing, analyzing element positioning information in the test script file, and positioning the element positioning information to interface elements to be tested in the display screen to be tested. And acquiring an operation record of each interface element to be tested in the test script file, calling a corresponding operation function according to the interaction operation in the operation record, and realizing interaction with the interface element to be tested to obtain an interaction result. And determining a test result according to the interaction result.
In the embodiment of the application, the computer equipment acquires the interface element layout information of the display screen by receiving an off-screen operation event of a user aiming at the display screen. Upon detecting an interactive operation for the interface element, element positioning information for the interface element is determined based on the interface element layout information and the display screen identification. And adding element positioning information and operation records of the interface elements into a test script file, and testing at least one display screen according to the test script file when a test instruction is received. By the method, the interface automation test is simultaneously carried out on a plurality of display screens, the labor cost is reduced, and the test efficiency is improved.
Referring to fig. 3, a flow chart of an interface testing method is provided in an embodiment of the application. As shown in fig. 3, the method according to the embodiment of the present application may include the following steps S201 to S209.
S201, the computer equipment acquires display screen information of a plurality of display screens of the terminal equipment, and a plurality of test execution units are created in the test script file based on the display screen number of the plurality of display screens.
Specifically, the computer device is connected with a terminal device with a plurality of display screens, the computer device obtains display screen information of all the display screens of the terminal device through an installed interface test tool, and based on the number of the display screens, a test execution unit corresponding to the number of the display screens is created in a test script file. The display information includes, but is not limited to, display identification, display resolution, display frame rate and the like. The display screen identification is the unique identification of a plurality of display screens, the resolution of the display screen is used for determining the position and the margin size of the interface element when the element positioning is carried out subsequently, and the frame rate of the display screen is used for determining the performance and the response speed of the display screen interface. The interface test tool has a recording function, and monitors a plurality of display screens of terminal equipment connected with the computer equipment through the recording function. The test script file is a code file written in the recording process of the interface test tool and is used for subsequent automatic interface test. The test execution unit is used for realizing parallel test of a plurality of display screens, and the test execution unit can be in the form of threads or processes.
S202, the computer equipment responds to an off-screen operation event aiming at the target display screen, and acquires interface element label information of the target display screen.
Specifically, the computer device responds to an off-screen operation event aiming at a target display screen in the terminal device, and acquires interface element tag information of the target display screen. Under the recording function of the interface testing tool, the computer equipment can capture an off-screen operation event of a user on the target display screen, and further switch the focus of the recording function to the target display screen so as to acquire interface label information of an interface currently displayed by the target display screen. The off-screen operation event is an operation event in which the touch operation occurs outside the display view of the display screen. The interface elements include, but are not limited to, buttons, sliders, input boxes and other controls in the display screen, the interface element label information is interface source code of the display screen, and the interface source code defines the content in the display screen interface and the layout of the interface elements in the form of hypertext markup language (HyperText Markup Language, HTML) or extensible markup language (Extensible Markup Language, XML), including the color, font, margin, alignment mode and the like of the interface elements.
S203, the computer equipment analyzes the interface element label information based on the interface test tool to construct the interface element layout information of the tree structure.
Specifically, the computer device analyzes the interface element tag information through an HTML parser or an XML parser in the interface test tool, and further builds the interface element layout information of the tree structure. The interface element layout information of the tree structure clearly shows the nesting relation among elements in the display screen interface, the nodes are basic units of the tree structure, and the tree structure is gradually unfolded from the root node to the interface elements at the sub-positions and deeper layers. Each node of the tree structure is an interface element, and each node contains the element attribute of the interface element. The element attributes include, but are not limited to, element ID, element positioning, element coordinates, element margins, etc. attribute information. The element identifier is an element ID and is used for uniquely identifying an interface element, the element coordinates and the element margin are determined based on the acquired display screen resolution, and the element positioning modes include, but are not limited to, positioning modes such as positioning according to the nesting relation of the interface element and positioning according to the element ID. It should be noted that, the element positioning manner in the layout information of the interface element can only position the interface element in a single display screen.
S204, when the computer equipment detects target interaction operation aiming at target interface elements in the target display screen, determining target element positioning information of the target interface elements based on the interface element layout information and target display screen identification of the target display screen.
Specifically, when the computer device captures the target interaction operation of the user on the target interface element in the target display screen under the recording function of the interface test tool, the target element positioning information of the target interface element can be determined based on the interface element layout information and the target display screen identification of the target display screen. The interactive operation is operations such as single click, double click, long press, sliding, text input and the like. The element positioning information comprises unique identifiers such as element attributes or information of the combined identifier interface elements, and the interface test method provided by the embodiment of the application can carry out interface test on the terminal equipment with a plurality of display screens, so that in order to prevent the element positioning information of the interface elements from being repeated, the display screen identifiers are added into the existing element positioning information, namely, the display screen identifiers are added into the element positioning mode in the step S203, so that target element positioning information is obtained, multi-screen logic of element positioning is realized, and the accuracy of element positioning is improved in the multi-screen interface test.
S205, adding target element positioning information and a target operation record of the target interface element in the test script file by the computer equipment, wherein the target operation record comprises the target interface element and target interaction operation.
Specifically, after determining the target element positioning information, the computer device adds the target element positioning information and the target operation record of the target interface element to the test script file. And after the target element positioning information is determined, the interface testing tool adds the target element positioning information into the test script file. Meanwhile, since one interface element can perform various interactive operations, for example, a single click operation, a double click operation and a long press operation can be performed for a button element, a target operation record of a target interface element needs to be added in the test script file. The target operation record comprises a target interface element and target interaction operation, so that when the automatic test is carried out based on the test script file, the interaction operation for the interface element can be accurately determined according to the operation record, and a corresponding operation function is further called. The operation function is an operation method pre-packaged in the test script file.
S206, the computer equipment determines a target assertion statement based on the target interface element and a target expected result corresponding to the target interaction operation.
Specifically, to implement an automated test, an interface test tool in the computer device can determine a target assertion statement based on the target interface element and a target expected result corresponding to the target interaction operation. The target interface element may correspond to a plurality of interactions, each interaction resulting in a different interaction result, determining a target expected result based on the target interaction with respect to the target interface element, and generating a target assertion statement based on the target expected result. The assertion statement is a Boolean expression containing an expected result, the expression is true when the interaction result is the same as the expected result, the script can continue to run, and the expression is false when the interaction result is different from the expected result, the script throws out an abnormal prompt, and the operation is interrupted.
S207, the computer device determines the target interface element as a target assertion point, and inserts a target assertion statement at the target assertion point.
Specifically, an interface test tool in the computer device determines a target interface element as a target predicate point at which a target predicate statement is inserted. The predicate is a checkpoint set in the code of the test script file, which typically operates on the target interface element after invoking an operating function to obtain an interaction result, so as to compare the interaction result with an expected result.
S208, if the computer equipment receives the test instruction, determining interface elements to be tested in at least one display screen to be tested according to the element positioning information in the test script file.
Specifically, when the computer equipment receives a test instruction, the computer equipment automatically runs a test script file and analyzes element positioning information in the test script file. The test script file comprises at least one piece of element positioning information, all the element positioning information is analyzed, and interface elements to be tested in at least one display screen to be tested are positioned according to display screen identifiers in the element positioning information.
S209, the computer equipment distributes test execution units for each display screen to be tested, and tests interface elements to be tested in the display screen to be tested in the test execution units corresponding to each display screen to be tested.
Specifically, the computer equipment allocates a test execution unit for each display screen to be tested in a plurality of test execution units which are created in advance, and tests interface elements to be tested in the display screen to be tested in the test execution units corresponding to each display screen to be tested. Synchronous testing of a plurality of display screens to be tested is achieved through a plurality of test execution units, and it is to be noted that each display screen to be tested can comprise at least one interface element to be tested, and in the test execution unit corresponding to each display screen to be tested, the operation sequence of the interface elements to be tested in the display screen to be tested is tested according to the generation process of the test script file.
During testing, an operation record corresponding to the interface element to be tested in each display screen to be tested is obtained in the test execution unit corresponding to each display screen to be tested, an operation function of interactive operation in the operation record is called, and interaction is carried out with the interface element to be tested through the operation function, so that an interaction result is obtained. And judging whether the interface element to be tested passes the test or not based on the interaction result, wherein the interaction result is obtained in an interface screenshot form so as to be compared with an expected result. The specific judging process is to compare the expected result of the assertion statement corresponding to the interface element to be tested with the interaction result to obtain a comparison result. If the comparison result indicates that the expected result is different from the interaction result, determining that the interface element to be tested fails the test, and outputting a repair prompt for the interface element to be tested. Referring to fig. 4, fig. 4 is a schematic flow chart of an assertion check according to an embodiment of the present application. As shown in fig. 4, an interface screenshot is performed on at least one display screen to be tested, and a plurality of interaction results are obtained. And when the interaction result is compared with the expected result, the target area segmentation is carried out on the interface screenshot so as to reduce the comparison range and improve the comparison efficiency. The elements in the interface may be compared, or the interface images may be compared. If the interface elements are compared, detecting whether the expected interface elements indicated by the expected results appear in the interaction results through an element detection algorithm, if so, testing is passed, if not, testing is failed, if the interface images are compared, judging whether the interface images of the interaction results are identical to the expected interface images of the expected results through an image comparison algorithm, if so, testing is passed, and if not, testing is failed. And obtaining a test result according to the comparison result.
It should be noted that, if the stability test is performed on the interface element to be tested, the threshold value of the test times is preset. And when the test is started, recording the test times of the interface element to be tested in real time, and after the interface element to be tested passes the test, repeating the test on the interface element to be tested until the test times reach a test time threshold or the test fails, so as to determine the stability of the interface element to be tested and output a test report. If the interface element to be tested fails the test, outputting a repair prompt for the interface element to be tested so as to prompt a user to repair the vulnerability of the interface element to be tested, and generating a vulnerability log in the test report. Optionally, if the user is not detected to perform bug repair on the interface element to be tested within the preset time, the interface element to be tested can be skipped, and a subsequent test operation is automatically performed. Referring to fig. 5, fig. 5 is a schematic flow chart of an interface test according to an embodiment of the application.
In the embodiment of the application, the computer equipment acquires display screen information of a plurality of display screens of the terminal equipment connected with the computer equipment so as to create a test execution unit based on the number of the display screens. And when receiving an off-screen operation event aiming at the display screen by a user, acquiring interface element layout information of the display screen. Upon detecting an interactive operation for the interface element, element positioning information for the interface element is determined based on the interface element layout information and the display screen identification. And adding the element positioning information and the operation record of the interface element into the test script file, and adding an assertion statement at the execution logic of the interface element in the test script file. And if the test instruction is received, testing interface elements to be tested in at least one display screen according to the test script file, determining a test result according to the assertion statement, and outputting a test report. By the method, the interface automation test is simultaneously carried out on a plurality of display screens, the labor cost is reduced, and the test efficiency is improved. Display screen identifiers are added into the element positioning information, so that multi-screen element positioning is realized, and the accuracy of element positioning is improved. And through the test execution unit, synchronous test of a plurality of display screens is realized.
Based on the system architecture diagram of fig. 1, an interface testing apparatus provided in an embodiment of the present application will be described in detail below with reference to fig. 6. It should be noted that, the interface testing apparatus in fig. 6 is used to execute the method of the embodiment of fig. 2-5, and for convenience of explanation, only the relevant parts of the embodiment of the present application are shown, and specific technical details are not disclosed, please refer to the embodiment of fig. 2-5.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an interface testing device according to an embodiment of the application. As shown in fig. 6, the interface test apparatus 1 of the embodiment of the present application may include an interface element acquisition unit 11, an element positioning unit 12, a script generation unit 13, and a test unit 14.
An interface element obtaining unit 11, configured to obtain interface element layout information of a target display screen in response to an off-screen operation event for the target display screen;
An element positioning unit 12 for determining target element positioning information of a target interface element based on interface element layout information and a target display screen identification of the target display screen when a target interactive operation for the target interface element in the target display screen is detected;
A script generating unit 13, configured to add target element positioning information and a target operation record of a target interface element in a test script file, where the target operation record includes the target interface element and a target interaction operation;
And the testing unit 14 is configured to test the interface element to be tested in the at least one display screen to be tested based on the test script file if the test instruction is received.
Optionally, the interface element obtaining unit 11 is specifically configured to obtain interface element tag information of the target display screen in response to an off-screen operation event for the target display screen;
and analyzing the interface element label information to construct the interface element layout information of the tree structure.
Optionally, the interface test device 1 is specifically configured to obtain display screen information of a plurality of display screens;
A plurality of test execution units are created in the test script file based on the number of display screens of the plurality of display screens.
Optionally, the test unit 14 is specifically configured to determine, if a test instruction is received, an interface element to be tested in at least one display screen to be tested according to element positioning information in the test script file;
distributing a test execution unit for each display screen to be tested;
And testing the interface elements to be tested in the display screen to be tested in the test execution units corresponding to each display screen to be tested.
Optionally, the test unit 14 is specifically configured to obtain, in a test execution unit corresponding to each display screen to be tested, an operation record corresponding to an interface element to be tested in the display screen to be tested;
Calling an operation function of interactive operation in the operation record, and interacting with the interface element to be tested through the operation function to obtain an interaction result;
And judging whether the interface element to be tested passes the test or not based on the interaction result.
Optionally, the interface testing device 1 is specifically configured to determine a target assertion statement based on a target interface element and a target expected result corresponding to the target interaction operation;
And determining the target interface element as a target assertion point, and inserting a target assertion statement at the target assertion point.
Optionally, the test unit 14 is specifically configured to compare an expected result of the assertion statement corresponding to the interface element to be tested with the interaction result to obtain a comparison result;
If the comparison result indicates that the expected result is the same as the interaction result, determining that the interface element to be tested passes the test;
If the comparison result indicates that the expected result is different from the interaction result, determining that the interface element to be tested fails the test, and outputting a repair prompt for the interface element to be tested.
In the embodiment of the application, the computer equipment acquires display screen information of a plurality of display screens of the terminal equipment connected with the computer equipment so as to create a test execution unit based on the number of the display screens. And when receiving an off-screen operation event aiming at the display screen by a user, acquiring interface element layout information of the display screen. Upon detecting an interactive operation for the interface element, element positioning information for the interface element is determined based on the interface element layout information and the display screen identification. And adding the element positioning information and the operation record of the interface element into the test script file, and adding an assertion statement at the execution logic of the interface element in the test script file. And if the test instruction is received, testing interface elements to be tested in at least one display screen according to the test script file, determining a test result according to the assertion statement, and outputting a test report. By the method, the interface automation test is simultaneously carried out on a plurality of display screens, the labor cost is reduced, and the test efficiency is improved. Display screen identifiers are added into the element positioning information, so that multi-screen element positioning is realized, and the accuracy of element positioning is improved. And through the test execution unit, synchronous test of a plurality of display screens is realized.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the application.
By way of example, and as shown in FIG. 7, the computer device 700 includes a processor 701 and a memory 702, wherein the processor 701 is electrically connected to the memory 702.
Processor 701 is a control center of computer device 700 and may include one or more processing cores. The processor 701 utilizes various interfaces and lines to connect the various portions of the overall computer device, and performs various functions of the computer device and processes data by running or invoking computer programs stored in the memory 702, and invoking data stored in the memory 702, thereby overall controlling the computer device 700. Optionally, the processor 701 may be implemented in at least one hardware form of digital signal Processing (DIGITAL SIGNAL Processing, DSP), field programmable gate array (Field Programmable GATE ARRAY, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 701 may integrate one or a combination of several of a CPU, an image processor (Graphics Processing Unit, GPU), a modem, etc. The CPU mainly processes an operating system, a user page, an application program and the like, the GPU is used for rendering and drawing display contents, and the modem is used for processing wireless communication. It will be appreciated that the modem may not be integrated into the processor 701 and may be implemented solely by a single communication chip.
The memory 702 may be used to store software programs and modules, and the processor 701 performs various functional applications and data processing by executing the computer programs and modules stored in the memory 702. The memory 702 may mainly include a storage program area that may store an operating system, computer programs required for at least one function, and the like, and a storage data area that may store data created according to the use of the computer device 700, and the like.
In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 702 may also include a memory controller to provide access to the memory 702 by the processor 701.
In this embodiment, the processor 701 in the computer device 700 loads the instructions corresponding to the processes of one or more computer programs into the memory 702 according to the following steps, and the processor 701 executes the computer programs stored in the memory 702, so as to implement various functions, as follows:
acquiring interface element layout information of a target display screen in response to an off-screen operation event aiming at the target display screen;
When target interactive operation aiming at a target interface element in a target display screen is detected, determining target element positioning information of the target interface element based on interface element layout information and a target display screen identifier of the target display screen;
adding target element positioning information and target operation records of target interface elements in a test script file, wherein the target operation records comprise the target interface elements and target interaction operations;
And if the test instruction is received, testing the interface elements to be tested in at least one display screen to be tested based on the test script file.
Optionally, the processor 701, when executing the obtaining the interface element layout information of the target display screen in response to the off-screen operation event for the target display screen, specifically performs:
Acquiring interface element tag information of a target display screen in response to an off-screen operation event aiming at the target display screen;
and analyzing the interface element label information to construct the interface element layout information of the tree structure.
Optionally, before executing the obtaining of the interface element layout information of the target display screen in response to the off-screen operation event for the target display screen, the processor 701 further executes:
acquiring display screen information of a plurality of display screens;
A plurality of test execution units are created in the test script file based on the number of display screens of the plurality of display screens.
Optionally, when executing the test instruction, if the processor 701 tests the interface element to be tested in the at least one display screen to be tested based on the test script file, the specific implementation is that:
If a test instruction is received, determining interface elements to be tested in at least one display screen to be tested according to element positioning information in a test script file;
distributing a test execution unit for each display screen to be tested;
And testing the interface elements to be tested in the display screen to be tested in the test execution units corresponding to each display screen to be tested.
Optionally, when executing the test execution unit corresponding to each display screen to be tested, the processor 701 specifically executes:
Acquiring operation records corresponding to interface elements to be tested in the display screen to be tested in a test execution unit corresponding to each display screen to be tested;
Calling an operation function of interactive operation in the operation record, and interacting with the interface element to be tested through the operation function to obtain an interaction result;
And judging whether the interface element to be tested passes the test or not based on the interaction result.
Optionally, after executing the target element positioning information added in the test script file and the target operation record of the target interface element, the processor 701 further executes:
determining a target assertion statement based on the target interface element and a target expected result corresponding to the target interaction operation;
And determining the target interface element as a target assertion point, and inserting a target assertion statement at the target assertion point.
Optionally, when executing the determination of whether the interface element to be tested passes the test based on the interaction result, the processor 701 specifically executes:
Comparing the expected result of the assertion statement corresponding to the interface element to be tested with the interaction result to obtain a comparison result;
If the comparison result indicates that the expected result is the same as the interaction result, determining that the interface element to be tested passes the test;
If the comparison result indicates that the expected result is different from the interaction result, determining that the interface element to be tested fails the test, and outputting a repair prompt for the interface element to be tested.
In the embodiment of the application, the computer equipment acquires display screen information of a plurality of display screens of the terminal equipment connected with the computer equipment so as to create a test execution unit based on the number of the display screens. And when receiving an off-screen operation event aiming at the display screen by a user, acquiring interface element layout information of the display screen. Upon detecting an interactive operation for the interface element, element positioning information for the interface element is determined based on the interface element layout information and the display screen identification. And adding the element positioning information and the operation record of the interface element into the test script file, and adding an assertion statement at the execution logic of the interface element in the test script file. And if the test instruction is received, testing interface elements to be tested in at least one display screen according to the test script file, determining a test result according to the assertion statement, and outputting a test report. By the method, the interface automation test is simultaneously carried out on a plurality of display screens, the labor cost is reduced, and the test efficiency is improved. Display screen identifiers are added into the element positioning information, so that multi-screen element positioning is realized, and the accuracy of element positioning is improved. And through the test execution unit, synchronous test of a plurality of display screens is realized.
It should be understood that, the apparatus provided in the embodiment of the present application is used to perform the above-mentioned interface testing method, so that the same effect as that of the above-mentioned implementation method can be achieved.
In case of an integrated unit, the apparatus may comprise a processing module, a memory module. When the device is applied to computer equipment, the processing module can be used for controlling and managing the actions of the computer equipment. The memory module may be used to support computer devices in executing associated program code and the like.
Wherein the processing module may be a processor or controller that may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination of computing functions, including for example one or more microprocessors, digital Signal Processing (DSP) and microprocessor combinations, etc., and a memory module may be a memory.
In addition, the device provided by the embodiment of the application can be a chip, a component or a module, and the chip can comprise a processor and a memory which are connected, wherein the memory is used for storing instructions, and when the processor calls and executes the instructions, the chip can be made to execute the interface test method provided by the embodiment.
The embodiment of the application also provides a computer readable storage medium, in which computer program code is stored, which when run on a computer, causes the computer to execute the related method steps to implement an interface testing method provided in the above embodiment.
The present embodiment also provides a computer program product, which when run on a computer, causes the computer to perform the above-mentioned related steps to implement an interface testing method provided in the above-mentioned embodiments.
The apparatus, the computer readable storage medium, the computer program product, or the chip provided in this embodiment are used to execute the corresponding method provided above, and therefore, the advantages achieved by the apparatus, the computer readable storage medium, the computer program product, or the chip can refer to the advantages of the corresponding method provided above, which are not described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.