CN116932392A - Interface test method, apparatus, device, storage medium and computer program product - Google Patents
Interface test method, apparatus, device, storage medium and computer program product Download PDFInfo
- Publication number
- CN116932392A CN116932392A CN202310877213.1A CN202310877213A CN116932392A CN 116932392 A CN116932392 A CN 116932392A CN 202310877213 A CN202310877213 A CN 202310877213A CN 116932392 A CN116932392 A CN 116932392A
- Authority
- CN
- China
- Prior art keywords
- target element
- test
- interface
- preset
- detection times
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000004590 computer program Methods 0.000 title claims abstract description 56
- 238000010998 test method Methods 0.000 title description 7
- 238000012360 testing method Methods 0.000 claims abstract description 320
- 238000000034 method Methods 0.000 claims abstract description 62
- 238000001514 detection method Methods 0.000 claims description 145
- 230000002159 abnormal effect Effects 0.000 claims description 22
- 230000004044 response Effects 0.000 description 18
- 230000005856 abnormality Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 10
- 125000004122 cyclic group Chemical group 0.000 description 6
- 230000000694 effects Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 4
- 230000008901 benefit Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 4
- 229910052711 selenium Inorganic materials 0.000 description 4
- 239000011669 selenium Substances 0.000 description 4
- 238000013500 data storage Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000004617 sleep duration Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 238000001545 Page's trend test Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000005059 dormancy Effects 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004622 sleep time Effects 0.000 description 1
- 238000011895 specific detection Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present application relates to an interface testing method, apparatus, device, storage medium and computer program product. According to the method, the element identification of the test object on the interface is obtained, the target element is determined according to the element identification, and under the condition that the target element does not contain the preset loading identification, the test operation on the test object is executed, so that a test result is obtained, wherein the preset loading identification represents the loading data state on the interface. In the method, the loading identification can be preset to accurately judge whether the loading of the data on the interface is finished, so that the method can intelligently exit and wait through the preset loading identification before the real test, the problem of the traditional setting of the exit waiting time can be solved to a certain extent, the exit waiting time is reasonably determined, and the accuracy of the automatic test is improved.
Description
Technical Field
The present application relates to the field of web page testing technologies, and in particular, to an interface testing method, apparatus, device, storage medium, and computer program product.
Background
With the development of User Interface (UI) automatic test technology, many UI automatic test tools, such as the selenium test tool, have emerged.
Currently, in the process of using a selenium test tool to perform an automatic test, a test object needs to be manually determined on an interface, then the test waiting time of the test object is correspondingly set, and a test operation is performed when the test waiting time is overtime to complete the test of the test object.
However, the above-described test method has a problem of low test accuracy.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an interface testing method, apparatus, computer device, storage medium, and computer program product that can improve the testing accuracy.
In a first aspect, the present application provides an interface testing method. The method comprises the following steps:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In one embodiment, the executing the test operation on the test object under the condition that the target element does not include the preset loading identifier includes:
and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and/or the operation attribute of the target element.
In one embodiment, according to the display attribute of the target element and the operation attribute of the target element, performing a test operation on the test object includes:
and executing the test operation of the test object according to the operation attribute of the target element under the condition that the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the performing a test operation on the test object according to the operation attribute of the target element includes:
and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is operable.
In one embodiment, the performing a test operation on the test object according to the operation attribute of the target element includes:
And detecting the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is not operable.
In one embodiment, after detecting the operation attribute of the target element at every first time interval, the method further includes:
determining whether the detection times reach a first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
In one embodiment, the method further comprises:
and detecting the display attribute of the target element every second time period under the condition that the display attribute of the target element indicates that the target element is not displayed, and executing the test operation on the test object until the display attribute of the target element indicates that the target element is displayed.
In one embodiment, after detecting the display attribute of the target element every second duration, the method further includes:
And determining whether the detection times reach a second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
In one embodiment, the method further comprises:
and under the condition that the target element contains the preset loading identifier, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
In one embodiment, after detecting whether the target element includes the preset loading identifier every third duration, the method further includes:
and determining whether the detection times reach a third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
In a second aspect, the application further provides an interface testing device. The device comprises:
the acquisition module is used for acquiring the element identification of the test object on the interface;
the determining module is used for determining a target element according to the element identifier;
The execution module is used for executing the test operation on the test object under the condition that the target element does not contain the preset loading identifier, so as to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
Under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
According to the interface testing method, the device, the computer equipment, the storage medium and the computer program product, the element identification of the test object on the interface is obtained, the target element is determined according to the element identification, and under the condition that the target element is determined to not contain the preset loading identification, the test operation on the test object is executed, so that the test result is obtained, wherein the preset loading identification represents the loading data state on the interface. In the method, the loading identification can be preset to accurately judge whether the loading of the data on the interface is finished, so that the method can intelligently exit and wait through the preset loading identification before the real test, the problem of the traditional setting of the exit waiting time can be solved to a certain extent, the exit waiting time is reasonably determined, and the accuracy of the automatic test is improved.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the accompanying drawings. In the drawings:
FIG. 1 is a diagram of an application environment for an interface test method in one embodiment;
FIG. 2 is a flow chart of an interface testing method in one embodiment;
FIG. 3 is a flow chart of an interface testing method according to another embodiment;
FIG. 4 is a block diagram of an interface testing apparatus in one embodiment;
fig. 5 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion.
In the description of embodiments of the present application, the technical terms "first," "second," and the like are used merely to distinguish between different objects and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated, a particular order or a primary or secondary relationship. In the description of the embodiments of the present application, the meaning of "plurality" is two or more unless explicitly defined otherwise.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In the UI automatic test process of the current network interface, interface data loading is affected by factors such as network, data size and the like, interface data is sometimes loaded slowly and sometimes loaded quickly, so that uncertainty exists in interface data loading, and the setting of the test case exit waiting time during test becomes a difficult problem, for example, if the exit waiting time is set longer, resource waste is caused; if the exit latency is set to be short, the test operation is performed without waiting for the completion of the data loading, which affects the test efficiency or directly results in failure to perform the test. In a conventional automatic test process, an interface element is typically tested using a selenium tool, and may be tested by setting a fixed exit latency, or by determining whether the interface element is clickable or operable using the EC method of the selenium tool. However, when the interface is affected by the data loading speed, sometimes the interface element cannot be displayed, so that the clickable button cannot be clicked at the moment, and a false alarm exists or the test cannot be performed, thereby reducing the test accuracy. The embodiment of the application provides an interface testing method which can intelligently judge and exit waiting time for testing according to the actual data loading time of an interface, thereby solving the problem of preset waiting time, avoiding the occurrence of false alarm and error and improving the UI automatic testing accuracy. The following examples illustrate the process in detail.
The interface testing method provided by the embodiment of the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data for elements on a web page that server 104 needs to load on terminal 102. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The terminal 102 sends an interface test request to the server 104, and the server 104 obtains interface data requested by the web page test request from the data storage system and returns the interface data to the terminal 102, so that the interface data is loaded on the interface of the terminal 102, and the terminal 102 can conveniently perform automatic test of corresponding interface elements after the interface data is loaded. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the application environment in which the present inventive arrangements are applied, and that a particular application environment may include more or less components than those shown, or may combine some components, or have a different arrangement of components.
In one embodiment, as shown in fig. 2, an interface testing method is provided, and the method is applied to the terminal in fig. 1 for illustration, and includes the following steps:
s201, acquiring element identification of the test object on the interface.
The interface may be a test interface of an application, and may include a plurality of elements thereon. The element identification is used to uniquely characterize the element corresponding to the test object on the interface, which may be represented using one or a combination of letters, numbers, words, characters, etc. The element identifier may be defined in advance by the terminal according to different elements included in the interface, and the element identifier may also be a positioning identifier of the test object in the script element of the UI interface. The test object may include test controls, test boxes, test buttons, and the like. The test objects and the elements are in one-to-one correspondence.
In the embodiment of the application, when the terminal tests the interface in advance, a user can input a test instruction on the interface to trigger the test object, and the terminal can respond to the test object triggered by the user to obtain the element identification of the element corresponding to the test object. For example, the terminal may obtain the location identifier of the test object in the script element of the UI through XPATH, ID, NAME, CLASS _name, tag_name, link_text, css_search, and other methods.
S202, determining a target element according to the element identification.
The target element is an element corresponding to the test object to be tested. In the embodiment of the application, because the element identifier is used for uniquely characterizing the element corresponding to the test object on the interface, after the terminal determines the element identifier, the element corresponding to the element identifier can be used as the target element. .
S203, under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; the preset loading identifier represents the state of loading data on the interface.
Wherein the state of loading data includes a state of loading data being completed or a state of not loading data being completed. The preset loading identifier may be represented by one or a combination of letters, numbers, characters, etc., for example, a class= "el-loading-text" identifier in a script element of the interface.
In the embodiment of the application, when the terminal determines the target element based on the steps, whether the target element contains the preset loading identifier or not can be further checked, if so, the data on the interface is not loaded, and in this case, the data loading is continued to be completed; if the test code is not included, the data on the interface is completely loaded, so that the waiting time can be exited under the condition that the target element does not include the preset loading identification, and the test code in the test case is specifically called to start testing the test object. Optionally, the terminal may set a loop determination condition in each test case corresponding to the test object, where the loop determination condition includes determining whether a preset loading identifier is included in an element corresponding to the test object (for example, determining whether a script element includes a class= "el-loading-text" >) and if it is determined that the element corresponding to the test object includes the preset loading identifier, continuing loop determination; if the elements corresponding to the test objects are determined not to contain the preset loading identification, the loop judgment is exited, the automatic test assertion is carried out, and the test is completed. The loop determination condition may be set at the front end of the test code in each test case, so that the terminal accurately determines the exit waiting time before each test based on the test code in the test case.
In the interface testing method, the element identification of the test object on the interface is obtained, the target element is determined according to the element identification, and the test operation on the test object is executed under the condition that the target element is determined to not contain the preset loading identification, so that the test result is obtained, wherein the preset loading identification represents the loading data state on the interface. In the method, the loading identification can be preset to accurately judge whether the loading of the data on the interface is finished, so that the method can intelligently exit and wait through the preset loading identification before the real test, the problem of the traditional setting of the exit waiting time can be solved to a certain extent, the exit waiting time is reasonably determined, and the accuracy of the automatic test is improved.
In one embodiment, in the case that it is determined that the target element includes the preset loading identifier, the terminal further performs the steps of: detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
The third duration is used to indicate a sleep duration between every two detections, for example, the third duration may be different durations of 1s, 2s, etc., which may be determined according to specific detection requirements.
The embodiment of the application relates to a method for continuously performing cyclic detection on a terminal under a scene that a target element contains a preset loading identifier, namely, for example, the terminal adds a cyclic condition in the EC method of each test case, detects whether a class= "el-loading-text" identifier exists in a script element of a UE interface, if the identifier exists, the cyclic detection is continuously performed until the fact that the class= "el-loading-text" identifier does not exist in the script element of the UE interface is detected, and then the test operation of the test object is executed to complete the test; setting a third time length between every two detection; if the identification does not exist, the data loading is completed, the loop is exited, and after the waiting time is exited, the test operation on the test object is executed to complete the test. The embodiment can play a role in saving computing resources by setting the sleep time of the detection interval.
In the process of the loop judgment, the detection times can be set, that is, after the detection of whether the target element contains the preset loading identifier is performed every third time period, whether the detection times after each detection reach the third preset detection times or not can be judged, and the third abnormal error reporting information is output on the interface under the condition that the detection times reach the third preset detection times.
The third preset detection times can be determined by the terminal according to the detection requirements, and the third preset detection times can be different times of 100 times, 200 times, 300 times and the like. The third exception reporting information is used to notify the user of the loading type of test exception, and may include error warning information, or include error information.
In the embodiment of the application, after the terminal detects whether the target element contains the preset loading identifier once every third time, along with the increase of the detection times, after each time that the target element contains the preset loading identifier, whether the detection times after each time detection reach the third preset detection times can be further judged, if so, the possible occurrence of an abnormality in the interaction between the terminal and the background server is indicated, and based on the detection results, the terminal can output third abnormal error reporting information on the interface so as to inform the user that the possible occurrence of the test abnormality of the data loading type, and the corresponding test is required after the processing. The embodiment limits the cycle detection by setting the cycle detection times, so that the effect of saving the computing resources can be achieved.
In one embodiment, in addition to determining whether to exit from waiting for testing by determining the preset loading identifier, the method may further determine whether to exit from waiting for testing by determining the display attribute and/or the operation attribute of the target element, that is, the terminal performs the step of performing the test operation on the test object when it is determined that the preset loading identifier is not included in the target element, and the step of specifically performing when the step of performing the test result is performed: and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and the operation attribute of the target element.
Wherein the display attribute of the target element represents a state of whether the target element is displayed on the interface; the operational attribute of the target element represents a state on the interface of whether the target element is operational, e.g., whether the target element can be clicked.
In the embodiment of the application, under the condition that the target element does not contain the preset loading identifier, the terminal can execute the EC method exit waiting time, namely the terminal can determine the real interface response time by judging the display attribute of the target element, so as to determine whether to exit waiting, test the test object after determining to exit waiting, and complete the test. Or the terminal can also determine the real interface response time by judging the operation attribute of the target element, so as to determine whether to exit waiting, and then test the test object after determining to exit waiting, thereby completing the test. Optionally, the terminal may determine the real interface response time by determining the display attribute of the target element and the operation attribute of the target element, so as to determine whether to exit waiting, and then test the test object after determining to exit waiting, so as to complete the test.
Further, when the terminal performs the step of "performing a test operation on the test object according to the display attribute of the target element and the operation attribute of the target element", the step may be specifically performed: and judging whether the display attribute of the target element represents that the target element is displayed or not, and executing the test operation on the test object according to the operation attribute of the target element under the condition that the target element is displayed.
In the embodiment of the application, the terminal can check whether the display attribute of the target element shows that the display is already displayed, if the display shows that the page finishes a part of response, the terminal further judges the operation attribute of the target element, namely whether the target element can be operated, if the target element is confirmed to be operated, the data is completely loaded at the moment, and the page finishes all the responses, so that the terminal can execute the test operation on the test object under the condition. The method realizes the intelligent exit waiting time test by considering the data loading time and the interface response time, and greatly improves the test efficiency and the test accuracy.
Optionally, in a case where the display attribute of the target element indicates that the target element is not displayed, detecting the display attribute of the target element every second period of time until the display attribute of the target element indicates that the target element is displayed, performing a test operation on the test object.
The second duration is used to indicate a sleep duration between every two detections, for example, the second duration may be different durations of 1s, 2s, etc., which may be determined according to the detection requirement.
The embodiment of the application relates to a method for continuously performing cyclic detection on a terminal under a scene that a display attribute of a target element indicates that the target element is not displayed, namely, for example, the terminal adds a cyclic condition in an EC method of each test case, detects whether a value of a display identifier in a script element of a UE interface is a preset value, for example, judges whether a value of display identifier of_of_element_activated is 1, if the value of the display identifier is not 1, indicates that the interface is not responded to completion, and continuously performs cyclic detection until the display identifier in the script element of the UE interface is detected as the preset value, and then performs test operation on a test object to complete the test; setting a second time length between every two detection; if the value of the identifier is 1, the interface is also responsive to completion, the loop is exited, and after the waiting time is exited, the test operation on the test object is executed to complete the test.
In the process of the above-mentioned loop judgment, the detection times may be set, that is, after detecting the display attribute of the target element every second time period, it may be further judged whether the detection times after each detection reach the second preset detection times, and if it is determined that the detection times reach the second preset detection times, the second abnormal error reporting information may be output on the interface.
The second preset detection times can be determined by the terminal according to detection requirements, and the second preset detection times can be different times of 100 times, 200 times, 300 times and the like. The second exception reporting information is used to inform the user interface of the type of response to the test exception, and may include error warning information or error information.
In the embodiment of the application, after the terminal detects whether the target element is displayed once every second time, along with the increase of the detection times, after each time that the target element is detected to be displayed, whether the detection times after each time detection reach the second preset detection times can be further judged, if so, the response abnormality appears on the interface of the terminal, and based on the response abnormality, the terminal can output third abnormality error reporting information on the interface to inform a user that the interface response type test abnormality appears, and the user needs to process and then test correspondingly. The embodiment can achieve the effect of saving computing resources by setting the cycle detection times.
In one embodiment, a method for executing a test operation on a test object according to an operation attribute of a target element is provided, that is, when a terminal specifically executes the above steps, the steps are specifically executed: in the case where the operation attribute of the target element indicates that the target element is operable, a test operation on the test object is performed.
The embodiment of the application relates to a method for testing a terminal according to the operation attribute of a target element in a scene of determining that the target element is displayed, namely, the terminal can check whether the operation attribute of the target element is operable or not, and if so, the terminal can execute the test operation on a test object on the basis that the target element is displayable, which means that the page completes all responses. The method realizes the intelligent judgment of the exit waiting time to test by considering the data loading time and the interface response time, and greatly improves the testing efficiency and the testing accuracy.
Optionally, in a case where the operation attribute of the target element indicates that the target element is not operable, the operation attribute of the target element is detected every first time period until the operation attribute of the target element indicates that the target element is operable, a test operation on the test object is performed.
The first duration is used to indicate a sleep duration between every two detections, for example, the first duration may be different durations of 1s, 2s, etc., which may be determined according to the detection requirement.
The embodiment of the application relates to a method for continuously performing loop detection on a terminal under a scene that an operation attribute of a target element indicates that the target element is inoperable, namely, for example, the terminal adds a loop condition in an EC method of each test case, detects whether a value of an operation identifier in a script element of a UE interface is a preset value, for example, judges whether a value of the operation identifier element_to_be_clickable is 1, if the value of the operation identifier is not 1, indicates that the interface does not respond to completion, and continuously performs loop detection until the operation identifier in the script element of the UE interface is detected as the preset value, and then performs test operation on a test object to complete the test; setting a first duration between every two detection; if the value of the operation identifier is 1, the interface is also responsive to completion, the loop is exited, and after the waiting time is exited, the test operation on the test object is executed to complete the test.
In the process of the above-mentioned loop judgment, the detection times may be set, that is, after the operation attribute of the target element is detected every first time, it may be further judged whether the detection times after each detection reach the first preset detection times, and if it is determined that the detection times reach the first preset detection times, the first abnormal error reporting information may be output on the interface.
The first preset detection times can be determined by the terminal according to detection requirements, and the first preset detection times can be different times of 100 times, 200 times, 300 times and the like. The first exception reporting information is used to notify the user interface of a test exception of the response type, and may include error warning information or include error information.
In the embodiment of the application, after the terminal detects whether the target element is operable once every first time, along with the increase of the detection times, after each time that the target element is operable is judged, whether the detection times after each time of detection reach the first preset detection times can be further judged, if so, the response abnormality appears on the interface of the terminal, and based on the response abnormality, the terminal can output first abnormality error reporting information on the interface to inform a user that the interface response type test abnormality appears, and the user needs to process and then test correspondingly. The embodiment can achieve the effect of saving computing resources by setting the cycle detection times.
In summary, the present application also provides an interface testing method, as shown in fig. 3, which includes:
s301, acquiring element identifiers of test objects on an interface.
S302, determining a target element according to the element identification.
S303, determining whether the target element contains a preset loading identifier, and executing step S304 under the condition that the target element does not contain the preset loading identifier; in the case that it is determined that the target element contains the preset loading identifier, step S309 is performed.
S304, determining whether the display attribute of the target element indicates that the target element is displayed, and if so, executing step S305; if not, step S308 is performed.
S305, determining whether the operation attribute of the target element indicates that the operation is operable, if so, executing step S306, and if not, executing step S307.
S306, executing the test operation on the test object.
S307, detecting the operation attribute of the target element at intervals of a first time, and executing the test operation on the test object until the operation attribute of the target element indicates that the target element is operable; or determining whether the detection times reach the first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
S308, detecting the display attribute of the target element every second time period until the display attribute of the target element indicates that the target element is displayed, and executing the test operation on the test object; or determining whether the detection times reach the second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
S309, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object; or determining whether the detection times reach the third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
The above steps are all described in the foregoing, and the detailed content is referred to in the foregoing, which is not repeated here.
According to the interface test method provided by the embodiment of the application, the overtime time is judged through the cycle detection times, and the dormancy time is set in each cycle, so that the computing resources are saved; and whether the script element has a class= "el-loading-text" key mark or not is obtained through the script, so that the exit waiting time is automatically judged, the problems of manual intervention and preset exit waiting time setting are avoided, and the method for intelligently judging the exit waiting time and carrying out automatic test is realized. In addition, the interface test method provided by the embodiment of the application judges when each test case is executed, so that the condition that the response time of different interfaces is the shortest response time of the current interface is selected to exit waiting, and the condition that all interfaces wait for the same time can not be achieved. The whole judging process does not depend on a manual subjective judgment threshold, so that the manual participation degree is greatly reduced, and the problem that the manually set threshold or the standard is incomplete or imperfect is avoided, thereby greatly improving the testing efficiency and accuracy.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides an interface testing device for realizing the interface testing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the interface testing device provided below may be referred to the limitation of the interface testing method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 4, there is provided an interface test apparatus comprising:
an acquiring module 10, configured to acquire an element identifier of a test object on an interface;
a determining module 11, configured to determine a target element according to the element identifier;
the execution module 12 is configured to execute a test operation on the test object to obtain a test result when it is determined that the target element does not include the preset loading identifier; and the preset loading identifier represents the state of loading data on the interface.
In one embodiment, the executing module 12 is specifically configured to execute, when it is determined that the target element does not include the preset loading identifier, a test operation on the test object according to a display attribute of the target element and/or an operation attribute of the target element.
In one embodiment, the executing module 12 is specifically configured to execute a test operation on the test object according to the operation attribute of the target element when the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the executing module 12 is specifically configured to execute a test operation on the test object if the operation attribute of the target element indicates that the target element is operable.
In one embodiment, the executing module 12 is specifically configured to, when the operation attribute of the target element indicates that the target element is not operable, detect the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, execute a test operation on the test object.
In one embodiment, the executing module 12 is specifically configured to determine whether the number of times of detection reaches a first preset number of times of detection, and output first exception reporting information on the interface if it is determined that the number of times of detection reaches the first preset number of times of detection.
In one embodiment, the executing module 12 is specifically configured to, when the display attribute of the target element indicates that the target element is not displayed, detect the display attribute of the target element every second period of time until the display attribute of the target element indicates that the target element is displayed, execute a test operation on the test object.
In one embodiment, the executing module 12 is specifically configured to determine whether the detection number reaches a second preset detection number, and output second exception reporting information on the interface if it is determined that the detection number reaches the second preset detection number.
In one embodiment, the executing module 12 is specifically configured to, when it is determined that the target element includes the preset loading identifier, detect, at intervals of a third duration, whether the target element includes the preset loading identifier, until the target element does not include the preset loading identifier, execute a test operation on the test object.
In one embodiment, the executing module 12 is specifically configured to determine whether the detection number reaches a third preset detection number, and output third exception reporting information on the interface if it is determined that the detection number reaches the third preset detection number.
The modules in the interface test device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement an interface test method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In one embodiment, the processor when executing the computer program further performs the steps of:
and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and/or the operation attribute of the target element.
In one embodiment, the processor when executing the computer program further performs the steps of:
and executing the test operation of the test object according to the operation attribute of the target element under the condition that the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the processor when executing the computer program further performs the steps of:
and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is operable.
In one embodiment, the processor when executing the computer program further performs the steps of:
and detecting the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is not operable.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining whether the detection times reach a first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
In one embodiment, the processor when executing the computer program further performs the steps of:
and detecting the display attribute of the target element every second time period under the condition that the display attribute of the target element indicates that the target element is not displayed, and executing the test operation on the test object until the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the processor when executing the computer program further performs the steps of:
and determining whether the detection times reach a second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
In one embodiment, the processor when executing the computer program further performs the steps of:
and under the condition that the target element contains the preset loading identifier, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
In one embodiment, the processor when executing the computer program further performs the steps of:
And determining whether the detection times reach a third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
The computer device provided in the foregoing embodiments has similar implementation principles and technical effects to those of the foregoing method embodiments, and will not be described herein in detail.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and/or the operation attribute of the target element.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and executing the test operation of the test object according to the operation attribute of the target element under the condition that the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is operable.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and detecting the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is not operable.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining whether the detection times reach a first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and detecting the display attribute of the target element every second time period under the condition that the display attribute of the target element indicates that the target element is not displayed, and executing the test operation on the test object until the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and determining whether the detection times reach a second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and under the condition that the target element contains the preset loading identifier, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
In one embodiment, the computer program when executed by the processor further performs the steps of:
And determining whether the detection times reach a third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
The foregoing embodiment provides a computer readable storage medium, which has similar principles and technical effects to those of the foregoing method embodiment, and will not be described herein.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and/or the operation attribute of the target element.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and executing the test operation of the test object according to the operation attribute of the target element under the condition that the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is operable.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and detecting the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is not operable.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining whether the detection times reach a first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and detecting the display attribute of the target element every second time period under the condition that the display attribute of the target element indicates that the target element is not displayed, and executing the test operation on the test object until the display attribute of the target element indicates that the target element is displayed.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and determining whether the detection times reach a second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and under the condition that the target element contains the preset loading identifier, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
In one embodiment, the computer program when executed by the processor further performs the steps of:
And determining whether the detection times reach a third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
The foregoing embodiment provides a computer program product, which has similar principles and technical effects to those of the foregoing method embodiment, and will not be described herein.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.
Claims (14)
1. An interface testing method, comprising:
acquiring element identifiers of test objects on an interface;
determining a target element according to the element identifier;
under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
2. The method according to claim 1, wherein the performing a test operation on the test object if it is determined that the target element does not include a preset loading identifier includes:
and under the condition that the target element does not contain the preset loading identifier, executing the test operation on the test object according to the display attribute of the target element and/or the operation attribute of the target element.
3. The method of claim 2, wherein performing a test operation on the test object based on the display attribute of the target element and the operation attribute of the target element comprises:
and executing the test operation of the test object according to the operation attribute of the target element under the condition that the display attribute of the target element indicates that the target element is displayed.
4. A method according to claim 3, wherein said performing a test operation on said test object according to an operational attribute of said target element comprises:
and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is operable.
5. A method according to claim 3, wherein said performing a test operation on said test object according to an operational attribute of said target element comprises:
and detecting the operation attribute of the target element every first time period until the operation attribute of the target element indicates that the target element is operable, and executing the test operation on the test object under the condition that the operation attribute of the target element indicates that the target element is not operable.
6. The method of claim 5, wherein after detecting the operation attribute of the target element every first time period, the method further comprises:
determining whether the detection times reach a first preset detection times, and outputting first abnormal error reporting information on the interface under the condition that the detection times reach the first preset detection times.
7. A method according to claim 3, characterized in that the method further comprises:
and detecting the display attribute of the target element every second time period under the condition that the display attribute of the target element indicates that the target element is not displayed, and executing the test operation on the test object until the display attribute of the target element indicates that the target element is displayed.
8. The method of claim 7, wherein after detecting the display attribute of the target element every second time period, the method further comprises:
and determining whether the detection times reach a second preset detection times, and outputting second abnormal error reporting information on the interface under the condition that the detection times reach the second preset detection times.
9. The method according to claim 1, wherein the method further comprises:
and under the condition that the target element contains the preset loading identifier, detecting whether the target element contains the preset loading identifier or not every third time period until the target element does not contain the preset loading identifier, and executing the test operation on the test object.
10. The method of claim 9, wherein after detecting whether the target element contains the preset loading identifier every third duration, the method further comprises:
and determining whether the detection times reach a third preset detection times, and outputting third abnormal error reporting information on the interface under the condition that the detection times reach the third preset detection times.
11. An interface testing apparatus, the apparatus comprising:
the acquisition module is used for acquiring the element identification of the test object on the interface;
the determining module is used for determining a target element according to the element identifier;
the execution module is used for executing the test operation on the test object under the condition that the target element does not contain the preset loading identifier, so as to obtain a test result; and the preset loading identifier represents the state of loading data on the interface.
12. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 10 when the computer program is executed.
13. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 10.
14. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310877213.1A CN116932392A (en) | 2023-07-17 | 2023-07-17 | Interface test method, apparatus, device, storage medium and computer program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310877213.1A CN116932392A (en) | 2023-07-17 | 2023-07-17 | Interface test method, apparatus, device, storage medium and computer program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116932392A true CN116932392A (en) | 2023-10-24 |
Family
ID=88383815
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310877213.1A Pending CN116932392A (en) | 2023-07-17 | 2023-07-17 | Interface test method, apparatus, device, storage medium and computer program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116932392A (en) |
-
2023
- 2023-07-17 CN CN202310877213.1A patent/CN116932392A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109901881B (en) | Plug-in loading method and device of application program, computer equipment and storage medium | |
CN113593071A (en) | Inspection method, inspection device, inspection system, computer equipment and storage medium | |
US11436188B2 (en) | Resource optimization and update method, server, and device | |
CN110879742A (en) | Method and device for asynchronously creating internal snapshot of virtual machine and storage medium | |
CN104809054B (en) | Realize the method and system of program test | |
CN105847446B (en) | Method, device and system for acquiring network data | |
CN104866416A (en) | Method and device for performance analysis of application program | |
CN108364670B (en) | Read-write pressure testing method, device, equipment and storage medium | |
CN110750460A (en) | Browser compatibility detection method, device, equipment and readable storage medium | |
CN104156305A (en) | Application program testing method and device | |
CN112817831A (en) | Application performance monitoring method, device, computer system and readable storage medium | |
CN107908679B (en) | Script statement conversion method and device and computer readable storage medium | |
CN113254153B (en) | Method and device for processing flow task, computer equipment and storage medium | |
CN106708705B (en) | Terminal background process monitoring method and system | |
CN116048490B (en) | Business event processing method, device, computer equipment and storage medium | |
CN111857854A (en) | Shutdown resource loading method and device, storage medium and electronic equipment | |
CN116932392A (en) | Interface test method, apparatus, device, storage medium and computer program product | |
CN108287781B (en) | Memory occupation monitoring method, device and system | |
CN104268059A (en) | Application search method and system of intelligent mobile terminal | |
CN114817010A (en) | Python-based Redfish automatic testing method and device | |
CN114756293A (en) | Service processing method, device, computer equipment and storage medium | |
CN113468050A (en) | Canvas-based testing method and device, computer equipment and storage medium | |
CN109684525B (en) | Document display method and device, storage medium and test equipment | |
CN107885649A (en) | The performance test methods and device of IOS application programs | |
CN115686506A (en) | Data display method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |