WO2022237826A1 - 用户界面的测试方法、系统、集群、介质及程序产品 - Google Patents

用户界面的测试方法、系统、集群、介质及程序产品 Download PDF

Info

Publication number
WO2022237826A1
WO2022237826A1 PCT/CN2022/092154 CN2022092154W WO2022237826A1 WO 2022237826 A1 WO2022237826 A1 WO 2022237826A1 CN 2022092154 W CN2022092154 W CN 2022092154W WO 2022237826 A1 WO2022237826 A1 WO 2022237826A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
clients
different types
user interface
testing
Prior art date
Application number
PCT/CN2022/092154
Other languages
English (en)
French (fr)
Inventor
盛钟
王祥强
李�杰
Original Assignee
华为云计算技术有限公司
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 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2022237826A1 publication Critical patent/WO2022237826A1/zh

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/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • 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

Definitions

  • the present application relates to the technical field of software testing, and in particular to a user interface testing method, system, cluster, computer-readable storage medium and computer program product.
  • an Internet service provider may provide web pages (web) and application (APP) programs for Internet software products.
  • web page can be presented to the user through a general web client such as a browser (desktop browser, mobile browser), and the APP program is a dedicated client, which can usually be divided into different types based on the operating system supporting the APP program.
  • the same software may include multiple versions such as Android version and iOS version.
  • UI automation testing tools are proposed in the industry, such as Selenium, a tool for web page testing, and Appium, a tool for app testing.
  • test case writing methods of different client types are not uniform, and the application programming interface (application programming interface, API) used is also different.
  • API application programming interface
  • This application provides a UI testing method.
  • This method abstracts a unified interface test API for different types of clients, so that testers can use the unified interface test API to write test cases for different client types, unifies and simplifies the method of writing test cases, and improves the writing efficiency of test cases , thus improving the testing efficiency of the UI.
  • the application also greatly reduces the cost of writing automated test cases on different clients, saving test costs.
  • the present application also provides a UI testing system corresponding to the above method, a computer cluster, a computer-readable storage medium, and a computer program product.
  • the present application provides a UI testing method.
  • This method can be applied to the testing system of UI.
  • the UI testing system may be a software system, and the software system may be deployed in a computer cluster including at least one computer.
  • the computer cluster runs the software system to realize unified UI automation testing of multiple types of clients.
  • the UI test system can provide the same interface test API for different types of clients. Users (for example, testers) can write test cases for different types of clients based on the interface test API.
  • the UI test system receives the above-mentioned different types of clients. Test cases of the client, and then execute the test cases of different types of clients, so as to realize the testing of the UI of different types of clients.
  • This method abstracts a unified interface test API for different types of clients, so that testers can use the unified interface test API to write test cases for different client types, unifies and simplifies the method of writing test cases, and improves the writing efficiency of test cases , thus improving the testing efficiency of the UI.
  • the embodiment of the present application also greatly reduces the cost of writing automated test cases on different clients, saving the test cost.
  • the interface testing API is applied to multiple platforms.
  • testers need to test UIs of different platforms (different types)
  • they can write test cases based on the above-mentioned interface test API without rewriting the implementation code of the test case based on the same set of implementation code without considering platform differences.
  • the multiple platforms include a webpage platform and an application platform.
  • the webpage platform may be a webpage client such as a web browser.
  • the webpage platform may also include a mobile webpage platform and a desktop webpage platform.
  • the application platform may be an application (application, APP) client.
  • APP clients include e-mail clients, instant messaging clients, e-commerce clients, or game clients and other dedicated clients. Clients that provide the same service can also be categorized by the type of device running the client or the type of operating system on the device. For example, for an email client, the developer can usually publish versions for different operating systems in the application market, so that users can choose the corresponding version according to the operating system of their respective devices.
  • the method realizes writing test cases corresponding to UIs of different platforms in a unified way through the unified interface test API of different platforms, and has better adaptability to different platforms, and meets the testing requirements.
  • the UI testing system may first confirm the client type when testing, and then select and call corresponding services based on the client type to test the UI. For example, the UI testing system can confirm that the client type is a webpage client, such as a web browser, and then call Selenium services (services for testing webpages) according to the interface test API to test the UI.
  • the client type is a webpage client, such as a web browser
  • Selenium services services for testing webpages
  • the UI testing system may first confirm the client type when testing, and then select and call corresponding services based on the client type to test the UI. For example, the UI test system can confirm that the client type is an APP client, and then call the Appium service according to the interface test API to test the user interface.
  • the original test framework such as Appium only supports the test of a specific type of UI.
  • there is no need to make major changes to the original test framework which saves costs.
  • abnormal situations may also occur, for example, abnormal operations on UI controls may occur.
  • the UI testing system can detect the abnormal type, and then adjust the waiting time according to the abnormal type, so as to complete the operation on the user interface control.
  • this application improves the success rate of control operations through intelligent waiting, thereby improving the test efficiency and test quality.
  • the exception type includes: the UI control has not been loaded completely, or the UI control has been loaded and the associated data of the UI control has not been loaded completely.
  • the UI control has not been loaded and can be further divided into the following situations: (1) The UI control fails to be searched on the page, and the UI control cannot be operated; (2) the UI control is successfully searched on the page, but the UI control cannot be operated on Actions such as UI controls appear on the page but are grayed out.
  • the above UI testing method can realize intelligent waiting in various abnormal situations, and execute the test case after the abnormality is recovered. In this way, efficient and stable UI testing can be realized.
  • the present application provides a UI testing system.
  • the system includes:
  • the interface unit is used to provide the same interface test API for different types of clients
  • the communication unit is used to receive the test cases of different types of clients, and the test cases of the different types of clients are written based on the same interface test API;
  • the test unit is configured to execute the test cases of the different types of clients, so as to test the user interfaces of the different types of clients.
  • the interface testing API is applied to multiple platforms.
  • the multiple platforms include a webpage platform and an application platform.
  • test unit is specifically used for:
  • test unit is specifically used for:
  • test unit is specifically used for:
  • the waiting time is adjusted to complete the operation on the user interface control.
  • the exception type includes: the UI control has not been loaded completely, or the UI control has been loaded and the associated data of the user interface control has not been loaded completely.
  • the present application provides a computer cluster.
  • the computer cluster includes at least one computer, the computer includes a processor and a memory, computer-readable instructions are stored in the memory, and the processor executes the computer-readable instructions to perform the first aspect or the second aspect.
  • a testing method for a user interface in any one of the implementation manners of an aspect.
  • the present application provides a computer-readable storage medium, where an instruction is stored in the computer-readable storage medium, and the instruction instructs the device to execute the method described in the first aspect or any implementation manner of the first aspect. How to test the user interface.
  • the present application provides a computer program product containing instructions, which, when run on a device, causes the device to execute the user interface testing method described in the first aspect or any implementation of the first aspect .
  • FIG. 1 is a system architecture diagram of a computer cluster provided by an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a UI testing system provided by an embodiment of the present application.
  • Fig. 3 is a flow chart of a UI testing method provided by the embodiment of the present application.
  • FIG. 4 is a schematic diagram of a cloud service purchase interface provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a cloud service purchase interface provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of an order management interface provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a computer cluster provided by an embodiment of the present application.
  • first and second in the embodiments of the present application are used for description purposes only, and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Thus, a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features.
  • Web page an information carrier created by hypertext markup language (HTML) and capable of being interpreted or translated by a browser.
  • the information carrier can carry any one or more of multimedia information such as text, picture, sound, and video.
  • the web pages may include official web pages of various organizations or web pages of information management systems.
  • Client A program that provides local services to clients.
  • the client can also be called the client, and the client can run independently on the local device, or cooperate with the server on the remote server.
  • Clients can be classified into general web clients (such as browsers) and dedicated APP clients.
  • the general web client can realize different functions through different web pages, such as e-mail, e-commerce and other functions
  • the dedicated APP client includes e-mail client, instant messaging client, e-commerce client or game client, etc. Wait.
  • the clients providing the same service may also be classified according to the type of the device running the client or the type of the operating system on the device. For example, for an email client, the developer can usually publish versions for different operating systems in the application market, so that users can choose the corresponding version according to the operating system of their respective devices.
  • Test framework An infrastructure software built to provide an execution environment for automated test cases or scripts.
  • the testing framework provides a rich set of components to aid in software testing.
  • the test framework provides log management components, test report generation and management components, test case management components, test data management components, and so on.
  • UI automation testing tools have been proposed in the industry, such as Selenium, a tool for web page testing, and Appium, a tool for APP client testing.
  • Selenium a tool for web page testing
  • Appium a tool for APP client testing.
  • test cases of different client types for example, when writing test cases of web type and app type, it is necessary to integrate different test frameworks for development.
  • the test case writing methods of different client types are not uniform, and the application programming interface APIs used are also different.
  • the same business scenario usually requires writing multiple codes, and the writing efficiency of test cases is low, which greatly affects the UI. Test efficiency.
  • the embodiment of the present application provides a UI testing method.
  • This method can be applied to the testing system of UI.
  • the UI testing system may be a software system, and the software system may be deployed in a computer cluster including at least one computer.
  • the computer cluster runs the software system to realize unified UI automation testing of multiple types of clients.
  • the UI test system can provide the same interface test API for different types of clients. Users (for example, testers) can write test cases for different types of clients based on the interface test API.
  • the UI test system receives the above-mentioned different types of clients. Test cases of the client, and then execute the test cases of different types of clients, so as to realize the testing of the UI of different types of clients.
  • the embodiment of the present application abstracts a unified interface test API for different types of clients, so that testers can use the unified interface test API to write test cases for different client types, unify and simplify the use case writing method, and improve the efficiency of test cases. Writing efficiency, which in turn improves UI testing efficiency. Moreover, the embodiment of the present application also greatly reduces the cost of writing automated test cases on different clients, saving the test cost.
  • FIG. 1 is a schematic diagram of a system architecture of a computer cluster according to an embodiment of the present application.
  • the computer cluster 100 includes a server 110 and a terminal 120 , and the server 110 and the terminal 120 are connected through a network 130 .
  • Server 110 may be a cloud server in a cloud environment. Wherein, the cloud environment indicates a computing cluster owned by a cloud service provider for providing computing, storage, and communication resources.
  • Server 110 may also be a local server in a local data center.
  • the local data center refers to the data center to which the user, such as the tester, belongs.
  • the terminal 120 may be a desktop computer, a notebook computer, a tablet computer or other devices. The tester can interact with the server 110 through the terminal 120, so as to implement a unified test on UIs of different types of clients.
  • the server 110 includes hardware resources and software resources.
  • Hardware resources include network cards, processors, memories, etc., common hardware devices for servers.
  • the processor may include at least one of a central processing unit (central processing unit, CPU) and a graphics processing unit (graphics processing unit, GPU).
  • a server may include at least one CPU and at least one GPU.
  • Figure 1 illustrates an example with a server including a CPU and a GPU.
  • Software resources include server operating systems and UI testing systems.
  • the server operating system is used to directly control, manage and coordinate the hardware devices of the server 110 and the software deployed in the server 110 .
  • the UI testing system runs on the server operating system and is used for uniform testing of UIs of different types of clients.
  • different types of clients include at least one of web clients and APP clients.
  • the UI of the web client includes web pages.
  • the UI of the APP client includes a login page, a main page, a details page, a configuration page, and the like of the APP client.
  • the web client can be divided into a mobile web client and a personal computer (personal computer, PC) web client according to the device where the client is located.
  • APP clients can be divided into different types according to the device on which the client is located (or the operating system on the device).
  • FIG. 2 is a schematic structural diagram of a UI test system according to an embodiment of the present application.
  • the UI test system 200 includes an interface unit 202 , a communication unit 204 and a test unit 206 . The functions of each unit are described below.
  • the interface unit 202 is used for providing the same interface testing API for different types of clients.
  • the interface test API includes an API corresponding to a control operation method in the control operation layer.
  • the control operation layer encapsulates the control operation method corresponding to the operation class of the UI control.
  • the UI control refers to a control used to generate a UI, including but not limited to a selection control, an input control, a submission control, and the like.
  • the operation class may specifically include abstract classes for operations such as clicking (clicking, double-clicking, etc.), selecting, and the like.
  • the operation class can be instantiated to generate corresponding control operation methods.
  • the operation method of the control is unified with respect to different types of clients (such as mobile web clients, PC web clients, or APP clients based on specific operating systems).
  • the communication unit 204 is used for receiving test cases of different types of clients.
  • the test cases of different types of clients may be written by users (for example, testers) based on the same interface test API.
  • the testing unit 204 is configured to execute the test cases of the above-mentioned different types of clients, so as to realize the testing of user interfaces of different types of clients. In this way, integrated testing of different types of clients, such as UIs of web clients and APP clients, can be realized.
  • the interface testing API can be applied to multiple platforms, such as a webpage platform and an application platform, so as to implement UI testing on corresponding types of clients. In some possible implementation manners, the interface testing API can also be applied to other platforms, so as to implement UI testing on other types of clients.
  • the interface unit 202 also provides APIs of corresponding operation methods for different platforms.
  • the interface unit 202 also includes a platform operation layer, for example including a web page platform operation layer and an application platform operation layer.
  • the webpage platform operation layer encapsulates the operation method of the web client such as a browser based on the Selenium service
  • the application platform operation layer encapsulates the operation method of the APP client based on the Appium service.
  • the operation method of the APP client also includes a device connection management method, which is used to manage the connection of the device on which the APP client is deployed, such as a mobile phone.
  • the API of the control operation layer can call the API of the platform operation layer to form an API call chain, and realize the test of the UI of the corresponding type of client through the API call chain.
  • the interface unit 202 also provides corresponding drivers for applications corresponding to different operating system types.
  • the application platform includes a first application platform and a second application platform, and the first application platform and the second application platform correspond to different types of operating systems.
  • the interface unit 202 also includes a first application platform driver layer and a second application platform driver layer.
  • the first application platform driver layer includes the driver of the first application platform
  • the second application platform driver layer includes the driver of the second application platform.
  • platform operation layer is not limited to the above-mentioned web page platform operation layer and application platform operation layer, and can also support more other platforms.
  • the interface unit 202 may also provide APIs for general operations.
  • the interface unit 202 also includes a base layer, which is encapsulated with general operation methods, such as hypertext transfer protocol (hyper text transfer protocol, HTTP) request, simulation (mock) operation or database operation and other general operation methods.
  • the base layer provides APIs for the above-mentioned common operation methods, so as to call the above-mentioned APIs for testing.
  • the base layer can also realize the unified scheduling of test cases.
  • the unified scheduling of test cases is specifically to perform the same processing on different test cases.
  • public pre-conditions or public post-processing are added for different test cases.
  • the public pre-conditions may be, for example, setting environment variables, and the public post-processing may be, for example, data cleaning and information collection.
  • the base layer, control operation layer, and platform operation layer provided by the interface unit 202 can form a test framework integrating the web client and the APP client.
  • the integrated testing framework can provide Selenium service and Appium service.
  • the test unit 206 can confirm the client type when executing test cases of different types of clients.
  • the client type is a web client
  • the Selenium service is invoked according to the interface test API to test the UI.
  • the client type is an application client, call the Appium service to perform UI testing according to the interface test API.
  • the method includes:
  • the UI testing system provides the same interface testing API for different types of clients.
  • clients can be divided into general web clients and dedicated APP clients based on the degree of versatility.
  • web clients can also be divided into mobile web clients and PC web clients based on applicable equipment
  • APP clients can also be divided into desktop clients and embedded clients based on applicable equipment (specifically, the operating system in the equipment).
  • the embedded client may include clients corresponding to different embedded operating systems.
  • the UI test system is based on an integrated test framework and provides the same interface test API for testers to write test cases based on the above interface test API.
  • the integrated test framework includes a control operation layer, and the control operation layer encapsulates the control operation method corresponding to the operation class of the UI control.
  • the control operation layer can expose the API of the control operation method corresponding to the operation class of the above UI control, that is, the interface test API.
  • control operation methods encapsulated in the control operation layer are abstracted based on methods encapsulated by testing frameworks such as Selenium and Appium, based on this, the APIs exposed by the control operation layer, such as the interface test API, are the same for different types of clients.
  • S304 The UI test system receives test cases of different types of clients.
  • Test cases for different types of clients may be written by users (for example, testers) based on the same interface test API described in S302. Specifically, for different types of clients, users can write implementation codes of test cases through the same interface test API. For example, when the UI includes click controls, the user can use the clickElement() method; when the UI includes text input controls, the user can use the inputText() method; when the UI includes waiting for elements to load controls, the user can use the waitElementAppear() method.
  • the embodiment of the present application is also illustrated by using a test case of a login page of a certain website as an example.
  • test cases corresponding to the login page of the PC web client such as the PC browser when logging in to the website are as follows:
  • test case corresponding to the login page of the mobile web client such as the mobile browser when logging in to the website is as follows:
  • the implementation code mainly includes the call of the interface test API, and the calling methods of the interface test API on different platforms or different types of clients can be consistent .
  • the main difference between the implementation codes of test cases corresponding to different clients lies in information such as class names and test case names. Therefore, after a user such as a tester writes a test case for a client type, he can fine-tune the written test case to obtain test cases for other types of clients.
  • the UI testing system executes the test cases of the different types of clients, so as to implement the testing of the user interfaces of the different types of clients.
  • the UI test system provides an execution environment for test cases of different types of clients, and the UI test system can execute test cases of different types of clients in the execution environment, thereby realizing the testing of UIs of different types of clients.
  • the UI test system can also detect the abnormal type when the operation of the UI control is abnormal.
  • the exception type may include the following types: (1) UI control has not been loaded completely; (2) UI control has been loaded and the associated data of the UI control has not been loaded completely.
  • the UI control has not been loaded can include many situations, one situation is that the UI control has not been displayed on the page, and the other situation is that the UI control is displayed on the page, but is in an unavailable state (for example, a grayed state).
  • the UI testing system can adjust the waiting time according to the above exception type to complete the operation on the user interface control. In this way, the problem of unstable operation methods of test frameworks such as Selenium and Appium is solved, and the success rate of control operations is improved, thereby improving test quality and test efficiency.
  • the first abnormal situation the UI control is not loaded, specifically, the UI control fails to be searched on the page, and the UI control cannot be operated.
  • the interface 400 displays area controls, but controls such as "billing mode” and "purchase duration” are not displayed.
  • the UI testing system of the embodiment of the present application detects the first abnormal situation, such as when controls such as “billing mode” and "purchase duration” are not displayed on the page, it can predict the loading completion time of the above controls, and then adjust the waiting time .
  • the test framework is usually set with a default waiting time, which may be a maximum waiting time, for example, 60 seconds (second, s).
  • the UI testing system can adjust the waiting time, for example, within the interval of the default waiting time, set the time every interval, such as 10s, to detect whether the UI control appears, if so, stop waiting, and automatically complete the test.
  • the operation of the above controls such as selecting the billing mode of "subscription” and selecting "purchase duration" as 1 month.
  • the second abnormal situation the loading of the UI control is not completed, specifically, the UI control is successfully found on the page, but the UI control cannot be operated (for example, the UI control is in a grayed state).
  • the interface 500 displays the "add list” control, but the control is grayed out and cannot be operated on.
  • the UI testing system of the embodiment of the present application detects the second abnormal situation, for example, when the "add list" control is displayed on the page but is unavailable, it can predict the waiting time for the above-mentioned control to change from unavailable to available, and then adjust the waiting time .
  • the test framework is usually set with a default waiting time, which may be a maximum waiting time, for example, 60 seconds (second, s). The UI test system can adjust the waiting time.
  • the third abnormal situation the loading of the UI control is completed, but the data associated with the UI control is not yet loaded.
  • the product type control and the area control are displayed in the interface 500, but the data associated with the product type control and the data associated with the area control are not returned, and the loading box is suspended in the interface 500, Used to identify that data is still loading.
  • the UI testing system of the embodiment of the present application detects the third abnormal situation, and can predict the loading completion time of the associated data. When the loading completion time arrives, the UI testing system can automatically detect whether it can trigger the operation of the UI control , for example, to trigger a filter operation on a specific product type in the product type control, or to trigger a filter operation on a specific area in the area control. If yes, perform the above operations to complete the UI test.
  • the embodiment of the present application provides a UI testing method.
  • This method abstracts a unified interface test API for different types of clients, so that testers can use the unified interface test API to write test cases for different client types, unifies and simplifies the method of writing test cases, and improves the writing efficiency of test cases , thus improving the testing efficiency of the UI.
  • the embodiment of the present application also greatly reduces the cost of writing automated test cases on different clients, saving the test cost.
  • the abnormal type can also be detected, and then according to the abnormal type, the waiting time can be intelligently adjusted to complete the operation of the user interface control. This can solve the problem of unstable native operation methods and improve the success rate of control operations.
  • the embodiment of the present application adopts a layered approach to uniformly schedule test cases, public capabilities, unified control operations, and drive layered design, reducing the complexity of test case implementation.
  • the system 200 includes:
  • the interface unit 202 is used to provide the same interface testing application programming interface API for different types of clients;
  • the communication unit 204 is configured to receive test cases of different types of clients, the test cases of the different types of clients are written based on the same interface test API;
  • the testing unit 206 is configured to execute the test cases of the different types of clients, so as to test the user interfaces of the different types of clients.
  • the interface testing API is applied to multiple platforms.
  • the multiple platforms include a webpage platform and an application platform.
  • testing unit 206 is specifically configured to:
  • testing unit 206 is specifically configured to:
  • testing unit 206 is specifically configured to:
  • the waiting time is adjusted to complete the operation on the user interface control.
  • the exception type includes: the user interface control has not been loaded completely, or the user interface control has been loaded and the associated data of the user interface control has not been loaded completely.
  • the UI test system 200 may correspond to the implementation of the method described in the embodiment of the present application, and the above-mentioned and other operations and/or functions of the various modules/units of the UI test system 200 are respectively in order to realize what is shown in FIG. 3
  • the corresponding flow of each method in the embodiment is shown, and for the sake of brevity, details are not repeated here.
  • the embodiment of the present application also provides a computer cluster.
  • the computer cluster may be a computer cluster formed by at least one computer in a cloud environment, an edge environment, or a terminal device.
  • the computer cluster is specifically used to implement the functions of the UI testing system 200 in the embodiment shown in FIG. 2 .
  • FIG. 7 provides a schematic structural diagram of a computer cluster.
  • the computer cluster 70 includes at least one computer 700 , and the computer 700 includes a bus 701 , a processor 702 , a communication interface 703 and a memory 704 .
  • the processor 702 , the memory 704 and the communication interface 703 communicate through the bus 701 .
  • the bus 701 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, etc.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 7 , but it does not mean that there is only one bus or one type of bus.
  • the processor 702 may be a central processing unit (central processing unit, CPU), a graphics processing unit (graphics processing unit, GPU), a microprocessor (micro processor, MP) or a digital signal processor (digital signal processor, DSP) etc. Any one or more of them.
  • CPU central processing unit
  • GPU graphics processing unit
  • MP microprocessor
  • DSP digital signal processor
  • the communication interface 703 is used for communicating with the outside.
  • the communication interface 703 of a computer can be used to receive test cases of different types of clients and the like.
  • the memory 704 may include a volatile memory (volatile memory), such as a random access memory (random access memory, RAM).
  • volatile memory such as a random access memory (random access memory, RAM).
  • Memory 704 can also include non-volatile memory (non-volatile memory), such as read-only memory (read-only memory, ROM), flash memory, hard disk drive (hard disk drive, HDD) or solid state drive (solid state drive) , SSD).
  • Executable codes are stored in the memory 704, and the processor 702 executes the executable codes to perform the aforementioned UI testing.
  • the function of the communication unit 204 in FIG. 703 the software or program codes required to execute the functions in FIG. 2 may be stored in the memory 704.
  • the processor 702 executes the program codes corresponding to the above-mentioned modules or units stored in the memory 704, so as to execute the above-mentioned UI testing method.
  • the embodiment of the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be any available medium that a computing device can store, or a data storage device such as a data center that includes one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state hard disk), etc.
  • the computer-readable storage medium includes instructions, and the instructions instruct a computing device to execute the above UI testing method.
  • the embodiment of the present application also provides a computer program product.
  • the computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on the computing device, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.) to another website site, computer or data center.
  • another computer-readable storage medium e.g. (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.) to another website site, computer or data center.
  • the computer program product may be a software installation package which may be downloaded and executed on a computing device in case any of the aforementioned testing methods using the UI are required.

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

本申请提供了一种用户界面的测试方法,包括:针对不同类型客户端提供相同的界面测试API,接收不同类型客户端的测试用例,其中,测试用例基于相同的界面测试API编写,然后执行不同类型客户端的测试用例,从而实现对不同类型客户端的UI的测试。该方法通过抽象出对不同类型客户端统一的界面测试API,使得测试者可以针对不同客户端类型使用统一的界面测试API编写测试用例,将用例编写方法统一和简化,提高了测试用例的编写效率,提高了UI的测试效率。并且,该方法减小不同客户端上编写自动化测试用例的成本,节约了测试成本。

Description

用户界面的测试方法、系统、集群、介质及程序产品
本申请要求于2021年05月12日提交中国国家知识产权局、申请号为202110521597.4、发明名称为“用户界面的测试方法、系统、集群、介质及程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及软件测试技术领域,尤其涉及一种用户界面的测试方法、系统、集群、计算机可读存储介质以及计算机程序产品。
背景技术
随着计算机技术尤其是前端技术的迅猛发展,许多互联网服务提供商提供了多种客户端类型,以为不同设备的用户提供服务。具体地,互联网服务提供商可以针对互联网软件产品提供网页(web)页面、应用(application,APP)程序。其中,web页面可以通过通用的web客户端如浏览器(桌面浏览器、移动端浏览器)呈现给用户,APP程序为专用客户端,通常可以基于支持该APP程序的操作系统分为不同类型,例如同一软件可以包括Android版、iOS版等多个版本。
在web页面或APP程序开发过程中,通常需要对用户界面(user interface,UI)进行测试。目前,业界提出了UI自动化测试工具,例如用于web页面测试的工具Selenium以及用于app测试的工具Appium等。
然而,在编写不同客户端类型的测试用例时,例如编写web类型、app类型的测试用例时,需要集成不同的测试框架进行开发。不同客户端类型的测试用例编写方法不统一,使用的应用程序编程接口(application programming interface,API)也存在差异,导致同样的业务场景,通常需要编写多份代码,测试用例的编写效率低下,进而极大地影响了UI的测试效率。
发明内容
本申请提供了一种UI的测试方法。该方法通过抽象出对不同类型客户端统一的界面测试API,使得测试者可以针对不同客户端类型使用统一的界面测试API编写测试用例,将用例编写方法统一和简化,提高了测试用例的编写效率,进而提高了UI的测试效率。并且,本申请还大大减小不同客户端上编写自动化测试用例的成本,节约了测试成本。本申请还提供了上述方法对应的UI的测试系统以及计算机集群、计算机可读存储介质以及计算机程序产品。
第一方面,本申请提供了一种UI的测试方法。该方法可以应用于UI的测试系统。UI的测试系统具体可以是软件系统,该软件系统可以部署在包括至少一台计算机的计算机集群中。计算机集群运行该软件系统,以实现多类型客户端统一的UI自动化测试。
具体地,UI的测试系统可以针对不同类型客户端提供相同的界面测试API,用户(例如 是测试者)可以基于该界面测试API编写不同类型客户端的测试用例,UI的测试系统接收上述不同类型客户端的测试用例,然后执行不同类型客户端的测试用例,从而实现对不同类型客户端的UI的测试。
该方法通过抽象出对不同类型客户端统一的界面测试API,使得测试者可以针对不同客户端类型使用统一的界面测试API编写测试用例,将用例编写方法统一和简化,提高了测试用例的编写效率,进而提高了UI的测试效率。并且,本申请实施例还大大减小不同客户端上编写自动化测试用例的成本,节约了测试成本。
在一些可能的实现方式中,所述界面测试API应用于多个平台。如此,测试者在需要对不同平台(不同类型)的UI进行测试时,可以基于上述界面测试API编写测试用例,而无需考虑平台的差异重新编写测试用例的实现代码,例如可以基于同一套实现代码实现对不同平台的UI进行测试,或者在一个平台对应的测试用例的实现代码的基础上进行微调得到另一个平台对应的测试用例的实现代码,并由此实现对不同平台的UI进行测试。
在一些可能的实现方式中,所述多个平台包括网页平台和应用平台。其中,网页平台可以是网页客户端如web浏览器。进一步地,网页平台还可以包括移动网页平台和桌面网页平台。应用平台可以是应用(application,APP)客户端。APP客户端包括电子邮件客户端、即时通信客户端、电子商务客户端或者是游戏客户端等专用客户端。提供相同服务的客户端还可以按照运行该客户端的设备类型或设备上操作系统的类型进行分类。例如,对于某电子邮件客户端,开发者通常可以在应用市场发布针对不同操作系统的版本,以便用户根据各自设备的操作系统选择相应的版本。
该方法通过对不同平台统一的界面测试API,实现以统一方法编写不同平台的UI对应的测试用例,对于不同平台均具有较好的适应性,满足了测试需求。
在一些可能的实现方式中,UI的测试系统在进行测试时可以先确认客户端类型,然后基于客户端类型选择调用相应的服务进行UI的测试。例如,UI的测试系统可以确认客户端类型为网页客户端,例如是web浏览器,然后根据所述界面测试API调用Selenium服务(用于对网页进行测试的服务)进行UI的测试。
基于上述方法,一方面可以解决原有测试框架如Selenium仅支持特定类型的UI的测试的问题,另一方面无需对原有测试框架进行大幅改动,节省了成本。
在一些可能的实现方式中,UI的测试系统在进行测试时可以先确认客户端类型,然后基于客户端类型选择调用相应的服务进行UI的测试。例如,UI的测试系统可以确认客户端类型为APP客户端,然后可以根据所述界面测试API调用Appium服务进行用户界面的测试。由此解决了原有测试框架如Appium仅支持特定类型的UI的测试的问题,另一方面无需对原有测试框架进行大幅改动,节省了成本。
在一些可能的实现方式中,UI的测试系统在执行测试用例,以对UI进行测试时,还可以出现异常情况,例如出现对UI控件操作异常的情况。UI的测试系统可以检测异常类型,然后根据所述异常类型,调整等待时间,以完成对所述用户界面控件的操作。
与直接使用原有的测试框架如Selenium、Appium,本申请通过智能等待提高了控件操作的成功率,进而提高了测试效率和测试质量。
在一些可能的实现方式中,所述异常类型包括:所述UI控件未加载完成或者是所述UI 控件已加载且所述UI控件的关联数据未加载完成。其中,UI控件未加载完成可以进一步分为以下几种情况:(1)UI控件在页面中查找失败,且无法对UI控件操作;(2)UI控件在页面中查找成功,但是无法对UI控件操作,例如UI控件出现在页面中,但处于灰化状态。
上述UI的测试方法可以实现在多种异常情况下进行智能等待,当异常恢复后,再执行测试用例。如此,可以实现高效、稳定的UI测试。
第二方面,本申请提供一种UI的测试系统。所述系统包括:
接口单元,用于针对不同类型客户端提供相同的界面测试API;
通信单元,用于接收不同类型客户端的测试用例,所述不同类型客户端的测试用例基于所述相同的界面测试API编写;
测试单元,用于执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。
在一些可能的实现方式中,所述界面测试API应用于多个平台。
在一些可能的实现方式中,所述多个平台包括网页平台和应用平台。
在一些可能的实现方式中,所述测试单元具体用于:
确认客户端类型为网页客户端,根据所述界面测试API调用Selenium服务进行用户界面的测试。
在一些可能的实现方式中,所述测试单元具体用于:
确认客户端类型为应用客户端,根据所述界面测试API调用Appium服务进行用户界面的测试。
在一些可能的实现方式中,所述测试单元具体用于:
对所述用户界面控件的操作异常时,检测异常类型;
根据所述异常类型,调整等待时间,以完成对所述用户界面控件的操作。
在一些可能的实现方式中,所述异常类型包括:所述UI控件未加载完成或者是所述UI控件已加载且所述用户界面控件的关联数据未加载完成。
第三方面,本申请提供一种计算机集群。所述计算机集群包括至少一台计算机,所述计算机包括处理器和存储器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令,以执行如第一方面或第一方面的任一种实现方式中的用户界面的测试方法。
第四方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,所述指令指示设备执行上述第一方面或第一方面的任一种实现方式所述的用户界面的测试方法。
第五方面,本申请提供了一种包含指令的计算机程序产品,当其在设备上运行时,使得设备执行上述第一方面或第一方面的任一种实现方式所述的用户界面的测试方法。
本申请在上述各方面提供的实现方式的基础上,还可以进行进一步组合以提供更多实现方式。
附图说明
为了更清楚地说明本申请实施例的技术方法,下面将对实施例中所需使用的附图作以 简单地介绍。
图1为本申请实施例提供的一种计算机集群的系统架构图;
图2为本申请实施例提供的一种UI的测试系统的结构示意图;
图3为本申请实施例提供的一种UI的测试方法的流程图;
图4为本申请实施例提供的一种云服务购买界面的示意图;
图5为本申请实施例提供的一种云服务购买界面的示意图;
图6为本申请实施例提供的一种订单管理界面的示意图;
图7为本申请实施例提供的一种计算机集群的结构示意图。
具体实施方式
本申请实施例中的术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。
为了便于理解本申请实施例,首先,对本申请涉及的部分术语进行解释说明。
网页web页面:一种由超文本标记语言(hyper text markup language,HTML)建立,且能够被浏览器解释或翻译的信息载体。该信息载体能够承载文字、图片、声音、视频等多媒体信息中的任意一种或多种。web页面可以包括各种组织的官方网页或者是信息管理系统的网页。
客户端:一种为客户提供本地服务的程序。客户端也可以称作用户端,客户端可以在本地设备独立运行,或者与远端服务器上的服务端协作运行。客户端可以分为通用的web客户端(例如是浏览器)和专用的APP客户端。通用的web客户端可以通过不同web页面实现不同功能,例如实现电子邮件、电子商务等功能,专用的APP客户端包括电子邮件客户端、即时通信客户端、电子商务客户端或者是游戏客户端等等。其中,提供相同服务的客户端还可以按照运行该客户端的设备类型或设备上操作系统的类型进行分类。例如,对于某电子邮件客户端,开发者通常可以在应用市场发布针对不同操作系统的版本,以便用户根据各自设备的操作系统选择相应的版本。
测试框架:一种为自动化测试用例或者脚本提供执行环境而搭建的基础设施软件。测试框架提供有丰富的组件,从而为软件测试提供帮助。例如,测试框架提供有日志管理组件、测试报告生成及管理组件、测试用例管理组件、测试数据管理组件等等。
在web页面或APP客户端开发过程中,通常需要对用户界面UI进行测试。目前,业界提出了UI自动化测试工具,例如用于web页面测试的工具Selenium以及用于APP客户端测试的工具Appium等。然而,在编写不同客户端类型的测试用例时,例如编写web类型、app类型的测试用例时,需要集成不同的测试框架进行开发。不同客户端类型的测试用例编写方法不统一,使用的应用程序编程接口API也存在差异,导致同样的业务场景,通常需要编写多份代码,测试用例的编写效率低下,进而极大地影响了UI的测试效率。
为了解决上述技术问题,本申请实施例提供一种UI的测试方法。该方法可以应用于UI的测试系统。UI的测试系统具体可以是软件系统,该软件系统可以部署在包括至少一台计算机的计算机集群中。计算机集群运行该软件系统,以实现多类型客户端统一的UI自动 化测试。
具体地,UI的测试系统可以针对不同类型客户端提供相同的界面测试API,用户(例如是测试者)可以基于该界面测试API编写不同类型客户端的测试用例,UI的测试系统接收上述不同类型客户端的测试用例,然后执行不同类型客户端的测试用例,从而实现对不同类型客户端的UI的测试。
本申请实施例通过抽象出对不同类型客户端统一的界面测试API,使得测试者可以针对不同客户端类型使用统一的界面测试API编写测试用例,将用例编写方法统一和简化,提高了测试用例的编写效率,进而提高了UI的测试效率。并且,本申请实施例还大大减小不同客户端上编写自动化测试用例的成本,节约了测试成本。
下文将围绕以上介绍的总体思路对本申请实施例作出详细介绍。
首先请参见图1,图1是根据本申请实施例的计算机集群的系统架构示意图。
如图1所示,计算机集群100包括服务器110和终端120,服务器110和终端120通过网络130连接。服务器110可以是云环境中的云服务器。其中,云环境指示云服务提供商拥有的,用于提供计算、存储、通信资源的计算集群。服务器110也可以是本地数据中心的本地服务器。本地数据中心是指用户如测试者所属数据中心。终端120可以是台式机、笔记本电脑、平板电脑或者其他设备。测试者可以通过终端120与服务器110交互,从而实现对不同类型客户端的UI进行统一测试。
具体地,服务器110包括硬件资源和软件资源。硬件资源包括网卡、处理器、存储器……等服务器通用的硬件设备。其中,处理器可以包括中央处理器(central processing unit,CPU)和图形处理器(graphics processing unit,GPU)中的至少一个。一个服务器可以包括至少一个CPU以及至少一个GPU。图1以一个服务器包括一个CPU和一个GPU进行示例说明。
软件资源包括服务器操作系统以及UI的测试系统。其中,服务器操作系统用于对服务器110的硬件设备和部署在服务器110中的软件进行直接控制和管理协调。UI的测试系统运行在服务器操作系统上,用于对不同类型客户端的UI进行统一测试。
其中,不同类型客户端包括web客户端和APP客户端中的至少一个。Web客户端的UI包括web页面。APP客户端的UI包括APP客户端的登录页面、主页面、详情页面、配置页面等等。web客户端可以根据客户端所在设备分为mobile web客户端和个人电脑(personal computer,PC)web客户端。APP客户端可以根据客户端所在设备(或者是设备上的操作系统)分为不同类型。
为了使得本申请的技术方案更加清楚、易于理解,以下请参见图2,图2是根据本申请实施例的UI的测试系统的结构示意图,如图2所示,UI的测试系统200包括接口单元202、通信单元204和测试单元206。下面对各个单元的功能进行说明。
接口单元202用于针对不同类型客户端提供相同的界面测试API。该界面测试API包括控件操作层中控件操作方法对应的API。控件操作层封装有UI控件的操作类对应的控件操作方法。其中,UI控件是指用于生成UI的控件,包括但不限于选择控件、输入控件、提交控件等。操作类具体可以包括点击(单击、双击等)、选中等操作的抽象类。操作类 可以实例化,从而生成对应的控件操作方法。该控件操作方法相对于不同类型客户端(例如是mobile web客户端、PC web客户端或者是基于特定操作系统的APP客户端)统一。
通信单元204用于接收不同类型客户端的测试用例。其中,不同类型客户端的测试用例可以是用户(例如为测试者)基于所述相同的界面测试API编写。
测试单元204用于执行上述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。由此可以实现对不同类型客户端,例如是web客户端和APP客户端的UI的一体化测试。
在一些可能的实现方式中,界面测试API可以应用于多个平台,例如是网页平台和应用平台,从而实现对相应类型的客户端进行UI的测试。在一些可能的实现方式中,界面测试API还可以应用于其他平台,从而实现对其他类型的客户端进行UI的测试。
具体地,接口单元202还针对不同平台提供对应的操作方法的API。具体地,接口单元202还包括平台操作层,例如包括网页平台操作和应用平台操作层。其中,网页平台操作层基于Selenium服务封装web客户端如浏览器的操作方法,应用平台操作层基于Appium服务封装APP客户端的操作方法。其中,APP客户端的操作方法还包括设备连接管理方法,用于对部署APP客户端的设备如手机等进行连接管理。控件操作层的API可以调用平台操作层的API,形成API调用链,通过API调用链实现对相应类型的客户端的UI的测试。
进一步地,应用平台还可以根据操作系统类型分为不同的应用平台。基于此,接口单元202还针对不同操作系统类型对应的应用分别提供相应的驱动(drive)。具体地,应用平台包括第一应用平台和第二应用平台,第一应用平台和第二应用平台对应不同类型的操作系统。接口单元202还包括第一应用平台驱动层和第二应用平台驱动层。第一应用平台驱动层包括第一应用平台的驱动,第二应用平台驱动层包括第二应用平台的驱动。
需要说明的是,平台操作层不限于上述网页平台操作层和应用平台操作层,还可以支持其他更多的平台。
在一些可能的实现方式中,接口单元202还可以提供通用操作的API。参见图2,接口单元202还包括基础层,该基础层封装有通用操作方法,例如是超文本传输协议(hyper text transfer protocol,HTTP)请求、模拟(mock)操作或者数据库操作等通用操作方法。基础层提供上述通用操作方法的API,以便于测试调用上述API。此外,基础层还可以实现对测试用例的统一调度。对测试用例的统一调度具体为对不同测试用例执行相同处理。例如,针对不同测试用例增加公共前置条件或公共后置处理,该公共前置条件例如可以是设置环境变量,该公共后置处理例如可以是数据清理、信息收集等。
接口单元202提供的基础层、控件操作层、平台操作层等可以形成web客户端和APP客户端一体化的测试框架。该一体化的测试框架可以提供Selenium服务和Appium服务。测试单元206在执行不同类型客户端的测试用例时,可以确认客户端类型。当客户端类型为网页客户端,则根据所述界面测试API调用Selenium服务进行UI的测试。当客户端类型为应用客户端,根据所述界面测试API调用Appium服务进行UI的测试。
接下来,将结合附图,从UI的测试系统角度对本申请实施例提供的UI的测试方法进行详细说明。
参见图3所示的UI的测试方法的流程图,该方法包括:
S302:UI的测试系统针对不同类型客户端提供相同的界面测试API。
具体地,客户端可以基于通用程度分为通用的web客户端和专用的APP客户端。其中,web客户端还可以基于适用的设备分为mobile web客户端和PC web客户端,APP客户端还可以基于适用的设备(具体是设备中的操作系统)分为桌面客户端和嵌入式客户端,其中,嵌入式客户端可以包括不同嵌入式操作系统对应的客户端。
针对上述不同类型客户端,UI的测试系统基于一体化的测试框架,提供相同的界面测试API,以供测试者基于上述界面测试API编写测试用例。其中,一体化的测试框架包括控件操作层,该控件操作层封装有UI控件的操作类对应的控件操作方法。控件操作层可以暴露上述UI控件的操作类对应的控件操作方法的API,也即界面测试API。
由于控件操作层中封装的控件操作方法时基于Selenium、Appium等测试框架封装的方法抽象得到,基于此,控件操作层暴露的API如界面测试API对于不同类型客户端是相同的。
S304:UI的测试系统接收不同类型客户端的测试用例。
不同类型客户端的测试用例可以是用户(例如为测试者)基于S302中所述的相同的界面测试API编写。具体地,针对不同类型的客户端,用户可以通过相同的界面测试API编写测试用例的实现代码。例如,UI包括点击控件时,用户均可以使用clickElement()方法,UI包括文本输入控件时,用户均可以使用inputText()方法,UI包括等待元素加载控件时,用户均可以使用waitElementAppear()方法。
本申请实施例还以某网站的登录页面的测试用例进行示例说明。
PC web客户端如PC浏览器登录网站时的登录页面对应的测试用例如下所示:
Figure PCTCN2022092154-appb-000001
mobile web客户端如手机浏览器登录网站时的登录页面对应的测试用例如下所示:
Figure PCTCN2022092154-appb-000002
基于上述实现代码,可知不同类型客户端的登录页面的方法类的实现代码几乎一致,实现代码主要包括界面测试API的调用,界面测试API在不同平台或者不同类型客户端上的调用方法可以是一致的。不同客户端对应的测试用例的实现代码的主要区别在于类名、测试用例名称等信息。因此,用户如测试者在编写完一个类型客户端的测试用例后,可以对已编写的测试用例进行微调得到其他类型客户端的测试用例。
S306:UI的测试系统执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。
UI的测试系统提供了不同类型客户端的测试用例的执行环境,UI的测试系统可以在该执行环境下执行不同类型客户端的测试用例,从而实现对不同类型客户端的UI的测试。
需要说明的是,UI的测试系统执行测试用例时,还可以出现对UI控件的操作异常的情况。基于此,UI的测试系统还可以在对UI控件的操作异常时,检测异常类型。其中,异常类型可以包括以下类型:(1)UI控件未加载完成;(2)UI控件已加载且所述UI控件的关联数据未加载完成。其中,UI控件未加载完成可以包括多种情况,一种情况是UI控件尚未在页面中显示,另一种情况是UI控件在页面中显示,但处于不可用状态(例如是灰化状态)。UI的测试系统可以根据上述异常类型,调整等待时间,以完成对所述用户界面控件的操作。如此解决了Selenium、Appium等测试框架的操作方法不稳定的问题,提升了控件操作成功率,进而提高了测试质量和测试效率。
为了便于理解,下面结合界面图对上述异常情况及其处理结果进行示例说明。
第一种异常情况:UI控件未加载完成,具体是UI控件在页面中查找失败,且无法对UI控件操作。
参见如图4所示的云服务购买界面的示意图,界面400中显示了区域控件,未显示“计费模式”和“购买时长”等控件。本申请实施例的UI测试系统在检测到第一种异常情况, 例如“计费模式”和“购买时长”等控件在页面中未显示时,可以预测上述控件的加载完成时间,然后调整等待时间。具体地,测试框架通常设置有默认等待时间,该默认等待时间可以是最大等待时间,例如可以为60秒(second,s)。在本申请实施例中,UI的测试系统可以调整等待时间,例如在默认等待时间的区间内,每间隔设定时间,例如为10s,检测UI控件是否出现,若是,则停止等待,自动完成对上述控件的操作,如选择“包年包月”的计费模式以及选择“购买时长”为1个月。
第二种异常情况:UI控件未加载完成,具体是UI控件在页面中查找成功,但是无法对UI控件操作(例如是UI控件处于灰化状态)。
参见图5所示的云服务购买界面的示意图,界面500中显示了“加入清单”控件,但是该控件处于灰化状态,无法对该控件进行操作。本申请实施例的UI测试系统在检测到第二种异常情况,例如“加入清单”控件在页面中显示,但不可用时,可以预测上述控件由不可用变为可用的等待时间,然后调整等待时间。具体地,测试框架通常设置有默认等待时间,该默认等待时间可以是最大等待时间,例如可以为60秒(second,s)。UI的测试系统可以调整等待时间,例如在默认等待时间的区间内,每间隔设定时间,例如为10s,获取UI控件如“加入清单”控件的属性,基于该属性确定控件是否可用,若是,则停止等待,并对上述控件执行相应的操作。
第三种异常情况:UI控件加载完成,但UI控件关联的数据未加载完成。
参见如图6所示的订单管理界面的示意图,界面500中展示了产品类型控件和区域控件,然而产品类型控件关联的数据以及区域控件关联的数据并未返回,界面500中悬浮了加载框,用于标识数据仍在加载。本申请实施例的UI的测试系统在检测到第三种异常情况,可以预测关联的数据的加载完成时间,当加载完成时间到达时,UI的测试系统可以自动检测是否能触发对UI控件的操作,例如是触发对产品类型控件中特定产品类型的筛选操作,或者是触发对区域控件中特点区域的筛选操作。若是,则执行上述操作完成UI的测试。
基于上述内容描述,本申请实施例提供了一种UI的测试方法。该方法通过抽象出对不同类型客户端统一的界面测试API,使得测试者可以针对不同客户端类型使用统一的界面测试API编写测试用例,将用例编写方法统一和简化,提高了测试用例的编写效率,进而提高了UI的测试效率。并且,本申请实施例还大大减小不同客户端上编写自动化测试用例的成本,节约了测试成本。
进一步地,在执行测试用例过程中,对UI控件的操作异常时,还可以检测异常类型,然后根据所述异常类型,智能调整等待时间,以完成对所述用户界面控件的操作。如此可以解决原生操作方法不稳定的问题,提高控件操作成功率。
此外,本申请实施例在设计一体化的测试框架时,采用分层思路,将测试用例统一调度、公共能力、统一控件操作、驱动分层设计,降低了测试用例实现层面的复杂性。
上文结合图1至图6对本申请实施例提供的UI的测试方法进行了详细介绍,下面将结合附图对本申请实施例提供的UI的测试系统进行介绍。
参见图2所示的UI的测试系统的结构示意图,该系统200包括:
接口单元202,用于针对不同类型客户端提供相同的界面测试应用程序编程接口API;
通信单元204,用于接收不同类型客户端的测试用例,所述不同类型客户端的测试用例基于所述相同的界面测试API编写;
测试单元206,用于执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。
在一些可能的实现方式中,所述界面测试API应用于多个平台。
在一些可能的实现方式中,所述多个平台包括网页平台和应用平台。
在一些可能的实现方式中,所述测试单元206具体用于:
确认客户端类型为网页客户端,根据所述界面测试API调用Selenium服务进行用户界面的测试。
在一些可能的实现方式中,所述测试单元206具体用于:
确认客户端类型为应用客户端,根据所述界面测试API调用Appium服务进行用户界面的测试。
在一些可能的实现方式中,所述测试单元206具体用于:
对所述用户界面控件的操作异常时,检测异常类型;
根据所述异常类型,调整等待时间,以完成对所述用户界面控件的操作。
在一些可能的实现方式中,所述异常类型包括:所述用户界面控件未加载完成或者是所述用户界面控件已加载且所述用户界面控件的关联数据未加载完成。
根据本申请实施例的UI的测试系统200可对应于执行本申请实施例中描述的方法,并且UI的测试系统200的各个模块/单元的上述和其它操作和/或功能分别为了实现图3所示实施例中的各个方法的相应流程,为了简洁,在此不再赘述。
本申请实施例还提供了一种计算机集群。该计算机集群可以是云环境、边缘环境或者终端设备中的至少一台计算机形成的计算机集群。该计算机集群具体用于实现如图2所示实施例中UI的测试系统200的功能。
图7提供了一种计算机集群的结构示意图,如图7所示,计算机集群70包括至少一台计算机700,计算机700包括总线701、处理器702、通信接口703和存储器704。处理器702、存储器704和通信接口703之间通过总线701通信。
总线701可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
处理器702可以为中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)等处理器中的任意一种或多种。
通信接口703用于与外部通信。例如,一台计算机的通信接口703可以用于接收不同类型客户端的测试用例等等。
存储器704可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。存储器704还可以包括非易失性存储器(non-volatile memory),例 如只读存储器(read-only memory,ROM),快闪存储器,硬盘驱动器(hard disk drive,HDD)或固态驱动器(solid state drive,SSD)。
存储器704中存储有可执行代码,处理器702执行该可执行代码以执行前述UI的测试。
具体地,在实现图2所示实施例的情况下,且图2实施例中所描述的UI的测试系统200的各模块为通过软件实现的情况下,图2中通信单元204功能由通信接口703实现,执行图2中功能所需的软件或程序代码可以存储在存储器704中。处理器702执行存储器704中存储的上述模块或单元对应的程序代码,以执行前述UI的测试方法。
本申请实施例还提供了一种计算机可读存储介质。所述计算机可读存储介质可以是计算设备能够存储的任何可用介质或者是包含一个或多个可用介质的数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘)等。该计算机可读存储介质包括指令,所述指令指示计算设备执行上述UI的测试方法。
本申请实施例还提供了一种计算机程序产品。所述计算机程序产品包括一个或多个计算机指令。在计算设备上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。
所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机或数据中心进行传输。
所述计算机程序产品可以为一个软件安装包,在需要使用前述UI的测试方法的任一方法的情况下,可以下载该计算机程序产品并在计算设备上执行该计算机程序产品。
上述各个附图对应的流程或结构的描述各有侧重,某个流程或结构中没有详述的部分,可以参见其他流程或结构的相关描述。

