CN-119883897-B - Interface testing method and device, computer equipment and storage medium
Abstract
The application provides an interface testing method, a device, computer equipment and a storage medium, wherein the method is applied to the field of computers and comprises the following steps: the computer equipment acquires 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.
Inventors
- HU DAI
- Tu Huixun
- LIU LIN
- ZHANG YU
Assignees
- 成都长城汽车研发有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241224
Claims (10)
- 1. A method for testing an interface of a semiconductor device, characterized in that the method comprises: Acquiring interface element layout information of a target display screen in a plurality of display screens in response to an off-screen operation event of the target display screen; When detecting a target interaction operation aiming at a target interface element in the target display screen, determining target element positioning information of the target interface element based on the interface element layout information and a target display screen identifier of the target display screen, wherein the target element positioning information comprises element attributes and a target display screen identifier; adding the target element positioning information and a target operation record of the target interface element in a test script file, wherein the target operation record comprises the target interface element and the target interaction operation; 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.
- 2. The method of claim 1, wherein the obtaining interface element layout information for a target display screen in response to an off-screen operation event for the target display screen comprises: 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 tag information to construct the interface element layout information of the tree structure.
- 3. The method of claim 1, wherein prior to obtaining interface element layout information for a target display screen in response to an off-screen operation event for the target display screen, further comprising: Acquiring display screen information of a plurality of display screens; and creating a plurality of test execution units in the test script file based on the display screen number of the plurality of display screens.
- 4. The method according to claim 3, wherein the testing 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 comprises: 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 the test script file; Distributing a test execution unit for each display screen to be tested; and in the test execution unit corresponding to each display screen to be tested, testing the interface elements to be tested in the display screen to be tested.
- 5. The method according to claim 4, wherein the testing the interface element to be tested in the display screen to be tested in the test execution unit corresponding to each display screen to be tested includes: Acquiring operation records corresponding to interface elements to be tested in the display screen to be tested in test execution units corresponding to the display screen to be tested; calling an operation function of the 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.
- 6. The method of claim 5, wherein after adding the target element positioning information and the target operation record of the target interface element in the test script file, further comprising: Determining a target assertion statement based on the target expected result corresponding to the target interaction operation; And determining the target interface element as a target assertion point, and inserting the target assertion statement at the target assertion point.
- 7. The method of claim 6, wherein the determining whether the interface element to be tested passes the test based on the interaction result comprises: 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; And 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.
- 8. An interface testing apparatus, the apparatus comprising: An interface element obtaining unit, configured to obtain interface element layout information of a target display screen in a plurality of display screens in response to an off-screen operation event for the target display screen; The element positioning unit is used for determining target element positioning information of the target interface element based on the interface element layout information and a target display screen identifier of the target display screen when target interaction operation aiming at the target interface element in the target display screen is detected, wherein the target element positioning information comprises element attributes and the target display screen identifier; The script generation unit is used for adding the target element positioning information and a target operation record of the target interface element in a test script file, wherein the target operation record comprises the target interface element and the target interaction operation; And the test unit is used for testing the interface elements to be tested in at least one display screen to be tested based on the test script file if the test instruction is received.
- 9. A computer device, the computer device comprising: a memory for storing executable program code; A processor for calling and running the executable program code from the memory, causing the computer device to perform the method of any of claims 1 to 7.
- 10. A computer readable storage medium, characterized in that the computer readable storage medium stores computer program code which, when executed, implements the method of any of claims 1 to 7.
Description
Interface testing method and device, computer equipment and storage medium Technical Field The present application relates to the field of computers, and more particularly, to an interface test method, apparatus, computer device, and storage medium in the field of computers. Background With the development of science and technology, the interface automation test technology provides reliable guarantee for software development. However, the existing interface testing tools are all designed based on a single display screen, and when the terminal equipment is provided with a plurality of display screens, the existing interface testing tools do not support the plurality of display screens to simultaneously perform the automatic interface test, so that the testing efficiency of the multi-screen terminal equipment is greatly reduced. Disclosure of Invention The application provides an interface test method, an interface test device, computer equipment and a storage medium, the method can realize the simultaneous interface automatic test of a plurality of display screens, reduces the labor cost and improves the test efficiency. According to the interface testing method, an interface element layout information of a target display screen is obtained in response to an off-screen operation event aiming at the target display screen, when target interactive operation aiming at the target interface element in the target display screen is detected, target element positioning information of the target interface element is determined based on the interface element layout information and a target display screen identification of the target display screen, the target element positioning information and a target operation record of the target interface element are added in a test script file, the target operation record comprises the target interface element and the target interactive operation, and if a test instruction is received, the interface element to be tested in at least one display screen to be tested is tested based on the test script file. Through the technical scheme, the interface element layout information of the display screen is obtained through aiming at the off-screen operation event 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 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. With reference to the first aspect, in some possible implementations, the step of obtaining interface element layout information of the target display screen in response to an off-screen operation event for the target display screen includes obtaining interface element tag information of the target display screen in response to the off-screen operation event for the target display screen, and analyzing the interface element tag information to construct interface element layout information of a tree structure. With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, before the step of obtaining the layout information of the interface element of the target display screen in response to the off-screen operation event for the target display screen, the method further includes obtaining display screen information of a plurality of display screens, and creating a plurality of test execution units in the test script file based on the display screen numbers of the plurality of display screens. With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, the step of testing 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 includes determining the interface element to be tested in the at least one display screen to be tested according to element positioning information in the test script file if the test instruction is received, allocating a test execution unit for each display screen to be tested, and testing the interface element to be tested in the display screen to be tested in the test execution unit corresponding to each display screen to be tested. With reference to the first aspect and the implementation manner, in some possible implementation manners, the step of testing the interface element to be tested in the display screen to be tested in the test execution unit corresponding to each display screen to be tested includes the steps of obtaining an operation record corresponding