CN111949522A - User interface automatic testing method and device - Google Patents

User interface automatic testing method and device Download PDF

Info

Publication number
CN111949522A
CN111949522A CN202010756100.2A CN202010756100A CN111949522A CN 111949522 A CN111949522 A CN 111949522A CN 202010756100 A CN202010756100 A CN 202010756100A CN 111949522 A CN111949522 A CN 111949522A
Authority
CN
China
Prior art keywords
control
page
target
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.)
Granted
Application number
CN202010756100.2A
Other languages
Chinese (zh)
Other versions
CN111949522B (en
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010756100.2A priority Critical patent/CN111949522B/en
Publication of CN111949522A publication Critical patent/CN111949522A/en
Application granted granted Critical
Publication of CN111949522B publication Critical patent/CN111949522B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 OR 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/3684Test management for test design, e.g. generating new test cases

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 embodiment of the application provides a method and a device for automatically testing a user interface, which can be used in the field of Internet finance, and the method comprises the following steps: receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user; performing page test on a target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result; the method and the device can effectively improve the efficiency and accuracy of the automatic test of the user interface, and save labor and research and development cost.

Description

User interface automatic testing method and device
Technical Field
The application relates to the field of software testing, can also be used in the field of internet finance, and particularly relates to a method and a device for automatically testing a user interface.
Background
With the rapid development of computer hardware and software technologies, automated testing occupies an increasingly important position in the whole life cycle of software development. No matter Web or mobile phone software products, UI operation interfaces are presented to users, so the UI-based automated testing method is widely applied in the field of software automated testing.
The inventor finds that the automatic testing technology based on the UI in the prior art generally has the problems of high threshold and high requirement on the programming capability of testers, the UI interface changes frequently, the automatic testing script is created with more time consumption, the maintenance and change cost is high, the data is easy to change, the environment is unstable, and the like, so that the UI automatic testing cannot completely exert the advantages of machine-to-manual substitution.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides the user interface automatic test method and the user interface automatic test device, which can effectively improve the efficiency and the accuracy of the user interface automatic test, and save labor and research and development cost.
In order to solve at least one of the above problems, the present application provides the following technical solutions:
in a first aspect, the present application provides a method for automatically testing a user interface, including:
receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user;
and performing page test on the target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result.
Further, before the receiving the page test case sent by the user, the method includes:
analyzing a webpage source code of a target page, and determining each control and a control response code block corresponding to each control;
and obtaining a control search engine according to the control response code blocks of the controls.
Further, before the receiving the page test case sent by the user, the method further includes:
and generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
Further, the page testing the target page according to the target operation, the target control and the target control parameter in the page testing case to obtain a page testing result includes:
obtaining a control response code block corresponding to the target control from the control search engine according to the target control in the page test case;
and performing page test on a target page according to the control response code block, the target operation and the target control parameter to obtain a page test result.
In a second aspect, the present application provides an automated testing device for a user interface, comprising:
the test case receiving module is used for receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user;
and the target page testing module is used for carrying out page testing on the target page according to the target operation, the target control and the target control parameter in the page testing case to obtain a page testing result.
Further, still include:
the webpage source code analyzing unit is used for analyzing the webpage source codes of the target page and determining each control and a control response code block corresponding to each control;
and the control search engine construction unit is used for obtaining a control search engine according to the control response code blocks of the controls.
Further, still include:
and the test case generating unit is used for generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
Further, the target page testing module comprises:
a control response code block determining unit, configured to obtain, according to a target control in the page test case, a control response code block corresponding to the target control from the control search engine;
and the page test execution unit is used for performing page test on the target page according to the control response code block, the target operation and the target control parameter to obtain a page test result.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for automatically testing a user interface when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method for automated testing of a user interface.
According to the technical scheme, the application provides the user interface automatic test method and the device, page test cases sent by users are received, wherein the page test cases are obtained according to the preset operation classification library, the preset control search engine and target control parameters input by the users, then page tests are carried out on the target pages according to the target operation, the target control and the target control parameters in the page test cases to obtain page test results, so that the threshold of automatic tests is reduced, the time and the labor cost are saved, a business tester does not need to pay attention to programming details, only needs to list operation steps according to a manual operation process to prepare test data required by the cases, and through automatically assembling the test cases and the data, a machine is constructed and operates for multiple times to quickly cover each test scene and data branch, the test efficiency is greatly improved, and the ratio of automatic test of the UI layer machine to manual test is improved.
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 some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for automated testing of a user interface according to an embodiment of the present disclosure;
FIG. 2 is a second flowchart illustrating an automated user interface testing method according to an embodiment of the present application;
FIG. 3 is a third flowchart illustrating an automated testing method for a user interface according to an embodiment of the present application;
FIG. 4 is a block diagram of an embodiment of an apparatus for automated testing of a user interface;
FIG. 5 is a second block diagram of an exemplary embodiment of an apparatus for automated testing of a user interface;
fig. 6 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the method and the device for automatically testing the user interface disclosed by the present disclosure can be used in the financial field, and can also be used in any field except the financial field.
In consideration of the problems that the automatic test technology based on the UI in the prior art generally has high threshold and high requirement on the programming capability of testers, the UI interface changes frequently, the automatic test script is created with more time consumption, the maintenance change cost is high, the data is easy to change, the environment is unstable, and the like, so that the UI automatic test can not completely exert the advantage of machine-substituted manual operation, the application provides a user interface automatic test method and a user interface automatic test device, by receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user, then, according to the target operation, the target control and the target control parameters in the page test case, the page test is carried out on a target page to obtain a page test result, so that the threshold of the automatic test is reduced, the time and the labor cost are saved, service testers do not need to pay attention to programming details, only need to list operation steps according to a manual operation process, test data needed by the case are prepared, and through automatic assembly of the test case and the data, the machine is constructed and operates for multiple times, each test scene and data branch are quickly covered, the test efficiency is greatly improved, and the automatic test of the UI layer machine replaces the manual test.
In order to effectively improve the efficiency and accuracy of the user interface automated test and save labor and development cost, the present application provides an embodiment of a user interface automated test method, and referring to fig. 1, the user interface automated test method specifically includes the following contents:
step S101: and receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user.
It can be understood that the preset control search engine is used for extracting control keywords, creating a virtual control, analyzing an Html source code, constructing a symbolic tree, identifying and positioning tags according to a mode best matching principle by using a tag matching and keyword depth-first search algorithm, storing the tags by using a stack structure, and dynamically binding an operation with the control after the tags are positioned, so as to trigger the operation on the control.
It can be understood that the preset operation classification library is used for classifying the UI common operations, and different operation mode definitions are performed according to the label name and value of the Html control and the reaction of the operation on different controls, so as to form a control operation classification library.
Step S102: and performing page test on the target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result.
Optionally, the statements of the test case are, for example: click ("login"); the search engine analyzes a search keyword ' login ', creates a virtual control of a ' login ' button, analyzes an Html control tree, searches a label (input name ═ logic ' value ═ login >according to an optimal matching rule, records the position, positions the ' login ' control at the position, then ' click ' operation acts on the ' login ' button, the login button responds to the click action, and the manual click operation on the button is simulated, so that the click (' login ') function of the test case is completed.
From the above description, it can be known that the user interface automated testing method provided in the embodiments of the present application can receive a page test case sent by a user, where the page test case is obtained according to a preset operation classification library, a preset control search engine, and a target control parameter input by the user, then perform a page test on a target page according to a target operation, a target control, and the target control parameter in the page test case to obtain a page test result, thereby reducing a threshold of automated testing, saving time and labor cost, a business tester does not need to pay attention to programming details, only needs to list operation steps according to a manual operation process to prepare test data required by the case, and through automatic assembly of test cases and data, machine construction, multiple operations, and quick coverage of each test scenario and data branch, the test efficiency is greatly improved, and the automatic test of the UI layer machine is improved to replace the manual test.
In order to obtain a control search engine for generating a test case according to a web page source code of a target page, in an embodiment of the automated testing method for a user interface of the present application, referring to fig. 2, the following may be further included:
step S201: analyzing the webpage source code of the target page, and determining each control and a control response code block corresponding to each control.
Step S202: and obtaining a control search engine according to the control response code blocks of the controls.
Specifically, the control search engine workflow is, for example, as follows:
(1) extracting search keywords: the search engine is used as a fuzzy matching key word in searching according to the control name or label value (such as name 'login' of a login button control) transmitted by the test case and used for resolving the matching condition of the source code of the Html page.
(2) Creating a virtual control: and the page interface creates a virtual control according to the key word of the control transmitted in the previous step, the control is stored in a hash control table of the page, and the key stored in the hash table is the key word of the control and is used for instantiating the control in the subsequent step.
(3) Resolving the Html control tree: and the search engine analyzes the source code of the Html page according to the control keywords, and searches from the root node to the leaf node along the Html tree structure from the current Frame of the Html according to the set search matching mode (keywords + labels) and the depth-first search algorithm.
(4) Matching and positioning labels: when the keywords are searched, recording the current position of the keywords and the starting position of the closest tag of Html, finding the ending position of the tag according to the paired matching characteristics of the Html tag and recording, meanwhile, stacking the found tag, judging whether the tag meets the search ending condition, if not, continuing to search downwards until the keywords and the tag are positioned according to the optimal matching mode, meeting the search ending condition, ending the search process, and taking the optimal matching tag and the optimal matching position out of the stack when the keywords and the tag are positioned according to the optimal matching mode.
(5) Operation and control binding: and the page interface extracts the page control from the page control hash table according to the control keyword, and gives the control position to the control, so that a real component is constructed and positioned at the position of the component on the page. When the operation acts on the control, the operation and the control are dynamically bound according to the label property and the operation mode of the control, the operation action of the control is triggered, the control makes a corresponding response, and the operation process of the control on the Html page is completed.
In order to generate a test case according to flexibility, accuracy and pertinence, in an embodiment of the automated test method for the user interface of the present application, the following contents may be further specifically included:
and generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
In order to accurately analyze the test case sent by the user and perform a page test on the target page according to the test logic in the test case, in an embodiment of the automated test method for a user interface of the present application, referring to fig. 3, the following contents may also be specifically included:
step S301: and obtaining a control response code block corresponding to the target control from the control search engine according to the target control in the page test case.
Step S302: and performing page test on a target page according to the control response code block, the target operation and the target control parameter to obtain a page test result.
For example, the statements of the test case are: click ("login"); the search engine analyzes a search keyword ' login ', creates a virtual control of a ' login ' button, analyzes an Html control tree, searches a label (input name ═ logic ' value ═ login >according to an optimal matching rule, records the position, positions the ' login ' control at the position, then ' click ' operation acts on the ' login ' button, the login button responds to the click action, and the manual click operation on the button is simulated, so that the click (' login ') function of the test case is completed.
In order to effectively improve the efficiency and accuracy of the ui automated test and save labor and development cost, the present application provides an embodiment of a ui automated testing apparatus for implementing all or part of the ui automated testing method, and referring to fig. 4, the ui automated testing apparatus specifically includes the following components:
the test case receiving module 10 is configured to receive a page test case sent by a user, where the page test case is obtained according to a preset operation classification library, a preset control search engine, and a target control parameter input by the user.
And the target page testing module 20 is configured to perform a page test on the target page according to the target operation, the target control and the target control parameter in the page test case, so as to obtain a page test result.
From the above description, the user interface automated testing apparatus provided in the embodiment of the present application can receive a page test case sent by a user, where the page test case is obtained according to a preset operation classification library, a preset control search engine, and a target control parameter input by the user, and then, according to a target operation, a target control, and the target control parameter in the page test case, a page test is performed on a target page to obtain a page test result, so as to reduce the threshold of automated testing, save time and labor cost, a business tester does not need to pay attention to programming details, only needs to list operation steps according to a manual operation process to prepare test data required by the case, and through automatically assembling the test case and the data, machine construction and multiple operations are performed to quickly cover each test scenario and data branch, the test efficiency is greatly improved, and the automatic test of the UI layer machine is improved to replace the manual test.
In order to obtain a control search engine for generating a test case according to a web page source code of a target page, in an embodiment of the automated testing apparatus for a user interface of the present application, the following contents are further specifically included:
and the webpage source code analyzing unit is used for analyzing the webpage source codes of the target page and determining each control and a control response code block corresponding to each control.
And the control search engine construction unit is used for obtaining a control search engine according to the control response code blocks of the controls.
In order to generate a test case according to a flexible, accurate and targeted manner, in an embodiment of the automated testing apparatus for a user interface of the present application, the following contents are further specifically included:
and the test case generating unit is used for generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
In order to accurately analyze a test case sent by a user and perform a page test on a target page according to a test logic in the test case, in an embodiment of the automated testing apparatus for a user interface according to the present application, referring to fig. 5, the target page testing module 20 includes:
and the control response code block determining unit 21 is configured to obtain, according to a target control in the page test case, a control response code block corresponding to the target control from the control search engine.
And the page test execution unit 22 is configured to perform a page test on the target page according to the control response code block, the target operation, and the target control parameter, so as to obtain a page test result.
To further illustrate the present disclosure, the present application further provides a specific application example of the method for implementing the automatic test of the user interface by using the above-mentioned automatic test device of the user interface, which specifically includes the following contents: the system comprises a driving layer, a processing layer, a service layer and an application layer.
And the Webdriver of the driver layer provides browser driver to interact with the browser.
The treatment layer includes: the search engine and the operation library are two core processing components.
The case class and the page class of the service layer are provided for an upper application layer to be directly used; the tool type realizes the unified management of the test tool, the data type realizes the data loading and analysis, and the configuration type realizes the flexible configuration of the page and the data, so that the data is separated from the code.
Specifically, 1, drive layer: the WebDriver component encapsulates the native API of the browser and supports IE, Firefox and Chrome browsers. The Selenium engine drives the browser to open and close, and clicks, inputs, selects and the like on a browser webpage or a mobile phone.
2. And (3) treatment layer: the method comprises the steps of extracting control keywords by a search engine, creating a virtual control, analyzing an Html source code, constructing a symbolic tree, identifying and positioning a label according to a mode best matching principle by using a label matching and keyword depth-first search algorithm, storing the label by adopting a stack structure, and dynamically binding an operation and the control after the label is positioned, so that the operation on the control is triggered.
The search engine workflow is detailed as follows:
(1) extracting search keywords: the search engine is used as a fuzzy matching key word in searching according to the control name or label value (such as name 'login' of a login button control) transmitted by the test case and used for resolving the matching condition of the source code of the Html page.
(2) Creating a virtual control: and the page interface creates a virtual control according to the key word of the control transmitted in the previous step, the control is stored in a hash control table of the page, and the key stored in the hash table is the key word of the control and is used for instantiating the control in the subsequent step.
(3) Resolving the Html control tree: and the search engine analyzes the source code of the Html page according to the control keywords, and searches from the root node to the leaf node along the Html tree structure from the current Frame of the Html according to the set search matching mode (keywords + labels) and the depth-first search algorithm.
(4) Matching and positioning labels: when the keywords are searched, recording the current position of the keywords and the starting position of the closest tag of Html, finding the ending position of the tag according to the paired matching characteristics of the Html tag and recording, meanwhile, stacking the found tag, judging whether the tag meets the search ending condition, if not, continuing to search downwards until the keywords and the tag are positioned according to the optimal matching mode, meeting the search ending condition, ending the search process, and taking the optimal matching tag and the optimal matching position out of the stack when the keywords and the tag are positioned according to the optimal matching mode.
(5) Operation and control binding: and the page interface extracts the page control from the page control hash table according to the control keyword, and gives the control position to the control, so that a real component is constructed and positioned at the position of the component on the page. When the operation acts on the control, the operation and the control are dynamically bound according to the label property and the operation mode of the control, the operation action of the control is triggered, the control makes a corresponding response, and the operation process of the control on the Html page is completed.
The example briefly illustrates the process as follows: test case statements: click ("login"); the search engine analyzes a search keyword ' login ', creates a virtual control of a ' login ' button, analyzes an Html control tree, searches a label (input name ═ logic ' value ═ login >according to an optimal matching rule, records the position, positions the ' login ' control at the position, then ' click ' operation acts on the ' login ' button, the login button responds to the click action, and the manual click operation on the button is simulated, so that the click (' login ') function of the test case is completed.
And classifying the common UI operations by the operation library, and defining different operation modes according to the label names and values of the Html controls and the reactions of the operations on different controls to form the operation library of the controls.
When the operation library is used, according to the characteristics of the Html control, the characteristics of clicking, inputting, selecting and the like are kept consistent with the manual operation on the control, no additional memory is needed, the grammar is close to natural language, and the format is as follows: operations ("objects"). Such as: clicking the 'login' button, using the 'click' operation in the operation library, wherein the acting object is the 'login' button, and the statement of writing the case is as follows: click ("login"); inputting a user name, namely inputting the user name by using the operation in the operation library, wherein the acting object is the user name, the input user name is Zhang III, and the statement of the writing case is as follows: enter ("username", "zhang san");
3. and (3) a service layer: the tool class realizes the unified management of the test tools and provides tool sets of log record, database processing, XML file analysis, character string processing and the like; the data class realizes the loading and analysis of test data and supports the format customization and dynamic loading of XML data files, Config files and page files; the configuration class realizes page and flexible data configuration (see fig. 4), and data and codes are managed separately to realize decoupling; the page class corresponds to a Web page of the Html, is dynamically created by a page factory when in use, is automatically destroyed after being used, saves the memory, and encapsulates the basic operation of all page controls for the case class to use; the case class is a test case base class provided by the service layer for the application layer to use, and encapsulates environment detection, common operation processing, initialization loading and cleaning operation after case execution of test case execution, so that when an upper layer user compiles an automatic test case, the upper layer user does not need to pay attention to bottom layer implementation details, and does not need to process environment factors depending on test case execution and common processing before and after case execution.
4. An application layer: is a layer for automatic testers to write test cases. The test case adopts a near-natural language writing mode, is consistent with the actual manual operation steps, does not require the programming capability of a tester, only needs the tester to pay attention to the core test scene design, and lists the operation process according to the manual operation steps. Such as: verifying one: the method comprises the following steps of (1) testing a test scene for approval of a merchant file, wherein the basic testing step of the scene is as follows: inquiring a certain merchant file to be examined- > checking details of the merchant file- > clicking through- > filling examination and approval opinion- > submitting- > verifying examination and approval result- > returning.
According to the method and the device, the threshold of automatic testing is reduced, and time and labor cost are saved. The service tester does not need to pay attention to programming details, only needs to list operation steps according to a manual operation process, prepares test data required by a case, can automatically assemble the test case and the data by a tool, constructs a machine, runs for multiple times, quickly covers each test scene and data branch, greatly improves the test efficiency, and improves the proportion of replacing manual test by automatic test of a UI layer machine.
In order to effectively improve efficiency and accuracy of an automated user interface test and save labor and development cost in a hardware level, the present application provides an embodiment of an electronic device for implementing all or part of contents in the automated user interface test method, where the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the user interface automatic testing device and relevant equipment such as a core service system, a user terminal, a relevant database and the like; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the logic controller may be implemented with reference to the embodiment of the method for automatically testing a user interface and the embodiment of the apparatus for automatically testing a user interface in the embodiments, which are incorporated herein, and repeated details are not repeated herein.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), an in-vehicle device, a smart wearable device, and the like. Wherein, intelligence wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the automated testing method for the user interface may be performed on the electronic device side as described above, or all operations may be performed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. The client device may further include a processor if all operations are performed in the client device.
The client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
Fig. 6 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 6, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this FIG. 6 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the ui automation test method function may be integrated into the cpu 9100. The central processor 9100 may be configured to control as follows:
step S101: and receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user.
Step S102: and performing page test on the target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result.
As can be seen from the above description, the electronic device provided in the embodiment of the present application receives a page test case sent by a user, where the page test case is obtained according to a preset operation classification library, a preset control search engine, and target control parameters input by the user, and then performs a page test on a target page according to target operations, target controls, and the target control parameters in the page test case to obtain a page test result, so as to reduce the threshold of automatic testing, save time and labor cost, a business tester does not need to pay attention to programming details, only needs to list operation steps according to a manual operation process, prepares test data required by the case, and quickly covers each test scenario and data branch by automatically assembling test cases and data, building a machine, and operating for multiple times, thereby greatly improving test efficiency, automatic test of the UI layer machine is promoted to replace manual test.
In another embodiment, the ui automatic test apparatus may be configured separately from the cpu 9100, for example, the ui automatic test apparatus may be configured as a chip connected to the cpu 9100, and the function of the ui automatic test method may be implemented by the control of the cpu.
As shown in fig. 6, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 6; further, the electronic device 9600 may further include components not shown in fig. 6, which may be referred to in the art.
As shown in fig. 6, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
An embodiment of the present application further provides a computer-readable storage medium capable of implementing all steps in the method for automatically testing a user interface with an execution subject being a server or a client in the foregoing embodiments, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all steps of the method for automatically testing a user interface with an execution subject being a server or a client in the foregoing embodiments, for example, when the processor executes the computer program, the processor implements the following steps:
step S101: and receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user.
Step S102: and performing page test on the target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result.
As can be seen from the above description, the computer-readable storage medium provided in the embodiments of the present application receives a page test case sent by a user, where the page test case is obtained according to a preset operation classification library, a preset control search engine, and a target control parameter input by the user, and then performs a page test on a target page according to a target operation, a target control, and the target control parameter in the page test case to obtain a page test result, so as to reduce a threshold of an automatic test, save time and labor cost, a business tester does not need to pay attention to a programming detail, only needs to list operation steps according to a manual operation process, prepares test data required by the case, and quickly covers each test scenario and data branch by automatically assembling the test case and the data, building a machine, and repeatedly operating the machine, thereby greatly improving test efficiency, automatic test of the UI layer machine is promoted to replace manual test.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for automated testing of a user interface, the method comprising:
receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user;
and performing page test on the target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result.
2. The method for automatically testing the user interface according to claim 1, before the receiving the page test case sent by the user, comprising:
analyzing a webpage source code of a target page, and determining each control and a control response code block corresponding to each control;
and obtaining a control search engine according to the control response code blocks of the controls.
3. The method for automated testing of user interfaces according to claim 1, further comprising, prior to receiving the test case of the page sent by the user:
and generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
4. The method for automatically testing a user interface according to claim 1, wherein the step of performing a page test on a target page according to the target operation, the target control and the target control parameter in the page test case to obtain a page test result comprises:
obtaining a control response code block corresponding to the target control from the control search engine according to the target control in the page test case;
and performing page test on a target page according to the control response code block, the target operation and the target control parameter to obtain a page test result.
5. A user interface automated testing apparatus, comprising:
the test case receiving module is used for receiving a page test case sent by a user, wherein the page test case is obtained according to a preset operation classification library, a preset control search engine and target control parameters input by the user;
and the target page testing module is used for carrying out page testing on the target page according to the target operation, the target control and the target control parameter in the page testing case to obtain a page testing result.
6. The user interface automated testing apparatus of claim 5, further comprising:
the webpage source code analyzing unit is used for analyzing the webpage source codes of the target page and determining each control and a control response code block corresponding to each control;
and the control search engine construction unit is used for obtaining a control search engine according to the control response code blocks of the controls.
7. The user interface automated testing apparatus of claim 5, further comprising:
and the test case generating unit is used for generating a page test case according to a selection instruction of the target operation in the preset operation classification library, a selection instruction of the target control in the preset control search engine and the target control parameter sent by the user.
8. The UI automation test device of claim 5 wherein the target page test module comprises:
a control response code block determining unit, configured to obtain, according to a target control in the page test case, a control response code block corresponding to the target control from the control search engine;
and the page test execution unit is used for performing page test on the target page according to the control response code block, the target operation and the target control parameter to obtain a page test result.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method for automated testing of a user interface according to any of claims 1 to 4 are performed when the program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method for automated testing of a user interface according to any one of claims 1 to 4.
CN202010756100.2A 2020-07-31 2020-07-31 Automatic testing method and device for user interface Active CN111949522B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010756100.2A CN111949522B (en) 2020-07-31 2020-07-31 Automatic testing method and device for user interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010756100.2A CN111949522B (en) 2020-07-31 2020-07-31 Automatic testing method and device for user interface

Publications (2)

Publication Number Publication Date
CN111949522A true CN111949522A (en) 2020-11-17
CN111949522B CN111949522B (en) 2024-05-03

Family

ID=73338864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010756100.2A Active CN111949522B (en) 2020-07-31 2020-07-31 Automatic testing method and device for user interface

Country Status (1)

Country Link
CN (1) CN111949522B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597053A (en) * 2020-12-30 2021-04-02 中国工商银行股份有限公司 User interface automatic testing method and device with safety control
CN112817582A (en) * 2021-03-05 2021-05-18 网易(杭州)网络有限公司 Code processing method and device, computer equipment and storage medium
CN113238969A (en) * 2021-06-23 2021-08-10 中国农业银行股份有限公司 Interface automation test method, device, equipment and storage medium
CN113791786A (en) * 2021-09-23 2021-12-14 安然 APP page control automation method and device based on IOS system
CN115373965A (en) * 2022-10-25 2022-11-22 中汽信息科技(天津)有限公司 User label identification method and device based on stack technology

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389407A (en) * 2014-08-21 2016-03-09 波音公司 integrated visualization and analysis of a complex system
CN105808417A (en) * 2014-12-29 2016-07-27 平安科技(深圳)有限公司 Automated testing method and proxy server
CN105893586A (en) * 2016-04-06 2016-08-24 中国建设银行股份有限公司 Method for automatically generating dynamic page based on integration rules
CN107729230A (en) * 2017-09-18 2018-02-23 郑州云海信息技术有限公司 A kind of WEB automatic test devices and method of testing based under control scheme
US20180173606A1 (en) * 2016-12-15 2018-06-21 Syntel, Inc. Hybrid testing automation engine
CN109783388A (en) * 2019-01-16 2019-05-21 北京金山云网络技术有限公司 UI automated testing method, device and electronic equipment
CN110688103A (en) * 2019-10-10 2020-01-14 北京东软望海科技有限公司 Code writing method and device, electronic equipment and computer readable storage medium
CN111124919A (en) * 2019-12-24 2020-05-08 浙江诺诺网络科技有限公司 User interface testing method, device, equipment and storage medium
CN111427577A (en) * 2020-04-27 2020-07-17 北京每日优鲜电子商务有限公司 Code processing method and device and server

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389407A (en) * 2014-08-21 2016-03-09 波音公司 integrated visualization and analysis of a complex system
CN105808417A (en) * 2014-12-29 2016-07-27 平安科技(深圳)有限公司 Automated testing method and proxy server
CN105893586A (en) * 2016-04-06 2016-08-24 中国建设银行股份有限公司 Method for automatically generating dynamic page based on integration rules
US20180173606A1 (en) * 2016-12-15 2018-06-21 Syntel, Inc. Hybrid testing automation engine
CN107729230A (en) * 2017-09-18 2018-02-23 郑州云海信息技术有限公司 A kind of WEB automatic test devices and method of testing based under control scheme
CN109783388A (en) * 2019-01-16 2019-05-21 北京金山云网络技术有限公司 UI automated testing method, device and electronic equipment
CN110688103A (en) * 2019-10-10 2020-01-14 北京东软望海科技有限公司 Code writing method and device, electronic equipment and computer readable storage medium
CN111124919A (en) * 2019-12-24 2020-05-08 浙江诺诺网络科技有限公司 User interface testing method, device, equipment and storage medium
CN111427577A (en) * 2020-04-27 2020-07-17 北京每日优鲜电子商务有限公司 Code processing method and device and server

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597053A (en) * 2020-12-30 2021-04-02 中国工商银行股份有限公司 User interface automatic testing method and device with safety control
CN112817582A (en) * 2021-03-05 2021-05-18 网易(杭州)网络有限公司 Code processing method and device, computer equipment and storage medium
CN112817582B (en) * 2021-03-05 2023-08-08 网易(杭州)网络有限公司 Code processing method, device, computer equipment and storage medium
CN113238969A (en) * 2021-06-23 2021-08-10 中国农业银行股份有限公司 Interface automation test method, device, equipment and storage medium
CN113238969B (en) * 2021-06-23 2024-02-23 中国农业银行股份有限公司 Interface automation test method, device, equipment and storage medium
CN113791786A (en) * 2021-09-23 2021-12-14 安然 APP page control automation method and device based on IOS system
CN113791786B (en) * 2021-09-23 2024-01-19 安然 APP page control automation method and device based on IOS system
CN115373965A (en) * 2022-10-25 2022-11-22 中汽信息科技(天津)有限公司 User label identification method and device based on stack technology

Also Published As

Publication number Publication date
CN111949522B (en) 2024-05-03

Similar Documents

Publication Publication Date Title
CN111949522B (en) Automatic testing method and device for user interface
CN110018955B (en) Generating automated test scripts by transforming manual test cases
US10394925B2 (en) Automating web tasks based on web browsing histories and user actions
US10656907B2 (en) Translation of natural language into user interface actions
US11093510B2 (en) Relevance ranking of productivity features for determined context
CN104699604A (en) Method and device for testing Android application on basis of customized rendering engine
CN111338925A (en) Applet test method, device and system, electronic equipment and storage medium
CN109872230B (en) Test method and device of financial data analysis system, medium and electronic equipment
CN114036439A (en) Website building method, device, medium and electronic equipment
CN113032257A (en) Automatic test method, device, computer system and readable storage medium
US20220198153A1 (en) Model training
CN112785284B (en) Message warehousing method and device based on structured document
CN112269739B (en) Webpage testing method and device, equipment and medium thereof
CN117873486A (en) Front-end and back-end code automatic generation method, device, equipment and storage medium
CN110399305B (en) BTT module testing method and device
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN113076262B (en) Webpage automatic testing method and device
WO2014139085A1 (en) Identifying transport-level encoded payloads
WO2023115831A1 (en) Application testing method and apparatus, electronic device and storage medium
US11868907B2 (en) Updating chatbot workspaces
CN116010280A (en) Automatic testing method, device, equipment and medium based on natural language
CN114741294A (en) Page debugging method, device, equipment and storage medium
US11562121B2 (en) AI driven content correction built on personas
CN114297057A (en) Design and use method of automatic test case
CN114048134A (en) Automatic testing method and device based on POM and data driving

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
GR01 Patent grant
GR01 Patent grant