Claims (17)

  1. 一种用户界面的测试方法,其特征在于,包括:
    针对不同类型客户端提供相同的界面测试应用程序编程接口API;
    接收不同类型客户端的测试用例,所述不同类型客户端的测试用例基于所述相同的界面测试API编写;
    执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。
  2. 根据权利要求1所述的方法,其特征在于,所述界面测试API应用于多个平台。
  3. 根据权利要求2所述的方法,其特征在于,所述多个平台包括网页平台和应用平台。
  4. 根据权利要求3所述的方法,其特征在于,执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试,包括:
    确认客户端类型为网页客户端,根据所述界面测试API调用Selenium服务进行用户界面的测试。
  5. 根据权利要求1至4任一项所述的方法,其特征在于,执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试,包括:
    确认客户端类型为应用客户端,根据所述界面测试API调用Appium服务进行用户界面的测试。
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述执行所述不同类型客户端的测试用例,包括:
    对用户界面控件的操作异常时,检测异常类型;
    根据所述异常类型,调整等待时间,以完成对所述用户界面控件的操作。
  7. 根据权利要求6所述的方法,其特征在于,所述异常类型包括:所述用户界面控件未加载完成或者是所述用户界面控件已加载且所述用户界面控件的关联数据未加载完成。
  8. 一种用户界面的测试系统,其特征在于,包括:
    接口单元,用于针对不同类型客户端提供相同的界面测试应用程序编程接口API;
    通信单元,用于接收不同类型客户端的测试用例,所述不同类型客户端的测试用例基于所述相同的界面测试API编写;
    测试单元,用于执行所述不同类型客户端的测试用例,实现对不同类型客户端的用户界面的测试。
  9. 根据权利要求8所述的系统,其特征在于,所述界面测试API应用于多个平台。
  10. 根据权利要求9所述的系统,其特征在于,所述多个平台包括网页平台和应用平台。
  11. 根据权利要求10所述的系统,其特征在于,所述测试单元具体用于:
    确认客户端类型为网页客户端,根据所述界面测试API调用Selenium服务进行用户界面的测试。
  12. 根据权利要求8至11任一项所述的系统,其特征在于,所述测试单元具体用于:
    确认客户端类型为应用客户端,根据所述界面测试API调用Appium服务进行用户界面的测试。
  13. 根据权利要求8至12任一项所述的系统,其特征在于,所述测试单元具体用于:
    对用户界面控件的操作异常时,检测异常类型;
    根据所述异常类型,调整等待时间,以完成对所述用户界面控件的操作。
  14. 根据权利要求13所述的系统,其特征在于,所述异常类型包括:所述用户界面控件未加载完成或者是所述用户界面控件已加载且所述用户界面控件的关联数据未加载完成。
  15. 一种计算机集群,其特征在于,所述计算机集群包括至少一台计算机,所述计算机包括处理器和存储器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令,以执行如权利要求1至7任一项所述的用户界面的测试方法。
  16. 一种计算机可读存储介质,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至7任一项所述的用户界面的测试方法。
  17. 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如权利要求1至7任一项所述的用户界面的测试方法。
