CN112148579A - User interface testing method and device - Google Patents

User interface testing method and device Download PDF

Info

Publication number
CN112148579A
CN112148579A CN201910561034.0A CN201910561034A CN112148579A CN 112148579 A CN112148579 A CN 112148579A CN 201910561034 A CN201910561034 A CN 201910561034A CN 112148579 A CN112148579 A CN 112148579A
Authority
CN
China
Prior art keywords
determined
data state
user interface
test case
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910561034.0A
Other languages
Chinese (zh)
Inventor
郭润增
耿志军
周俊
岑东益
卢鑫畅
江岱霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910561034.0A priority Critical patent/CN112148579A/en
Publication of CN112148579A publication Critical patent/CN112148579A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The embodiment of the application discloses a method and a device for testing a user interface, wherein a test case is generated according to recording of a user interface test process of a target service, the test case is used for identifying an action event generated in the user interface test process, and the target service responds to the action event to obtain a corresponding relation between a data state and a virtual document object model. If the user interface of the target service is tested, a test case is obtained; triggering an action event identified by a test case for a user interface of a target service, and acquiring a corresponding data state to be determined and a virtual document object model to be determined; and determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation. The method reduces the technical requirements on testers, does not need to bury points in the target service, and further reduces the testing cost.

Description

User interface testing method and device
Technical Field
The present application relates to the field of data processing, and in particular, to a method and an apparatus for testing a user interface.
Background
The intelligent terminal can provide various service services for the user through the browser. When providing business service, a User Interface (UI) corresponding to the business can be displayed on the browser, and the User acquires the business service through interaction with the UI.
In order to ensure the stability of the business service, the UI of the business needs to be tested. The current automatic test mode needs to compile corresponding test codes aiming at different services so as to generate a test case, and test points need to be buried in the services so as to realize UI test by running the test case.
Therefore, testers need to have a certain programming basis to complete the compiling and maintenance work of the test cases, the maintenance cost of service embedding points is high, and the test cost and the threshold are improved.
Disclosure of Invention
In order to solve the technical problem, the application provides a method and a device for testing a user interface, which reduce the technical requirements on testers, do not need to bury points in a target service, and further reduce the testing cost.
The embodiment of the application discloses the following technical scheme:
in a first aspect, an embodiment of the present application provides a method for testing a user interface, where the method includes:
generating a test case according to the recording of the user interface test process of the target service, wherein the test case is used for identifying the corresponding relation among the action event, the data state and the virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event;
when the user interface of the target service is tested, the test case is obtained;
triggering the action event identified by the test case for the user interface of the target service, and acquiring a corresponding data state to be determined and a virtual document object model to be determined;
and determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
In a second aspect, an embodiment of the present application provides a device for testing a user interface, where the device includes a generating unit, a first obtaining unit, a second obtaining unit, and a determining unit:
the generating unit is used for generating a test case according to the recording of the user interface test process of the target service, and the test case is used for identifying the corresponding relation among the action event, the data state and the virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event;
the first obtaining unit is configured to obtain the test case when the user interface of the target service is tested;
the second obtaining unit is configured to trigger an action event identified by the test case for the user interface of the target service, and obtain a corresponding data state to be determined and a virtual document object model to be determined;
the determining unit is used for determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
In a third aspect, an embodiment of the present application provides a test apparatus for a user interface, where the apparatus includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the method for testing a user interface according to the first aspect, according to instructions in the program code.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing program code for executing the method for testing a user interface according to the first aspect.
According to the technical scheme, the test case is generated according to the recording of the user interface test process of the target service, and the test case is used for identifying the corresponding relation among the action event, the data state and the virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event. By means of the recording mode, the test case is prevented from being generated by additionally programming aiming at different services, and the technical requirements on testers are reduced. If the user interface of the target service needs to be tested, triggering can be performed on the user interface of the target service according to the action event identified by the test case, so that a data state to be determined and a virtual document object model to be determined, which are obtained by the user interface of the target service responding to the action event, are obtained. According to the test case, what data state and virtual document object model are required to be obtained under the normal condition of the user interface of the target service corresponding to the action event, so that the data state to be determined and the virtual document object model to be determined can be compared with the data state to be determined and the virtual document object model to be determined, and the test result is determined through the comparison result. The test does not need to bury points in the target service, thereby further reducing the test cost.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of the data flow in a interact page of a system in response to a user operating a UI;
fig. 2 is a schematic view of an application scenario of a method for testing a user interface according to an embodiment of the present application;
FIG. 3a is a schematic diagram of a generated action event and corresponding data state and virtual DOM according to an embodiment of the present application;
FIG. 3b is a schematic diagram of a generated action event and corresponding data state and virtual DOM, according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for testing a user interface according to an embodiment of the present disclosure;
fig. 5a is a schematic view of a browser plug-in interface after a browser plug-in is opened according to an embodiment of the present application;
fig. 5b is a schematic diagram of a browser plug-in interface in a recording process according to an embodiment of the present application;
fig. 5c is a schematic diagram of a browser plug-in interface when a test case is saved according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating a method for testing a user interface according to an embodiment of the present disclosure;
FIG. 7a is a block diagram of a testing apparatus for a user interface according to an embodiment of the present disclosure;
FIG. 7b is a block diagram of a testing apparatus for a user interface according to an embodiment of the present disclosure;
fig. 8 is a block diagram of an apparatus for volume adjustment according to an embodiment of the present disclosure;
fig. 9 is a block diagram of a server according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
At present, a test method for a user interface mainly generates a test case of the user interface in a coding mode, and then buries a test point in a service, so that the test of the user interface is realized by running the test case. The method requires a certain programming basis for testing personnel, has high maintenance cost for the service embedded point, and improves the testing cost and threshold.
Therefore, the embodiment of the application provides a method for testing a user interface. Before introducing the user interface testing method provided in the embodiment of the present application, it should be noted that, when a user performs an operation on a UI, a response of a system to the user operation is usually implemented based on a unidirectional data flow. Among these, for a unidirectional data flow, it can be understood as: when two-way data communication is carried out by using an uploading data stream and a downloading data stream, the two data streams are independent. Such as: referring to fig. 1, which shows a schematic diagram of data flow in the exact page when the system responds to the user's operation on the UI, as shown in fig. 1, data flow occurring in the exact page is unidirectional when the system responds to the user's operation.
In practice, unidirectional data flow corresponds to a fixed data transfer process. For example, the following steps are carried out: after the parameters are input into the system, the system may go through a fixed data transfer process (e.g., processing by function 1, function 2, and function 3, respectively), and output corresponding data.
Thus, since the system is usually implemented based on unidirectional data flow in response to the user's operation on the UI, the same parameters are input into the system when the user performs the same operation on the UI, so that the system responds to the user's operation on the UI if the data transfer process that is passed corresponds to the data processing process of the pure function. Wherein the pure function may be a function that outputs the same data when the same parameter is called. Then, based on such invariance characteristics, certain output data can be obtained after a fixed data transfer process, so that certain response changes of the UI interface can occur. In addition, when the system responds to the operation of the user on the UI, if variable data such as a time stamp or a random number is generated in the data transfer process, that is, the data transfer process is passed, and the data processing process of the non-pure function is corresponded. In this way, after a fixed data transfer process, it is impossible to obtain specific output data, and certainly, it is impossible to determine a response change that occurs in correspondence with the UI interface.
For the situation that the data transfer process corresponds to the data processing process of the non-pure function, variable data (time stamp, random number and the like) in the data transfer process can be recorded, and when the operation of a user is responded later, the variable data are recovered in the data transfer process according to the pre-recorded variable data, so that determined output data can still be obtained, a UI (user interface) is enabled to generate determined response change, and the characteristic of invariance is guaranteed.
Therefore, the system is usually realized based on unidirectional data flow when responding to the operation of the user on the UI, so that the UI interface can have determined response change based on the characteristic of invariance when the user performs the same operation on the UI.
Based on this, the embodiment of the present application provides a method for testing a user interface: the method comprises the steps of recording a user interface test process of a target service to generate a test case, wherein the test case comprises an action event generated in the user interface test process, and a data state and virtual Document Object Model (DOM) corresponding to the action event, so that the user interface test of the target service can be realized based on the test case generated in a recording mode. The method can avoid generating test cases by additionally programming aiming at different services, and reduces the technical requirements on testers. In addition, when the user interface of the target service is tested, the action event in the test case is triggered to obtain the data state to be determined and the virtual DOM to be determined corresponding to the action event, and the data state to be determined and the virtual DOM are compared with the data state and the virtual DOM corresponding to the action event in the test case to obtain a test result, so that points do not need to be buried in the target service, and the test cost is further reduced.
First, an application scenario of the embodiment of the present application is described. The method can be applied to terminal equipment, and the terminal equipment can be equipment such as an intelligent terminal, a computer, a Personal Digital Assistant (PDA for short), a tablet computer and the like.
The user interface testing method can also be applied to a server, the server can be a special server only used for user interface testing, the server can also be a public server also comprising other data processing functions, and the embodiment of the application is not limited.
In order to facilitate understanding of the technical solution of the present application, a server is taken as an example to describe the testing method of the user interface provided in the embodiment of the present application in combination with an actual application scenario.
Referring to fig. 2, fig. 2 is a schematic view of an application scenario of a method for testing a user interface according to an embodiment of the present application. The application scenario includes a server 201, and the server 201 may record a user interface test process of a target service. The target service may be any service that a user implements through a user interface. For example, the target service may be a service that a user queries through a user interface of a browser.
It can be understood that, in the process of testing the user interface of the target service, the user can perform corresponding operations on the UI to achieve the target task, and for each operation of the user, a corresponding machine-recognizable action event is generated, and when the target service responds to the action event, a corresponding data state and a virtual DOM are also formed in the system background. Therefore, after the user interface testing process of the target service is recorded, the action event, the corresponding data state and the virtual DOM can be saved.
The action event can correspond to any operation which is carried out on the UI when the user is used for realizing the target task; the data state may be a state of data obtained when the target service responds to the action event, for example, the data state is a state of data on the interact page. The virtual DOM may be a tree-based standard programming interface document that requires the entire document in process to be represented in memory.
For example, referring to fig. 3a, which shows a schematic diagram of a generated action event and corresponding data state and virtual DOM provided by an embodiment of the present application, as shown in fig. 3a, for an operation performed by a user to open a user interface, a corresponding "INIT" action event is generated, and then a target service may respond to the "INIT" action event: for the INIT action event, the data of the page can be triggered to change, so that the data state of the current exact page is formed, the data state of the current exact page automatically influences the data change in the virtual DOM, the current virtual DOM is formed, and the rendering of the user interface is controlled by the current virtual DOM. Similarly, referring to fig. 3b, which illustrates a schematic diagram of a generated action event and corresponding data states and a virtual DOM provided in an embodiment of the present application, as shown in fig. 3b, when a user performs an operation of inputting "send a weekly report" into a text box of a UI, a corresponding "INPUT (text) action event" is generated, and then a target service responds to the "INPUT (text) action event" to form a data state of a current replay page, and further form a current virtual DOM, which finally controls rendering of a user interface.
Then, a target case can be generated according to the recorded user interface test process of the target service. The target use case may be used to identify an action event generated in the user interface test process, and a correspondence between a data state obtained by the target service by responding to the action event and the virtual DOM. In short, namely: the test case is marked with action events, and the corresponding relation between the data state and the virtual DOM is formed on the basis of the action events. For example: the test case identifies that an action event "X" corresponds to data state "X" and virtual DOM "X1", where both the data state "X" and virtual DOM "X1" are formed in response to the action event "X".
It should be noted that, when recording the user interface test process of the target service, the action event generated in the process, and the data state and the virtual DOM formed when responding to the action event are all generated under normal conditions by the user interface of the target service. That is, for the action events in the test case and the corresponding data state and virtual DOM, they are generated by the user interface of the target service under normal conditions.
Therefore, after the test case corresponding to the target service is obtained, if the user interface of the target service needs to be tested, the test case generated before can be obtained. And in the testing process, triggering the action event identified by the test case for the user interface of the target service, acquiring the generated data state and the virtual DOM, and taking the data state and the virtual DOM as the data state to be determined and the virtual DOM to be determined.
Therefore, the data state to be determined and the virtual DOM to be determined, which are obtained based on the action event, can be compared with the data state and the virtual DOM corresponding to the action event in the test case, and the test result can be determined according to the comparison result.
Therefore, the test method for the user interface provided by the embodiment of the application generates the test case by recording the user interface test process of the target service, thereby avoiding generating the test case by additionally programming aiming at different services and reducing the technical requirements on testers. In addition, when the user interface of the target service is tested, a test result is obtained in a mode of comparing the data state with the virtual DOM, so that points do not need to be buried in the target service, and the test cost is further reduced.
Next, a method for testing a user interface provided in an embodiment of the present application will be described with reference to the drawings.
Referring to fig. 4, this figure shows a flowchart of a method for testing a user interface according to an embodiment of the present application, where the method includes:
s401: and generating a test case according to the recording of the user interface test process of the target service.
In the embodiment of the application, aiming at the target service, the test case can be generated by recording the user interface test process of the target service. For the generated test case, the generated test case can be used for identifying the corresponding relation between the action event and the data state and the virtual DOM. The action event described herein may be generated during the testing of the user interface of the target task; the data state and virtual DOM may both be derived by the target service in response to the action event.
In a possible implementation manner, the user interface test procedure of the target service may be recorded through a browser plug-in, so as to generate a test case. In specific implementation, a browser plug-in may be installed on a terminal device or a server, and when the browser plug-in may be initialized through a corresponding page (e.g., a exact page) in the background, a test script is injected into the page, so as to record a user interface test process.
Next, a recording method of a user interface test procedure by a browser plug-in will be described. Referring to fig. 5a, this figure shows a browser plug-in interface schematic diagram after a browser plug-in is opened according to an embodiment of the present application. When starting the user interface test for the target service, the start recording button in fig. 5a may be clicked to perform recording.
In the recording process, when a user operates the UI, the browser plug-in may capture an action event generated under the operation, and a snapshot of the corresponding data state and virtual DOM. Referring to fig. 5b, which shows a schematic diagram of a browser plug-in interface in a recording process according to an embodiment of the present application, as shown in fig. 5b, each line of content may correspond to an action event and its corresponding data state and a snapshot of a virtual DOM.
It will be appreciated that the action events in a snapshot correspond to the data state and virtual DOM in the snapshot. Therefore, after the recording of the user interface test process of the target service is completed, the obtained snapshot can be used as a test case and stored. Referring to fig. 5c, a schematic diagram of a browser plug-in interface when a test case is saved according to an embodiment of the present application is shown. As shown in fig. 5c, when saving a test case, a corresponding name and category may be set for the test case, so as to facilitate later acquisition of the test case.
It can be understood that, if the target service is simpler, the test case corresponding to the target service may correspond to an action event and the corresponding data state and virtual DOM. If a target service is complex, in a possible implementation manner, a test case corresponding to the target service may include a plurality of action events, and a time sequence between the action events may be recorded in the test case. Wherein the time sequence between the action events may be a time sequence in which the action events are generated, and different action events may correspond to different data states and virtual DOMs. In a specific implementation, each action event may be arranged according to its timing sequence, thereby generating a test case.
For example, when recording a user interface test process of a target service, a user performs operation 1, operation 2, and operation 3 on the user interface in sequence. Then, after the recording is completed, the generated test case includes an action event "H", an action event "I", and an action event "J" (corresponding to operation 1, operation 2, and operation 3, respectively). Also, action event "H" corresponds to data state "H" and virtual DOM "H1"; action event "I" corresponds to data state "I" and virtual DOM "I1"; action event "J" corresponds to data state "J" and virtual DOM "J1", i.e., different action events may correspond to different data states and virtual DOMs. In addition, the test case further includes the time sequences of the action event H, the action event I, and the action event J, that is, the sequence of the generation times of the three action events is: action event H is generated prior to action event I, which is generated prior to action event J.
S402: and when the user interface of the target service is tested, obtaining the test case.
When the user interface of the target service needs to be tested, the test case generated in S401 may be obtained.
S403: and triggering the action event identified by the test case for the user interface of the target service, and acquiring the corresponding data state to be determined and the virtual document object model to be determined.
After the test case is obtained, the action event identified in the test case can be triggered for the user interface of the target service according to the action event identified in the test case, and the data state and the virtual DOM corresponding to the action event are obtained and used as the data state to be determined and the virtual DOM to be determined corresponding to the action event.
It should be noted that, if the test case includes multiple action events, each action event in the test case may be sequentially triggered to the user interface of the target service according to the time sequence of the action events in the test case.
S404: and determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
Therefore, the data state to be determined and the virtual DOM to be determined corresponding to the action event in the test process can be compared with the data state and the virtual DOM corresponding to the action event in the test case, so that a comparison result is obtained, and the test result is determined according to the comparison result.
According to the technical scheme, the test case is generated according to the recording of the user interface test process of the target service, the test case is used for identifying the action event generated in the user interface test process, and the target service responds to the corresponding relation between the data state obtained by the action event and the virtual document object model. By means of the recording mode, the test case is prevented from being generated by additionally programming aiming at different services, and the technical requirements on testers are reduced. If the user interface of the target service needs to be tested, triggering can be performed on the user interface of the target service according to the action event identified by the test case, so that a data state to be determined and a virtual document object model to be determined, which are obtained by the user interface of the target service responding to the action event, are obtained. According to the test case, what data state and virtual document object model are required to be obtained under the normal condition of the user interface of the target service corresponding to the action event, so that the data state to be determined and the virtual document object model to be determined can be compared with the data state to be determined and the virtual document object model to be determined, and the test result is determined through the comparison result. The test does not need to bury points in the target service, thereby further reducing the test cost.
In order to reduce the capability requirement on the tester and facilitate the tester to obtain the comparison result between the data state to be determined and the virtual DOM to be determined and the corresponding data state and virtual DOM in the test case more intuitively, for the method of S404, in a possible implementation manner, the method of S404 may include:
s501: and comparing the text content with the data state and the virtual document object model determined according to the corresponding relation according to the data state to be determined and the virtual document object model to be determined. If the data state to be determined and the virtual document object model to be determined are not consistent with the data state determined according to the corresponding relationship and the text content of the virtual document object model, S502 is executed, and if the data state to be determined and the virtual document object model to be determined are consistent with the data state determined according to the corresponding relationship and the text content of the virtual document object model, S503 is executed.
S502: and determining that the test result is abnormal.
S503: and determining that the test result is normal.
In the embodiment of the present application, referring to fig. 3a and fig. 3b, it can be seen that both the data state of the page and the text content in the virtual DOM are relatively intuitive, and therefore, for the data state to be determined and the virtual DOM to be determined, a tester can compare the data state to be determined and the text content of the virtual DOM determined according to the corresponding relationship in the test case.
It can be appreciated that the action events in the test case and the corresponding data states and virtual DOM are generated by the user interface of the target service under normal conditions. In this way, after comparing the data state to be determined and the virtual DOM to be determined with the text content of the data state and the virtual DOM determined according to the corresponding relationship in the test case, if the text content is determined to be inconsistent, it can be determined that the test result is abnormal. If the text contents are determined to be consistent, the test result can be determined to be normal.
Therefore, the system can directly compare the text content of the data state to be determined and the virtual DOM to be determined with the corresponding data state and virtual DOM in the test case, so that the requirement on the capability of a tester is low.
In this embodiment of the present application, in order to ensure accuracy of a generated test case, in a possible implementation manner, the method further includes:
s601: and acquiring a playback request aiming at the test case.
S602: and playing back the test case according to the recorded time sequence.
In the embodiment of the application, for example, a recording person may send a playback request for a test case to a server or a terminal device, where the recording person may be, for example, a person responsible for recording a user interface test procedure of a target service. Then, the server or the terminal device can obtain the playback request for the test case and play back the test case according to the recorded time sequence, so that whether the test case is wrong or not can be determined according to the playback content, and the accuracy of the generated test case is guaranteed.
Next, a method for testing a user interface provided in the embodiment of the present application will be described with reference to an actual application scenario. Referring to fig. 6, a schematic diagram of a method for testing a user interface provided in an embodiment of the present application is shown.
As shown in fig. 6, the user interface testing method of the target task may include three parts: recording process, test case management and regression process:
the method comprises the steps that a test process of a user interface of a target task is recorded through a browser plug-in, an action event generated based on user operation, a data state corresponding to the action event and a snapshot of a virtual DOM are recorded by the plug-in, and a test case corresponding to the target task can be generated after the recording of the test process of the user interface of the target service is completed. By the method, non-developers can record to generate the test cases, labor cost is reduced, and generation efficiency of the test cases can be improved.
After a test case is generated in a browser plug-in, the browser plug-in can send a request packet for requesting management of the test case to a test case management system, the test case management system stores and manages the test case after receiving the request packet, and when a user interface of a target task needs to be tested, the test case management system can be responsible for scheduling the test case and sending the test case to a regression environment so as to test the user interface of the target task. The test cases are sent to the test case management system for unified management, so that the maintainability of the test cases is improved.
The test case management system may start a user Interface test based on a target service of a test case by triggering two ways, namely, a timing task or an Application Programming Interface (API). The regression environment may be a virtual environment created by a regression server to import the code and test scripts of the target service into the regression environment.
When testing the user interface of the target task, the test case can be quickly initialized in the regression environment. Then, action events in the test case can be triggered one by one, and snapshots are obtained, wherein the obtained snapshots comprise the action events, corresponding data states to be determined and virtual DOMs to be determined, the data states to be determined and the virtual DOMs to be determined, which correspond to the action events, are compared with the corresponding data states and virtual DOMs in the test case, if the text contents of the data states and the virtual DOMs to be determined are the same, the test result is determined to be normal, and if the text contents are not the same, a test report can be generated based on different parts of the data states and the virtual DOMs. Therefore, the developer can analyze the abnormal position of the code through the test report and carry out BUG repair.
Based on the method for testing a user interface provided in the foregoing embodiment, an embodiment of the present application further provides a device for testing a user interface, referring to fig. 7a, which shows a schematic structural diagram of the device for testing a user interface provided in the embodiment of the present application, where the device 700 includes a generating unit 701, a first obtaining unit 702, a second obtaining unit 703, and a determining unit 704:
the generating unit 701 is configured to generate a test case according to recording of a user interface test process of a target service, where the test case is used to identify a correspondence between an action event, a data state, and a virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event;
the first obtaining unit 702 is configured to obtain the test case when the user interface of the target service is tested;
the second obtaining unit 703 is configured to trigger, to the user interface of the target service, an action event identified by the test case, and obtain a corresponding data state to be determined and a virtual document object model to be determined;
the determining unit 704 is configured to determine a test result according to a comparison result between the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relationship.
Optionally, the determining unit 704 is specifically configured to:
comparing the text content according to the data state to be determined and the virtual document object model to be determined with the data state and the virtual document object model determined according to the corresponding relation;
if the data state to be determined and the virtual document object model to be determined are inconsistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is abnormal;
and if the data state to be determined and the virtual document object model to be determined are consistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is normal.
Optionally, the test case includes a plurality of action events, and records a time sequence among the action events; different action events correspond to different data states and virtual document object models.
In a possible implementation manner, referring to fig. 7b, which shows a schematic structural diagram of a testing apparatus for a user interface provided in an embodiment of the present application, the apparatus 700 further includes a playback unit 705, where the playback unit 705 is specifically configured to:
obtaining a playback request aiming at the test case;
and playing back the test case according to the recorded time sequence.
Optionally, the generating unit 701 is specifically configured to:
and recording the user interface test process of the target service through the browser plug-in to generate a test case.
According to the technical scheme, the test case is generated according to the recording of the user interface test process of the target service, the test case is used for identifying the action event generated in the user interface test process, and the target service responds to the corresponding relation between the data state obtained by the action event and the virtual document object model. By means of the recording mode, the test case is prevented from being generated by additionally programming aiming at different services, and the technical requirements on testers are reduced. If the user interface of the target service needs to be tested, triggering can be performed on the user interface of the target service according to the action event identified by the test case, so that a data state to be determined and a virtual document object model to be determined, which are obtained by the user interface of the target service responding to the action event, are obtained. According to the test case, what data state and virtual document object model are required to be obtained under the normal condition of the user interface of the target service corresponding to the action event, so that the data state to be determined and the virtual document object model to be determined can be compared with the data state to be determined and the virtual document object model to be determined, and the test result is determined through the comparison result. The test does not need to bury points in the target service, thereby further reducing the test cost.
The embodiment of the application also provides a test device for a user interface, which is described below with reference to the accompanying drawings. Referring to fig. 8, an embodiment of the present application provides a testing device 800 for a user interface, where the device 800 may also be a terminal device, and the terminal device may be any intelligent terminal including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA), a Point of Sales (POS), a vehicle-mounted computer, and the terminal device is a mobile phone:
fig. 8 is a block diagram illustrating a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Referring to fig. 8, the handset includes: a Radio Frequency (RF) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, a processor 880, and a power supply 890. Those skilled in the art will appreciate that the handset configuration shown in fig. 8 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 8:
the RF circuit 810 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing downlink information of a base station after receiving the downlink information to the processor 880; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuit 810 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 810 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), and the like.
The memory 820 may be used to store software programs and modules, and the processor 880 executes various functional applications and data processing of the cellular phone by operating the software programs and modules stored in the memory 820. The memory 820 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 820 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.
The input unit 830 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 830 may include a touch panel 831 and other input devices 832. The touch panel 831, also referred to as a touch screen, can collect touch operations performed by a user on or near the touch panel 831 (e.g., operations performed by the user on the touch panel 831 or near the touch panel 831 using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 831 may include two portions, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 880, and can receive and execute commands from the processor 880. In addition, the touch panel 831 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 830 may include other input devices 832 in addition to the touch panel 831. In particular, other input devices 832 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 840 may be used to display information input by the user or information provided to the user and various menus of the cellular phone. The Display unit 840 may include a Display panel 841, and the Display panel 841 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, touch panel 831 can overlay display panel 841, and when touch panel 831 detects a touch operation thereon or nearby, communicate to processor 880 to determine the type of touch event, and processor 880 can then provide a corresponding visual output on display panel 841 based on the type of touch event. Although in fig. 8, the touch panel 831 and the display panel 841 are two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 831 and the display panel 841 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 850, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 841 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 841 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 860, speaker 861, microphone 862 may provide an audio interface between the user and the handset. The audio circuit 860 can transmit the electrical signal converted from the received audio data to the speaker 861, and the electrical signal is converted into a sound signal by the speaker 861 and output; on the other hand, the microphone 862 converts collected sound signals into electrical signals, which are received by the audio circuit 860 and converted into audio data, which are then processed by the audio data output processor 880 and transmitted to, for example, another cellular phone via the RF circuit 810, or output to the memory 820 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to send and receive e-mails, browse webpages, access streaming media and the like through the WiFi module 870, and provides wireless broadband Internet access for the user. Although fig. 8 shows WiFi module 870, it is understood that it does not belong to the essential constitution of the handset, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 880 is a control center of the mobile phone, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 820 and calling data stored in the memory 820, thereby integrally monitoring the mobile phone. Optionally, processor 880 may include one or more processing units; preferably, the processor 880 may integrate an application processor, which mainly handles operating systems, user interfaces, applications, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 880.
The handset also includes a power supply 890 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 880 via a power management system to manage charging, discharging, and power consumption.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In this embodiment, the processor 880 included in the terminal device further has the following functions:
acquiring an object to be edited;
determining content elements for video clips in the object to be clipped, wherein the content elements have corresponding content type identifications;
determining a video clip material set corresponding to the content type identification according to the first behavior tree logic;
and synthesizing to obtain a clip video according to the content elements and the video clip material sets.
The testing device for a user interface provided in this embodiment of the present application may be a server, please refer to fig. 9, fig. 9 is a structural diagram of a server 900 provided in this embodiment of the present application, and the server 900 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 922 (e.g., one or more processors) and a memory 932, and one or more storage media 930 (e.g., one or more mass storage devices) storing an application 942 or data 944. Memory 932 and storage media 930 can be, among other things, transient storage or persistent storage. The program stored on the storage medium 930 may include one or more modules (not shown), each of which may include a series of instruction operations for the server. Still further, a central processor 922 may be provided in communication with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the server 900.
The server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input-output interfaces 958, and/or one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 9.
The CPU 922 is configured to execute the following steps:
generating a test case according to the recording of the user interface test process of the target service, wherein the test case is used for identifying an action event generated in the user interface test process, and the target service responds to the action event to obtain the corresponding relation between a data state and a virtual document object model;
if the user interface of the target service is tested, the test case is obtained;
triggering the action event identified by the test case for the user interface of the target service, and acquiring a corresponding data state to be determined and a virtual document object model to be determined;
and determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for testing a user interface, the method comprising:
generating a test case according to the recording of the user interface test process of the target service, wherein the test case is used for identifying the corresponding relation among the action event, the data state and the virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event;
when the user interface of the target service is tested, the test case is obtained;
triggering the action event identified by the test case for the user interface of the target service, and acquiring a corresponding data state to be determined and a virtual document object model to be determined;
and determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
2. The method according to claim 1, wherein determining a test result according to the comparison result between the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the correspondence comprises:
according to the data state to be determined and the virtual document object model to be determined, comparing text contents with the data state determined according to the corresponding relation and the virtual document object model;
if the data state to be determined and the virtual document object model to be determined are inconsistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is abnormal;
and if the data state to be determined and the virtual document object model to be determined are consistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is normal.
3. The method of claim 1, wherein the test case comprises a plurality of action events, and the time sequence between the plurality of action events is recorded; different action events correspond to different data states and virtual document object models.
4. The method of claim 1, further comprising:
obtaining a playback request aiming at the test case;
and playing back the test case according to the recorded time sequence.
5. The method of claim 1, wherein generating the test case according to the recording of the user interface test procedure of the target service comprises:
and recording the user interface test process of the target service through the browser plug-in to generate a test case.
6. A device for testing a user interface, the device comprising a generating unit, a first acquiring unit, a second acquiring unit, and a determining unit:
the generating unit is used for generating a test case according to the recording of the user interface test process of the target service, and the test case is used for identifying the corresponding relation among the action event, the data state and the virtual document object model; the action event is generated in the user interface testing process, and the data state is obtained by the target service through responding to the action event;
the first obtaining unit is configured to obtain the test case when the user interface of the target service is tested;
the second obtaining unit is configured to trigger an action event identified by the test case for the user interface of the target service, and obtain a corresponding data state to be determined and a virtual document object model to be determined;
the determining unit is used for determining a test result according to the comparison result of the data state to be determined and the virtual document object model to be determined and the data state and the virtual document object model determined according to the corresponding relation.
7. The apparatus according to claim 6, wherein the determining unit is specifically configured to:
according to the data state to be determined and the virtual document object model to be determined, comparing text contents with the data state determined according to the corresponding relation and the virtual document object model;
if the data state to be determined and the virtual document object model to be determined are inconsistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is abnormal;
and if the data state to be determined and the virtual document object model to be determined are consistent with the text content of the data state and the virtual document object model determined according to the corresponding relation, determining that the test result is normal.
8. The apparatus of claim 6, wherein the test case comprises a plurality of action events, and a time sequence between the plurality of action events is recorded; different action events correspond to different data states and virtual document object models.
9. The apparatus according to claim 6, characterized in that the apparatus further comprises a playback unit, in particular for:
obtaining a playback request aiming at the test case;
and playing back the test case according to the recorded time sequence.
10. The apparatus according to claim 6, wherein the generating unit is specifically configured to:
and recording the user interface test process of the target service through the browser plug-in to generate a test case.
CN201910561034.0A 2019-06-26 2019-06-26 User interface testing method and device Pending CN112148579A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910561034.0A CN112148579A (en) 2019-06-26 2019-06-26 User interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910561034.0A CN112148579A (en) 2019-06-26 2019-06-26 User interface testing method and device

Publications (1)

Publication Number Publication Date
CN112148579A true CN112148579A (en) 2020-12-29

Family

ID=73869790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910561034.0A Pending CN112148579A (en) 2019-06-26 2019-06-26 User interface testing method and device

Country Status (1)

Country Link
CN (1) CN112148579A (en)

Similar Documents

Publication Publication Date Title
CN106303733B (en) Method and device for playing live special effect information
CN108845853B (en) Application program starting method and mobile terminal
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
US20210193185A1 (en) Special effect synchronization method and apparatus, and mobile terminal
CN104238893B (en) A kind of method and apparatus that video preview picture is shown
CN107368518B (en) Notification message management method, terminal and computer readable storage medium
CN109062467B (en) Split screen application switching method and device, storage medium and electronic equipment
CN103399705A (en) Method, device and equipment for remotely controlling terminal equipment
CN104298686B (en) The method and apparatus for modifying server profile
CN110413639A (en) Data check method and device, electronic equipment and computer readable storage medium
CN108572908B (en) Information feedback method and device
CN111352844B (en) Test method and related device
CN110096203B (en) Screenshot method and mobile terminal
CN104133752A (en) Monitoring method and monitoring device of operating platform
CN104765441B (en) A kind of method and apparatus that renewal of the page is realized based on eye movement
CN104166652B (en) Browse information synchronization method and device
CN106851023B (en) Method and equipment for quickly making call and mobile terminal
CN106371948B (en) A kind of data back up method and terminal device
CN112148579A (en) User interface testing method and device
CN106020945B (en) Shortcut item adding method and device
CN108920306A (en) What is managed based on memory restarts localization method, mobile terminal and readable storage medium storing program for executing
CN109495637A (en) A kind of voice control function open method and its terminal device
CN108052412A (en) Restart Fault Locating Method, mobile terminal and computer readable storage medium
CN104809055B (en) Application program testing method and device based on cloud platform
CN108572858B (en) Method and device for loading notification bar

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication