Automatic testing method and device, equipment, storage medium and product

By building an automated user interface framework, calling client function interfaces and performing assertions, the problem of poor test case adaptability in the UI automation testing of in-vehicle information systems was solved, realizing automated testing that can quickly adapt to multiple vehicle models and improving test coverage and efficiency.

CN119292894AInactive Publication Date: 2025-01-10DONGFENG MOTOR GRP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411385666.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the automated testing of in-vehicle information systems, UI automated testing suffers from poor test case adaptability, making it difficult to adapt to the complex and ever-changing vehicle interfaces and diverse vehicle model requirements.

Method used

Build a user interface automation framework. Based on the user interface automation framework, call the functional interfaces provided by the client according to the target interface document, receive the operation results generated by the client, and make assertions according to the test requirements. Test the client's functional implementation directly by simulating user operation behavior.

Benefits of technology

It can quickly adapt to multiple models, reduce the cost of debugging and writing automated test cases, improve the coverage of automated tests, and ensure the accuracy and efficiency of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292894A_ABST
    Figure CN119292894A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic testing method and device, equipment, a storage medium and a product, and relates to the technical field of vehicle-mounted application development and test.The method comprises the steps that a user interface automation framework is built, and based on the user interface automation framework, a function interface provided by a client side is called according to a target interface document, receiving an operation result generated by the client, wherein the operation result corresponds to the function interface; and asserting the operation result according to a test requirement, and obtaining an assertion result. Through the UI automation framework, the operation behavior of the user is simulated, and the function interface of the client is called, the function realization of the client can be directly tested, various machine (vehicle) types can be rapidly adapted, the debugging and writing cost of the automation use case is reduced, and the coverage rate of the automation test is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle-mounted application development and testing technology, and in particular to automated testing methods, devices, equipment, storage media and products. Background Art

[0002] With the rapid development of automobile intelligence and networking, in-vehicle information systems (such as in-vehicle entertainment systems, navigation systems, intelligent driving assistance systems, etc.) play an increasingly important role in vehicles. These systems not only improve the convenience and comfort of driving, but are also directly related to driving safety and user experience. Therefore, testing of in-vehicle information systems has become particularly important.

[0003] Currently, user interface (UI) automated testing is one of the mainstream methods in the automated testing of in-vehicle information systems. However, when facing complex and ever-changing vehicle interfaces and diverse vehicle model requirements, UI automated testing has the problem of poor test case adaptability.

[0004] Therefore, how to improve the adaptability when writing test cases has become a problem that needs to be solved urgently. Summary of the invention

[0005] The main purpose of this application is to provide an automated testing method, device, equipment, storage medium and product, aiming to solve the technical problem of poor adaptability of test cases.

[0006] To achieve the above objectives, the present application proposes an automated testing method, which includes:

[0007] Build a user interface automation framework;

[0008] Based on the user interface automation framework, calling the functional interface provided by the client according to the target interface document;

[0009] receiving an operation result generated by a client, wherein the operation result corresponds to the functional interface;

[0010] Assert the operation result according to the test requirements and obtain the assertion result.

[0011] In one embodiment, the step of building a user interface automation framework includes:

[0012] Configuring an environment of a user interface automation framework, the environment including a Python environment and an Android environment;

[0013] Based on the Python environment, build Python client library and front-end testing tools;

[0014] Based on the Android environment, a test application is installed, wherein the test application has a factory command interface, a screenshot capture tool, and a touch screen simulation tool;

[0015] When the Python client library and the front-end testing tool are built and the test application is installed, a user interface automation framework is obtained.

[0016] In one embodiment, the step of calling the functional interface provided by the client according to the target interface document based on the user interface automation framework includes:

[0017] Call the functional interface according to user needs, the interface types include user interface and backend interface;

[0018] Based on the user interface, an interface call is made through the interface elements of the front-end testing tool;

[0019] Based on the backend interface, the corresponding function is directly called through the client library.

[0020] In one embodiment, the step of calling the functional interface provided by the client according to the target interface document based on the user interface automation framework further includes:

[0021] When the functional interface does not match the target interface document, adding an interface definition to the target interface document to obtain an updated target interface document;

[0022] Based on the user interface automation framework, a functional interface provided by the client is called according to the updated target interface document.

[0023] In one embodiment, the step of receiving an operation result generated by the client, wherein the operation result corresponds to the functional interface, includes:

[0024] Receive an operation result generated by the client, the operation result including return data corresponding to the called functional interface;

[0025] Confirm the status and content of the operation result to ensure that the operation result conforms to the expected output format;

[0026] For the user interface, record the interface element status and attributes, the interface element status and attributes are used for subsequent analysis;

[0027] For the backend interface, the returned functional data is obtained and recorded.

[0028] In one embodiment, the step of asserting the operation result according to the test requirements and obtaining the assertion result includes:

[0029] According to predefined test cases and requirements, extract the status and content in the operation results for assertion;

[0030] Use the assertion library to verify the operation results and compare whether the actual results are consistent with the expected results;

[0031] The assertion result includes success information and failure information.

[0032] In addition, to achieve the above objectives, the present application also proposes an automated testing device, the automated testing device comprising:

[0033] Framework building module, used to build the user interface automation framework;

[0034] An interface calling module, used to call a functional interface provided by a client according to a target interface document based on the user interface automation framework;

[0035] A result receiving module, used to receive an operation result generated by a client, wherein the operation result corresponds to the functional interface;

[0036] The result assertion module is used to assert the operation result according to the test requirements and obtain the assertion result.

[0037] In addition, to achieve the above objectives, the present application also proposes an automated testing device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the automated testing method described above.

[0038] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the automated testing method described above are implemented.

[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the automated testing method described above are implemented.

[0040] One or more technical solutions proposed in this application have at least the following technical effects:

[0041] Build a user interface automation framework. Based on the user interface automation framework, call the functional interface provided by the client according to the target interface document, receive the operation results generated by the client, and the operation results correspond to the functional interface; assert the operation results according to the test requirements and obtain the assertion results. Through the UI automation framework, simulate the user's operation behavior, call the client's functional interface, and directly test the client's functional implementation, quickly adapt to a variety of machine (vehicle) models, reduce the debugging and writing costs of automation use cases, and improve the coverage of automation testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0044] Figure 1 This is a flow chart of the first embodiment of the automated testing method of the present application;

[0045] Figure 2 This is a flow chart of the second embodiment of the automated testing method of the present application;

[0046] Figure 3 A schematic diagram of the environment configuration of the user interface automation framework of an embodiment of the present application;

[0047] Figure 4 This is a flowchart of the third embodiment of the automated testing method of the present application;

[0048] Figure 5 A schematic diagram of adding and calling the flow chart of the interface of the embodiment of the present application;

[0049] Figure 6 This is a schematic diagram of the back-end interface calling process of the embodiment of the present application;

[0050] Figure 7 This is a flowchart of a fourth embodiment of the automated testing method of the present application;

[0051] Figure 8 This is a schematic diagram of the module structure of the automated testing device according to an embodiment of the present application;

[0052] Fig. 9 This is a schematic diagram of the device structure of the hardware operating environment involved in the automated testing method in the embodiment of the present application.

[0053] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0055] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0056] Since the automated testing of the Zhuo system usually relies on the UI automation framework. Although the UI automated testing is excellent, in some functional testing scenarios, the stability of the interface test is always problematic, which is not as good as the stability of the interface test. In addition, the UI elements of some functional interfaces are difficult to obtain, which makes it difficult to write corresponding test cases. Therefore, due to the differences in requirements for different machine (vehicle) models, a lot of adaptation work is often required when writing test cases, which increases the complexity and workload of the test.

[0057] This application provides a solution to build a user interface automation framework. Based on the user interface automation framework, the functional interface provided by the client is called according to the target interface document, and the operation result generated by the client is received. The operation result corresponds to the functional interface; the operation result is asserted according to the test requirements, and the assertion result is obtained. Through the UI automation framework, the user's operation behavior is simulated, and the functional interface of the client is called. The functional implementation of the client can be directly tested, and a variety of machine (vehicle) models can be quickly adapted, reducing the debugging and writing costs of automation use cases, and improving the coverage of automated testing.

[0058] Based on this, the present application embodiment provides an automated testing method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the automated testing method of the present application.

[0059] In this embodiment, the automated testing method includes steps S10 to S40:

[0060] Step S10: building a user interface automation framework.

[0061] It should be noted that the user interface automation framework can be a set of tools, libraries, specifications and best practices for automated testing, which usually includes functions such as writing test scripts, preparing test data, configuring the test environment, controlling test execution, and reporting test results.

[0062] Step S20: Based on the user interface automation framework, the functional interface provided by the client is called according to the target interface document.

[0063] It should be noted that the target interface document is used to describe all functional interfaces provided by the client (such as applications, APIs, etc.), including the name of the interface, input parameters, output parameters, return values, error handling and other information. The functional interface is a mechanism provided by the client to allow external systems (such as test frameworks) to interact with it and call its specific functions. In web applications, these interfaces are usually RESTful APIs or GraphQL APIs; in mobile applications, the interface can be presented through HTTP requests, WebSockets or other protocols. The client can be a system or application that provides a functional interface, such as a web server, mobile application, desktop application, or any other system that can receive requests and return responses.

[0064] Step S30, receiving the operation result generated by the client, where the operation result corresponds to the functional interface.

[0065] It should be noted that the operation result is the data returned to the caller after the client processes the request. The operation result corresponds to the functional interface. It can be understood that the operation result received by the test framework from the client should correspond to the functional interface specified during the call.

[0066] Step S40: assert the operation result according to the test requirement and obtain the assertion result.

[0067] It should be noted that test requirements are rules or conditions that define how a software application should run to meet specific user or business goals. In automated testing, test requirements are used to guide the design and execution of test cases. Assertions are a key concept in automated testing, which are used to verify whether the behavior of the software is as expected. In a test script, assertions are used to check whether the results of an operation meet specific conditions or standards. The assertion result can be the result obtained after executing the assertion operation, which can be a Boolean value (true or false) indicating whether the assertion passes. In a test report, the assertion result is used to indicate the success or failure of the test.

[0068] In this embodiment, a user interface automation framework is built. Based on the user interface automation framework, the functional interface provided by the client is called according to the target interface document, and the operation result generated by the client is received. The operation result corresponds to the functional interface; the operation result is asserted according to the test requirements, and the assertion result is obtained. Through the UI automation framework, the user's operation behavior is simulated, and the functional interface of the client is called. The functional implementation of the client can be directly tested, and a variety of machine (vehicle) models can be quickly adapted, reducing the debugging and writing costs of automation use cases, and improving the coverage of automated testing.

[0069] Reference Figure 2 , Figure 2This is a flow chart of the second embodiment of the automated testing method of the present application. Figure 1 The first embodiment shown provides a second embodiment of the automated testing method of the present application.

[0070] In the second embodiment, the step S10 includes:

[0071] Step S101 , configuring the environment of the user interface automation framework, the environment including the Python environment and the Android environment.

[0072] It should be noted that Python is a programming language, and the Python environment refers to the process of installing the Python interpreter, libraries, and dependencies on a computer so that Python code can be written and run. Android is an open source mobile operating system jointly led and developed by Google and Open Mobile, mainly used in devices such as smartphones and tablets. The Android environment refers to the development environment set up for developing and testing Android applications, including the Android SDK, emulators or real devices, etc.

[0073] Step S102, building a Python client library and front-end testing tools based on the Python environment.

[0074] It should be noted that the Python client library refers to a library written in Python for interacting with specific services or systems. It is used as a bridge between the test framework and the system under test, enabling the test script to communicate with the system under test. The front-end testing tool refers to a tool used to test the front-end part of a Web or mobile application.

[0075] Step S103, based on the Android environment, install a test application, the test application has a factory command interface, a screenshot capture tool, and a touch screen simulation tool.

[0076] It should be noted that the test application can be understood as an application developed or configured for the purpose of testing, with a factory command interface, a capture screenshot tool, and a simulated touch screen tool, wherein the factory command interface can be a special functional interface that allows testers to control the behavior of the test application by sending specific instructions. Such as initializing the test environment, resetting the application state, triggering specific events, etc. The capture screenshot tool can be a tool for capturing screen images to record screen changes during the test process for subsequent analysis and verification. The simulated touch screen tool can be a tool for simulating user touch screen operations, which allows the test script to simulate user touch screen operations such as clicks, slides, and long presses to verify the interactivity of the application.

[0077] Step S104, when the Python client library and the front-end testing tool are built and the test application is installed, a user interface automation framework is obtained.

[0078] It is understandable that after completing necessary preparations (including configuring the environment, building tools, installing test applications, etc.), the user interface automation framework can be obtained and used.

[0079] For example, Figure 3 As shown in the figure, the environment configuration of the user interface automation framework is shown. You can install Python on the PC, and then install the Python module. The Python module includes the packaged Python client library (u2-client) and the front-end testing tool weditor. Install the test application (u2-app) on the mobile terminal. u2-app has a factory mode APP with a factory command interface, a screenshot capture tool minicap, and a simulated touch screen tool minitouch.

[0080] In this embodiment, by pre-configuring the Python environment and the Android environment, the tester can quickly start the test work without having to reconfigure the environment at the beginning of each test cycle. The factory command interface, capture screenshot tool, and simulated touch screen tool in the test application provide testers with a wealth of testing methods. The factory command interface allows testers to control the internal state of the test application, which is convenient for complex scenario testing. The capture screenshot tool helps record screen changes during the test process, which is convenient for problem tracking and test report writing. The simulated touch screen tool simulates user operations to verify the interactivity and user experience of the application. The introduction of the automated testing framework makes the testing work more systematic and standardized, reducing human errors and omissions.

[0081] Reference Figure 4 , Figure 4 This is a flow chart of the third embodiment of the automated testing method of the present application. Figure 2 The second embodiment shown provides a third embodiment of the automated testing method of the present application.

[0082] In the third embodiment, the step S20 includes:

[0083] Step S201, calling a functional interface according to user needs, the interface types include a user interface and a backend interface.

[0084] It should be noted that user requirements are the specific functions or goals that users hope the software or system can achieve when using the software or system. In software testing, understanding and accurately simulating user requirements is the key to ensuring software quality. Functional interfaces define how data is passed from one component to another and how these components communicate with each other. User interface interfaces are interfaces used in software systems to interact with users. Through user interface interfaces, user clicks, inputs and other operations can be simulated to verify the interactivity and user experience of the software. Backend interfaces are interfaces that process business logic and data storage in software systems.

[0085] Step S202: Based on the user interface, an interface call is made through the interface elements of the front-end testing tool.

[0086] It should be noted that interface elements refer to specific components or controls in the user interface, such as buttons, text boxes, labels, etc. In automated testing, interface elements are the basis for test scripts to interact with the software interface. By identifying and operating interface elements, test scripts can simulate user operations and verify the behavior of the software.

[0087] Step S203: Based on the backend interface, directly call the corresponding function through the client library.

[0088] It should be noted that the back-end interface usually does not interact directly with the user, but is called by the front-end or other systems through HTTP requests. In automated testing, directly calling the back-end interface can bypass the front-end interface and directly test the correctness and performance of the back-end logic.

[0089] Exemplarily, users can choose an implementation method according to specific needs. One is to click, slide or obtain information about a control through the user interface (UI). The interface of this implementation method is called a UI interface. The other is a specific function implementation, such as turning Bluetooth on and off or obtaining certain information about Bluetooth, such as a MAC address. The interface implemented in this way is called a backend interface. It can be understood that some operations can be implemented in both ways, such as turning Bluetooth on and off. The display of the weditor front-end page is achieved through minicap screenshots, and the corresponding operations are performed through minitouch. The interaction between weditor and minicap and minitouch is achieved through websocket communication, and atx-agent calls minicap and minitouch to execute, and then returns the operation results.

[0090] In this embodiment, by directly calling the functional interface according to user needs, the tester can quickly locate the functional point that needs to be tested, avoiding the cumbersome manual operation process in traditional testing. Using the front-end testing tool to call the interface through the user interface can ensure that the test process is as close to the user's actual usage scenario as possible. At the same time, direct calls based on the back-end interface can verify the correctness of the back-end logic. The combination of the two can fully cover all levels of the software, thereby improving the accuracy of the test.

[0091] In one embodiment, based on the above-mentioned third embodiment, the step S20 also includes: when the functional interface does not match the target interface document, adding a new interface definition to the target interface document to obtain an updated target interface document; based on the user interface automation framework, calling the functional interface provided by the client according to the updated target interface document.

[0092] It should be noted that the mismatch between the functional interface and the target interface document may be caused by changes in the interface specification, untimely document updates or poor communication. Adding a new interface definition to the target interface document can be understood as adding new interface names, parameters, return values ​​and other information to the document to ensure that the document is consistent with the actual interface implementation. Exemplarily, if the corresponding interface implementation is not found, the corresponding interface needs to be added in the u2-client. If it is an operation of the back-end interface, it needs to be implemented in the factory mode APP, otherwise the implementation in the original u2-app is extended. After the interface is implemented, add the corresponding call in the u2-client and add the usage document of the interface. Use it according to the method found in the document. If it is a UI operation, you also need to use the weditor front-end page to obtain the interface operation parameters, such as reourceId (resource ID), Xpath (XML Path Language) path and other parameters. Among them, in Android application development, resourceId (resource ID) is a unique identifier automatically assigned by the Android system to each resource (such as a view in a layout file). This ID is generated at compile time and used to reference resources at runtime. XPath (XML Path Language) is a language for finding information in XML documents. Although it was originally designed for XML, it is also widely used in HTML and similarly structured documents (such as web pages and some mobile application interfaces).

[0093] In this implementation, by updating the target interface document, it is ensured that all relevant interface definitions remain consistent, and the newly added interface definition can accurately reflect the actual functional interface provided by the client, thereby improving the accuracy of the interface document. By timely updating the interface document and adjusting the test script, it is possible to support rapid iteration of the project and ensure that new functions or fixes can be deployed quickly. The automated testing framework combined with the updated interface document can support the continuous integration process, ensuring that automated interface testing can be performed after each code submission, and problems can be discovered and fixed in a timely manner.

[0094] In one embodiment, step S30 includes: receiving the operation results generated by the client, the operation results including return data corresponding to the called functional interface; confirming the status and content of the operation results to ensure that the operation results conform to the expected output format; for the user interface, recording the interface element status and attributes, the interface element status and attributes are used for subsequent analysis; for the back-end interface, obtaining and recording the returned functional data.

[0095] It should be noted that the return data can be the data sent to the client after the functional interface receives and processes the request from the client. Exemplarily, the return data can be a simple success or failure flag, or a complex data structure, such as a data packet in JSON or XML format. The status of the operation result usually refers to the flag of whether the request is successfully executed (such as HTTP status code 200 for success, 404 for resource not found). Content can be understood as the specific information contained in the return data, which may be text, pictures, JSON objects, etc. The expected output format can be the format and structure that the tester or developer expects the data received from the functional interface to have according to the interface document or business logic. The state of the interface element can be the state of the interface element at a specific moment, such as whether a button is clicked, whether there is text in the input box, etc. Attributes refer to specific information of the interface element, such as the ID, class name, style, etc. of the element. This information is very important for subsequent analysis and testing. Functional data refers to data related to business logic or system functions returned through the back-end interface. These data may be user information, order data, inventory status, etc., which are crucial for the normal operation and decision-making of the system.

[0096] For example, Figure 5As shown, when the user calls the interface, u2-client will call u2-app or factory mode app to execute according to the specific implementation. If it is a UI operation, it will follow the logic based on native u2, and send the operation instruction to atx-agent through jsonrpc request, which will forward it to u2-app. u2-app contains a jsonrpc server AutomatorHttpServer. After receiving the request, the server will execute according to the logic of the implementation class AutomatorServiceImpl.

[0097] Among them, JSON-RPC allows running in the same process based on a variety of different message transmission environments such as Socket and HTTP, using JSON as the data format for remote procedure calls. atx-agent can be an agent program running on an Android device, responsible for communicating and controlling the device. AutomatorService is used to specify interfaces. When extending the interface of u2, you only need to add interface definitions to AutomatorService, and then implement the interface in AutomatorServiceImpl. For example, the new framework has added a new interface for getting progress bar values, which can set progress bar values ​​and other commonly used interfaces that are not supported by the original framework. If it is a back-end interface call, the factory mode instruction client is called directly through the adb shell, such as Figure 6 As shown in the figure, a factory command service is created in the factory mode APP, and specific implementations are added for the functional modules that need to be tested. Since most of the functions to be tested have been implemented in the general factory mode APP, the factory command service only needs to reuse the code of these modules to implement it. If it is not implemented, the framework layer can be called to implement it by itself. Commonly used operation interfaces such as Bluetooth, radio, wifi, system audio, brightness, etc. can be integrated. Finally, the operation interface is encapsulated into u2-client. Since there will be factory mode APPs for different machine (car) models, only the same instructions need to be used to implement the corresponding functions in the factory mode APP, so that the interface reuse of the same functions of different machine (car) models can be achieved directly, which also overcomes the problem that the UI interface often needs to change the use case due to the interface layout. After receiving the user's operation request, u2-client will directly call the factory command client integrated in the Android system through adb shell to execute. After the client recognizes the command entered by the user, it sends the command to the factory mode command server for execution. The operation results are returned layer by layer, and finally u2-client returns the results to the user.

[0098] In this implementation, by confirming the status and content of the operation results, it is possible to ensure that each functional interface works as expected, reduce test failures due to interface errors or data inconsistencies, and record the functional data returned by the back-end interface, which helps to quickly locate and analyze problems when they occur, thereby improving the maintainability of the system. By ensuring that the behavior of the user interface is as expected, the user's satisfaction and experience when using the system can be improved, and problems with interface elements can be discovered and fixed in a timely manner, which can reduce the risk of system failures in a production environment. This helps protect the reputation and interests of the enterprise and avoid losses caused by system problems.

[0099] Reference Figure 7 , Figure 7 This is a flow chart of the fourth embodiment of the automated testing method of the present application. Figure 4 The third embodiment shown provides a fourth embodiment of the automated testing method of the present application.

[0100] In the third embodiment, the step S40 includes:

[0101] Step S401, extracting the status and content in the operation result for assertion according to predefined test cases and requirements.

[0102] It should be noted that a test case can be a set of predefined inputs, execution conditions, and expected results, used to test a specific function or scenario. An assertion is a checkpoint set in the code to verify whether the state of the program at a specific point meets expectations. If the asserted condition is true (i.e., meets expectations), the program continues to execute; if it is false (i.e., does not meet expectations), an exception or error is thrown, which usually causes the test to fail.

[0103] Step S402: Use the assertion library to verify the operation result and compare whether the actual result is consistent with the expected result.

[0104] It should be noted that the assertion library can be a library or module that provides assertion functions, usually including a set of predefined assertion methods for verifying the operation results in the test. The actual result can be understood as the real result returned by the operation when the test is executed, and the expected result can be the expected result defined according to the test case and requirements.

[0105] Step S403, recording the assertion result, where the assertion result includes success information and failure information.

[0106] It should be noted that the assertion result is the result obtained after executing the assertion operation, including success information and failure information. Success information can indicate that the assertion condition is met and the test point is verified, and failure information can indicate that the assertion condition is not met and the test point is not verified, and can also include the specific reason for the failure.

[0107] In this embodiment, by asserting the state and content in the operation results according to predefined test cases and requirements, the tester can accurately define the expected results of the test, thereby ensuring the accuracy of the test. Using the assertion library for verification, the actual results can be automatically compared with the expected results, which greatly improves the efficiency of the test and reduces the tediousness and errors of manual verification. When the actual results are inconsistent with the expected results, the assertion failure will be captured and recorded immediately. This allows testers to quickly locate the problem without spending a lot of time troubleshooting. Through comprehensive assertion verification, it can be ensured that the software meets the expected requirements in multiple dimensions (such as functionality, performance, security, etc.). This helps to improve the overall quality of the software.

[0108] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the automated testing method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0109] This application also provides an automated testing device, please refer to Figure 8 , the automated testing device comprises:

[0110] A framework building module 10 is used to build a user interface automation framework;

[0111] The interface calling module 20 is used to call the functional interface provided by the client according to the target interface document based on the user interface automation framework;

[0112] A result receiving module 30, used to receive an operation result generated by a client, wherein the operation result corresponds to the functional interface;

[0113] The result assertion module 40 is used to assert the operation result according to the test requirements and obtain the assertion result.

[0114] The automated testing device provided by the present application adopts the automated testing method in the above embodiment, which can solve the technical problem of poor adaptability of test cases. Compared with the prior art, the beneficial effects of the automated testing device provided by the present application are the same as the beneficial effects of the automated testing method provided by the above embodiment, and other technical features in the automated testing device are the same as the features disclosed in the above embodiment method, which will not be described in detail here.

[0115] The present application provides an automated testing device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the automated testing method in the above-mentioned embodiment one.

[0116] Reference below Fig. 9 , which shows a schematic diagram of the structure of the automated test equipment suitable for implementing the embodiment of the present application. The automated test equipment in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The automated testing equipment shown is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present application.

[0117] like Fig. 9 As shown, the automated test equipment may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the automated test equipment are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the automated test equipment to communicate with other equipment wirelessly or by wire to exchange data. Fig. 9 An automated test apparatus having various systems is shown, but it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented or have instead.

[0118] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0119] The automated testing equipment provided by the present application adopts the automated testing method in the above embodiment, which can solve the technical problem of poor adaptability of test cases. Compared with the prior art, the beneficial effects of the automated testing equipment provided by the present application are the same as the beneficial effects of the automated testing method provided by the above embodiment, and the other technical features in the automated testing equipment are the same as the features disclosed in the method of the previous embodiment, which will not be described in detail here.

[0120] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0121] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0122] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the automated testing method in the above-mentioned embodiment.

[0123] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0124] The computer-readable storage medium may be included in the automated testing equipment; or may exist independently without being assembled into the automated testing equipment.

[0125] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the automated testing equipment, the automated testing equipment: builds a user interface automation framework; based on the user interface automation framework, calls the functional interface provided by the client according to the target interface document; receives the operation result generated by the client, and the operation result corresponds to the functional interface; asserts the operation result according to the test requirements and obtains the assertion result.

[0126] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0128] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0129] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned automated testing method, and can solve the technical problem of poor adaptability of test cases. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the automated testing method provided by the above-mentioned embodiment, and will not be described in detail here.

[0130] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned automated testing method when executed by a processor.

[0131] The computer program product provided by the present application can solve the technical problem of poor adaptability of test cases. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the automated testing method provided by the above embodiment, which will not be repeated here.

[0132] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. An automated testing method, characterized in that: The method includes: Build a user interface automation framework; Based on the user interface automation framework, calling the functional interface provided by the client according to the target interface document; receiving an operation result generated by a client, wherein the operation result corresponds to the functional interface; Assert the operation result according to the test requirements and obtain the assertion result.

2. The method according to claim 1, characterized in that The steps of building a user interface automation framework include: Configuring an environment of a user interface automation framework, the environment including a Python environment and an Android environment; Based on the Python environment, build Python client library and front-end testing tools; Based on the Android environment, a test application is installed, wherein the test application has a factory command interface, a screenshot capture tool, and a touch screen simulation tool; When the Python client library and the front-end testing tool are built and the test application is installed, a user interface automation framework is obtained.

3. The method according to claim 2, characterized in that The step of calling the functional interface provided by the client according to the target interface document based on the user interface automation framework includes: Call the functional interface according to user needs, the interface types include user interface and backend interface; Based on the user interface, an interface call is made through the interface elements of the front-end testing tool; Based on the backend interface, the corresponding function is directly called through the client library.

4. The method according to claim 3, characterized in that The step of calling the functional interface provided by the client according to the target interface document based on the user interface automation framework also includes: When the functional interface does not match the target interface document, adding an interface definition to the target interface document to obtain an updated target interface document; Based on the user interface automation framework, a functional interface provided by the client is called according to the updated target interface document.

5. The method according to claim 4, characterized in that The step of receiving the operation result generated by the client, wherein the operation result corresponds to the functional interface, comprises: Receive an operation result generated by the client, the operation result including return data corresponding to the called functional interface; Confirm the status and content of the operation result to ensure that the operation result conforms to the expected output format; For the user interface, record the interface element status and attributes, the interface element status and attributes are used for subsequent analysis; For the backend interface, the returned functional data is obtained and recorded.

6. The method according to claim 5, characterized in that The step of asserting the operation result according to the test requirements and obtaining the assertion result includes: According to predefined test cases and requirements, extract the status and content in the operation results for assertion; Use the assertion library to verify the operation results and compare whether the actual results are consistent with the expected results; The assertion result includes success information and failure information.

7. An automated testing device, characterized in that: The device comprises: Framework building module, used to build the user interface automation framework; An interface calling module, used to call a functional interface provided by a client according to a target interface document based on the user interface automation framework; A result receiving module, used to receive an operation result generated by a client, wherein the operation result corresponds to the functional interface; The result assertion module is used to assert the operation result according to the test requirements and obtain the assertion result.

8. An automated testing device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the automated testing method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the automated testing method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the automated testing method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Test method and device for vehicle-mounted system

    CN116028343A

  • Vehicle-mounted interface test method, electronic equipment and storage medium

    CN116244210A