PCT/CN2022/092154 2021-05-12 2022-05-11 用户界面的测试方法、系统、集群、介质及程序产品 WO2022237826A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110521597.4A CN115344471A (zh) 2021-05-12 2021-05-12 用户界面的测试方法、系统、集群、介质及程序产品
CN202110521597.4 2021-05-12

Publications (1)

Publication Number Publication Date
WO2022237826A1 true WO2022237826A1 (zh) 2022-11-17

Family

ID=83977808

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092154 WO2022237826A1 (zh) 2021-05-12 2022-05-11 用户界面的测试方法、系统、集群、介质及程序产品

Country Status (2)

Country Link
CN (1) CN115344471A (zh)
WO (1) WO2022237826A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160085663A1 (en) * 2014-09-23 2016-03-24 Red Hat, Inc. Automatic identification of software test cases
CN106844213A (zh) * 2017-01-21 2017-06-13 江苏千米网络科技股份有限公司 一种前端自动化测试方法及装置
CN111061526A (zh) * 2019-10-12 2020-04-24 平安普惠企业管理有限公司 自动化测试方法、装置、计算机设备及存储介质
CN111913889A (zh) * 2020-09-11 2020-11-10 中移(杭州)信息技术有限公司 一种测试系统搭建方法及测试系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160085663A1 (en) * 2014-09-23 2016-03-24 Red Hat, Inc. Automatic identification of software test cases
CN106844213A (zh) * 2017-01-21 2017-06-13 江苏千米网络科技股份有限公司 一种前端自动化测试方法及装置
CN111061526A (zh) * 2019-10-12 2020-04-24 平安普惠企业管理有限公司 自动化测试方法、装置、计算机设备及存储介质
CN111913889A (zh) * 2020-09-11 2020-11-10 中移(杭州)信息技术有限公司 一种测试系统搭建方法及测试系统

Also Published As

Publication number Publication date
CN115344471A (zh) 2022-11-15

Similar Documents

Publication Publication Date Title
US8875098B2 (en) Workflow engine for execution of web mashups
US11561889B2 (en) Orchestration for automated performance testing
WO2021184725A1 (zh) 用户界面测试方法、装置、存储介质及计算机设备
US11709766B2 (en) Mocking robotic process automation (RPAactivities for workflow testing
CN111158818A (zh) 一种页面渲染方法和装置
CN110209569B (zh) 接口测试方法、接口测试装置及存储介质
CN111782988B (zh) 确定应用程序来源的方法、装置、计算机系统和存储介质
WO2017107851A1 (zh) 一种桌面应用组件发布、更新方法及装置
CN111045653A (zh) 系统生成方法、装置、计算机可读介质及电子设备
US11625243B2 (en) Micro-application creation and execution
TW202034164A (zh) 壓力測試方法、裝置、設備和儲存媒體
CN112395098A (zh) 应用程序接口调用方法、装置、存储介质和电子设备
US10678561B2 (en) Virtualizing extension code in an application
US10073689B2 (en) Managing application lifecycles within a federation of distributed software applications
WO2022237826A1 (zh) 用户界面的测试方法、系统、集群、介质及程序产品
CN112506781A (zh) 测试监控方法、装置、电子设备、存储介质及程序产品
CN113535590A (zh) 程序测试方法和装置
CN113448578A (zh) 页面数据处理方法、处理系统、电子设备和可读存储介质
CN113176907A (zh) 接口数据调用方法、装置、计算机系统及可读存储介质
KR20100006497A (ko) 웹 데스크 탑 프레임워크 구성 방법 및 그 시스템
CN111124907A (zh) 一种手机游戏测试方法、装置和服务器
US20230214310A1 (en) Infrastructure to integrate an integrated development environment (ide) with game engines
CN113760467A (zh) 事务处理方法、装置、计算机系统及存储介质
CN113342633A (zh) 一种性能测试方法和装置
CN114398099A (zh) 程序资源加载方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22806789

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22806789

Country of ref document: EP

Kind code of ref document: A1