Application program testing device and method, computer program product and storage medium
By providing a vehicle computer application testing device and method, automated test cases can be generated and executed, the problem that the prior art cannot test vehicle computer applications equipped with multiple operating systems is solved, and efficient automated testing of dual systems of Linux and Android is realized.
Patent Information
- Application Number
- CN202411851135.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-28
AI Technical Summary
The existing technology cannot effectively test vehicle applications equipped with multiple operating systems, especially the dual systems of Linux and Android.
It provides a vehicle computer application testing device and method, including an automated test case management module, a detection module, an execution module and an instruction sending module, which can generate automated test cases, perform screenshots, image detection and control detection operations, and convert test steps into operation instructions to send to the tested device.
It realizes automated testing of automotive applications equipped with multiple operating systems, solves the problem that dual systems of Linux and Android cannot be tested simultaneously, and improves testing efficiency and adaptability.
Smart Images

Figure CN119718941A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application testing, and in particular to a vehicle computer application testing device, a vehicle computer application testing method, a computer program product and a storage medium. Background Art
[0002] At present, the degree of informatization of private cars is getting higher and higher, and there are more and more car computer software, and the functions of these software are becoming more and more complex. In order to ensure the quality of car computer software, a lot of testing work needs to be done on it. The manual testing method in the prior art obviously cannot meet the growing testing needs. In addition, although there are also automatic testing devices for car computer software in the prior art, the automatic testing device can only be applied to car computers with a single operating system, and cannot test applications installed on car computers with multiple operating systems.
[0003] For example, when the car computer uses a customized operating system with Linux and Android dual systems, the Android system runs on the Linux system, and the user operates on the HMI (a customized interactive interface based on embedded Linux), and the HMI forwards the operation instructions to the Linux system or the Android system through the gateway. Due to the problems of inconsistent software testing methods under different operating systems and incompatibility of testing tools, the mainstream testing devices in the prior art cannot well support car computers equipped with multiple operating systems.
[0004] In addition, the vehicle computer and the screen are set separately, which further makes it impossible for the mainstream testing equipment in the existing technology to well support vehicle computers equipped with multiple operating systems.
[0005] Therefore, in order to shorten the testing time and improve the testing efficiency, it becomes particularly important to develop a highly adaptable and efficient automated testing system and method to replace manual testing. Summary of the invention
[0006] The purpose of the present invention is to address the deficiencies in the prior art and provide an application testing device, which includes an automated test case management module, a detection module, an execution module and an instruction sending module, wherein the detection module is respectively connected to the automated test case management module and a device under test, the execution module is respectively connected to the detection module and the instruction sending module, the instruction sending module is connected to the device under test, the automated test case management module is used to generate automated test cases, the detection module is used to perform screenshot, image detection, and control detection operations, the execution module is used to execute the automated test cases, and the instruction sending module is used to convert the test steps of the automated test cases into operation instructions.
[0007] Preferably, the application testing device also includes a reporting module, which is connected to the instruction sending module. The reporting module receives the execution status data and screenshot data of the automated test case sent back by the tested device through the instruction sending module. The reporting module is also used to generate a test report.
[0008] Preferably, the detection module includes an Android control detection library and a control image detection library; the execution module includes an Android control execution library and a Linux control execution library; and the instruction sending module includes a Python function library and a hardware transmission device.
[0009] The present invention also provides an application testing method, which comprises the following steps:
[0010] Step S1, generating automated test cases;
[0011] Step S2: Select the corresponding target control according to the test steps set in the automated test case;
[0012] Step S3, parsing the selected target control to obtain information of the target control;
[0013] Step S4: Execute the test steps set in the automated test case for the selected target control;
[0014] Step S5: interpret the test steps set in the automated test case into operation instructions, and send the operation instructions to the device under test;
[0015] Step S6: Collect the execution status information of each test step and the screenshot of the screen interface of the tested device;
[0016] Step S7: Analyze the collected data information and generate test results.
[0017] Preferably, the method for generating automated test cases in step S1 is:
[0018] Step S101, create a general test module directory and a global configuration directory in the test project root directory;
[0019] Step S102: create a vehicle model directory for each vehicle model under the total test module directory;
[0020] Step S103, define global variables, global methods and reference Python libraries in the global configuration directory;
[0021] Step S104, creating a function module directory for each function module under each vehicle model directory;
[0022] Step S105: create a test suite for each subordinate function set in each function module directory, and create a function configuration directory;
[0023] Step S106: define the configuration parameters of the function module and the test methods specific to the function module under the function configuration directory;
[0024] Step S107, enabling any test suite to reference the content of the corresponding functional configuration;
[0025] Step S108: Create an automated test case under the test suite, and generate test steps in the automated test case.
[0026] Preferably, in step S3, when the selected target control is an Android control, step S31 is executed, and when the selected target control is a Linux control image, step S32 is executed;
[0027] Step S31, parsing the page hierarchy of the Android control to obtain the coordinates and operable state of the Android control;
[0028] Step S32: Acquire the coordinates of the center point of the target control image on the screen through image recognition.
[0029] Preferably, in step S4, when executing the test step, it is determined whether the Android control execution library or the control image execution library needs to be called, if the control image execution library needs to be called, step S41 is executed, and if the Android control execution library needs to be called, step S42 is executed;
[0030] Step S41, matching the acquired target control information with the control image execution library, and obtaining the corresponding first execution method after matching, and simulating the operation of the HMI through the first execution method;
[0031] Step S42: first call the control image execution library, simulate clicking the app icon from the HMI, then start the app and switch it to the foreground, and then call the Android control execution library to perform operations on the Android control.
[0032] Preferably, before executing step S1, the following two steps are executed:
[0033] Step S11, obtaining the package information of the application and the location information of the target control of the application;
[0034] Step S12: Get a screenshot of the screen interface of the device under test, and capture a picture of the target control from the screenshot.
[0035] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the above-mentioned application program testing method are implemented.
[0036] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program is used to implement the steps of the above-mentioned application program testing method when executed by a processor.
[0037] The present invention solves the problem that the automated testing of applications for vehicle terminals (vehicle computers) based on embedded Linux and Android dual operating systems cannot be advanced. The present invention provides a vehicle computer application testing method and a vehicle computer application testing device, which can be automatically executed through a predefined execution strategy without manual intervention. Compared with the prior art, the present invention has the following beneficial effects:
[0038] 1. Solved the problem that Linux and Android dual systems cannot be tested at the same time;
[0039] 2. Use case functions are decoupled, and use cases can be written in parallel;
[0040] 3. Automated test cases can be executed in functional modules or combined;
[0041] 4. The resources required for specific functional testing are also stored only in the functional modules, with clear hierarchy and simple writing. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to better understand the above and other purposes, features, advantages and functions of the present invention, reference may be made to the embodiments shown in the accompanying drawings. The same reference numerals in the accompanying drawings refer to the same components. It should be understood by those skilled in the art that the accompanying drawings are intended to schematically illustrate the preferred embodiments of the present invention and have no limiting effect on the scope of the present invention, and the components in the drawings are not drawn to scale.
[0043] Figure 1 is a schematic diagram of the structure of the application program testing device in the first embodiment of the present invention;
[0044] Figure 2 is a flowchart of an application program testing method in Embodiment 1 of the present invention;
[0045] Figure 3 It is a flowchart of the method for generating automated test cases in the first embodiment of the present invention.
[0046] Automated test case management module 1, detection module 2, execution module 3, instruction sending module 4, reporting module 5 and tested device 6. DETAILED DESCRIPTION
[0047] The above and other technical features and advantages of the present invention are described in more detail below in conjunction with the accompanying drawings.
[0048] In the description of the present invention, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, unless otherwise clearly and specifically defined.
[0049] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection, an electrical connection, or communication with each other; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0050] In the description of this specification, reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention.
[0051] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0052] In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0053] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.
[0054] Embodiment 1
[0055] Before describing the technical solution of the present invention, some explanations are given on the terms used.
[0056] 1. HMI
[0057] HMI is the abbreviation of Human Machine Interface, which means human-machine interface. In the present invention, preferably, HMI is an operating interface of a customized operating system with Linux and Android dual systems.
[0058] 2. Controls
[0059] A control is an object that a user can interact with to input or manipulate data. For example: a window, text box, button, drop-down menu, etc.
[0060] 3. CAN
[0061] CAN is the abbreviation of Controller Area Network, which is a serial communication protocol used for real-time applications and a commonly used data transmission protocol in automobiles.
[0062] The present embodiment provides a vehicle computer application testing device, which includes an automated test case management module 1, a detection module 2, an execution module 3, an instruction sending module 4 and a reporting module 5. The detection module 2 is respectively connected to the automated test case management module 1 and the device under test 6. The execution module 3 is respectively connected to the detection module 2 and the instruction sending module 4. The instruction sending module 4 is respectively connected to the reporting module 5 and the device under test 6.
[0063] like Figure 1 As shown, the automated test case management module 1 is used to generate automated test cases, that is, the automated test case management module 1 is used to organize, create, edit, and configure automated test cases. Preferably, the automated test case management module 1 is associated with manual test cases. The module is also used to manage configuration files and parameters.
[0064] The detection module 2 is used to perform screenshot, image detection, and control detection operations. The detection module 2 includes an Android control detection library and a control image detection library.
[0065] Execution module 3 is used to execute automated test cases. Execution module 3 includes Android control execution library and Linux control execution library. Execution module 3 can be used to simulate HMI touch operation and restore real usage scenarios.
[0066] The instruction sending module 4 is used to interpret the actions of the automated test case into operation instructions and send them to the device under test 6, so that the device under test 6 performs the corresponding actions. The instruction sending module 4 can also send the response data and image data returned by the device under test 6 to the reporting module 5;
[0067] The reporting module 5 is used to receive the execution status data and screenshot data of the test case sent back by the tested device 6, and analyze the data to determine whether the execution of the automated test case is successful. The reporting module 5 can organize the test logs and reports, send the execution results of each automated test case back to the corresponding test case, and automatically create a bug ticket.
[0068] Preferably, the screenshot operation performed in the detection module 2 refers to: an operation of capturing a real-time screen image of the tested device 6 (vehicle computer). Further, the detection module 2 saves the captured image in a .jpg format.
[0069] Preferably, the image detection operation performed in the detection module 2 is used to detect whether the current screenshot of the device under test 6 (vehicle computer) contains target content that needs to be detected.
[0070] Preferably, the detection objects of the control detection operation performed in the detection module 2 include control feature information, control coordinates, text and QR code. Further, when the detection module 2 performs a control detection operation on an Android control, the detection objects include the control position, state, name and text of an application based on the Android system.
[0071] Preferably, the instruction sending module 3 includes a python function library and a hardware transmission device. Further, the python function library is used to assemble the test instruction data and to call the interface function provided by the hardware transmission device.
[0072] Preferably, the hardware transmission device includes a USB to CAN device, a CAN protocol data transmission device, and a TCP / IP protocol data transmission device.
[0073] like Figure 2 As shown, this embodiment provides a vehicle computer application testing method, which includes:
[0074] Step S1, generating automated test cases;
[0075] Step S2: Select the corresponding target control according to the test steps set in the automated test case;
[0076] Step S3, parsing the selected target control to obtain information of the target control;
[0077] Step S4: Execute the test steps set in the automated test case for the selected target control;
[0078] Step S5, interpreting the test steps set in the automated test case into operation instructions, and sending the operation instructions to the device under test 6;
[0079] Step S6, collecting the execution status information of each test step and the screenshot of the screen interface of the tested device 6;
[0080] Step S7: Analyze the collected data information and generate test results.
[0081] Preferably, before executing step S1, the following two steps are performed:
[0082] Step S11, obtaining the package information of the application and the location information of the target control of the application;
[0083] Step S12: Get a screenshot of the screen interface of the device under test 6, and capture a picture of the target control from the screenshot.
[0084] The target control refers to the control to be automated. The target control includes the control of the Android application and the control of the underlying Linux system of the device under test 6 (vehicle computer).
[0085] Preferably, in step S12, a picture of the target control is captured from the screenshot and saved in a specific directory of the automated test project, and the picture path is defined as a parameter.
[0086] Preferably, since it is necessary to operate controls according to specific requirements when executing the test steps set in the automated test case, it is necessary to select the corresponding target control in the execution step S2.
[0087] Preferably, in step S3, when the selected target control is an Android control, step S31 is executed, and when the selected target control is a Linux control image, step S32 is executed.
[0088] Step S31, parsing the page hierarchy of the Android control to obtain the coordinates and operable state of the Android control;
[0089] Step S32: Acquire the coordinates of the center point of the target control image on the screen through image recognition.
[0090] Preferably, in step S4, when executing the test step, it is determined whether the Android control execution library or the control image execution library needs to be called, if the control image execution library needs to be called, step S41 is executed, if the Android control execution library needs to be called, step S42 is executed;
[0091] Step S41, matching the information of the target control obtained in step S3 with the control image execution library, and obtaining the first execution method after matching, and simulating the operation of the HMI through the first execution method;
[0092] Step S42: first call the control image execution library, simulate clicking the app icon from the HMI, then start the app and switch it to the foreground, and then call the Android control execution library to perform operations on the Android control.
[0093] Preferably, if Figure 3 As shown, the method for generating automated test cases in step S1 is:
[0094] Step S100, the test project creates a test project root directory;
[0095] Step S101, create a general test module directory and a global configuration directory in the test project root directory;
[0096] Step S102: create a vehicle model directory for each vehicle model under the total test module directory;
[0097] Step S103, define global variables, global methods and reference Python libraries in the global configuration directory;
[0098] Step S104, creating a function module directory for each function module under each vehicle model directory;
[0099] Step S105: create a test suite for each subordinate function set in each function module directory, and create a function configuration directory;
[0100] Step S106: define the configuration parameters of the function module and the test methods specific to the function module under the function configuration directory;
[0101] Step S107, enabling any test suite to reference the content of the corresponding functional configuration;
[0102] Step S108: Create an automated test case under the test suite, and generate test steps in the automated test case.
[0103] As described in step S106, the configuration parameters of the function module and the test methods specific to the function module are defined under the function configuration directory. The purpose of defining the function configuration here is to provide one-to-one configuration capabilities for the function module and to reference the content of the global configuration in a one-way manner. That is, the function module configuration can read the content of the global configuration, but not vice versa. If the reference is made bidirectionally, after being passed layer by layer, a function module configuration can read the content of other function module configurations, which disrupts the purpose of providing one-to-one configuration.
[0104] In step S107, each test suite must reference the content of the functional configuration so that the methods and parameters of the functional configuration, the methods and parameters of the global configuration example and all Python function libraries can be used in the use case.
[0105] In step S108, the test steps in the use case call the parameters and methods defined in their own function configuration, the parameters and methods defined in the global configuration, and the python function library referenced by the global configuration. The test steps can be assembled as needed to complete the simulation of complex usage scenarios. After the test steps are written, the end steps are written to complete some garbage data and on-site recovery operations.
[0106] The present invention solves the problem that the automated testing of applications for vehicle terminals (vehicle computers) based on embedded Linux and Android dual operating systems cannot be advanced. The present invention provides a vehicle computer application testing method and a vehicle computer application testing device, which can be automatically executed through a predefined execution strategy without manual intervention. Specific beneficial effects include:
[0107] 1. Solved the problem that Linux and Android dual systems cannot be tested at the same time;
[0108] 2. Use case functions are decoupled, and use cases can be written in parallel;
[0109] 3. Automated test cases can be executed in separate functional modules or combined; automated test cases can be divided or combined;
[0110] 4. The resources required for specific functional testing are also stored only in the functional modules, with clear hierarchy and simple writing.
[0111] Embodiment 2
[0112] The present embodiment is different from the first embodiment in that: preferably, a vehicle-machine application testing method is provided, and the method can be implemented by the vehicle-machine application testing device in the first embodiment.
[0113] The automated test case management module 1 is used to execute step S1 to generate automated test cases.
[0114] The detection module 2 is used to execute step S2 and step S3. The execution module 3 is used to execute step S4. The detection module 2 can also perform a screenshot operation.
[0115] The instruction sending module 4 is used to execute step S5. That is, by calling the instruction sending module 4, the test step is interpreted into an operation instruction, and the operation instruction is sent to the device under test 6. Preferably, the instruction sending module 4 sends the operation instruction to the vehicle computer through a hardware link, and the vehicle computer distributes the operation instruction to the underlying Linux or upper Android system to perform the operation on the control.
[0116] The instruction sending module 4 is also used to execute step S6. The instruction sending module 4 forwards the execution status information of each test step collected in step S6 and the screenshot of the screen interface of the tested device 6 to the reporting module 5. That is, the instruction sending module 4 is called to collect the execution status of each test step and the screenshot of the vehicle computer, and then sent back to the reporting module 5.
[0117] The reporting module 5 is used to execute step S7. The reporting module 5 collects the execution status of all steps and the screenshots of the vehicle computer, analyzes them, and generates test results, test reports and test logs.
[0118] The vehicle computer application testing method in this embodiment is explained by an example. Taking the diagnosis of the online music playback function of the GP vehicle computer as an example, the application testing method includes: generating an automated test case for testing the online music playback function. Call the detection module 2, select the corresponding target control (play button) according to the test steps set in the automated test case, further parse the control, and obtain the coordinates of the center point of the control and the operable state. Call the execution module 3 to execute the steps defined in the corresponding automated test case for the selected corresponding target control. The overall test logic is: click the icon of the online music app from the HMI interface, then click the play button, and then determine whether the play button icon has changed to the playing appearance.
[0119] Then, the instruction sending module 4 is called to interpret the operation steps defined in the automation case into operation instructions, and the operation instructions are sent to the tested device 6 (vehicle computer) through the hardware link. The vehicle computer distributes the operation instructions to the underlying Linux or upper Android system to perform operations on the controls. At this time, the vehicle computer will first open the online music app from the HMI interface, then click the play button, and then determine whether the play button icon has changed to the playing state. If it has changed to the playing state, the test case execution status is recorded as successful execution; the instruction sending module 4 is called to collect the execution status of each test step and the screenshot of the vehicle computer, and return them to the reporting module 5; the reporting module 5 collects the execution status of all steps and the screenshot of the vehicle computer, analyzes them, and generates test results, test reports and test logs.
[0120] Embodiment 3
[0121] The difference between this embodiment and the first and second embodiments is that: this embodiment provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, all the steps of the vehicle application program testing method in the first or second embodiment are implemented.
[0122] Embodiment 4
[0123] The difference between this embodiment and the third embodiment is that: this embodiment provides a computer-readable storage medium, which stores the computer program in the third embodiment, and when the computer program is executed by the processor, it is used to implement all the steps of the vehicle application testing method in the first or second embodiment.
[0124] The above are only specific embodiments of the present invention, but the technical features of the present invention are not limited thereto. Any simple changes, equivalent replacements or modifications made based on the present invention to solve basically the same technical problems and achieve basically the same technical effects are all included in the protection scope of the present invention.
Claims
1. An application testing device, characterized in that: It includes an automated test case management module, a detection module, an execution module and an instruction sending module. The detection module is respectively connected to the automated test case management module and the device under test, the execution module is respectively connected to the detection module and the instruction sending module, and the instruction sending module is connected to the device under test. The automated test case management module is used to generate automated test cases, the detection module is used to perform screenshot, image detection, and control detection operations, the execution module is used to execute the automated test cases, and the instruction sending module is used to convert the test steps of the automated test cases into operation instructions.
2. An application testing device as claimed in claim 1, characterized in that: It also includes a reporting module, which is connected to the instruction sending module. The reporting module receives the execution status data and screenshot data of the automated test case sent back by the tested device through the instruction sending module. The reporting module is also used to generate a test report.
3. An application testing device as claimed in claim 1, characterized in that: The detection module includes an Android control detection library and a control image detection library; the execution module includes an Android control execution library and a Linux control execution library; the instruction sending module includes a Python function library and a hardware transmission device.
4. An application testing method, characterized in that: It includes the following steps: Step S1, generating automated test cases; Step S2: Select the corresponding target control according to the test steps set in the automated test case; Step S3, parsing the selected target control to obtain information of the target control; Step S4: Execute the test steps set in the automated test case for the selected target control; Step S5: interpret the test steps set in the automated test case into operation instructions, and send the operation instructions to the device under test; Step S6: Collect the execution status information of each test step and the screenshot of the screen interface of the tested device; Step S7: Analyze the collected data information and generate test results.
5. An application testing method as claimed in claim 4, characterized in that: The method for generating automated test cases in step S1 is: Step S101, create a general test module directory and a global configuration directory in the test project root directory; Step S102: create a vehicle model directory for each vehicle model under the total test module directory; Step S103, define global variables, global methods and reference Python libraries in the global configuration directory; Step S104, creating a function module directory for each function module under each vehicle model directory; Step S105: create a test suite for each subordinate function set in each function module directory, and create a function configuration directory; Step S106: define the configuration parameters of the function module and the test methods specific to the function module under the function configuration directory; Step S107, enabling any test suite to reference the content of the corresponding functional configuration; Step S108: Create an automated test case under the test suite, and generate test steps in the automated test case.
6. An application testing method as claimed in claim 4, characterized in that: In step S3, when the selected target control is an Android control, step S31 is executed, and when the selected target control is a Linux control image, step S32 is executed; Step S31, parsing the page hierarchy of the Android control to obtain the coordinates and operable state of the Android control; Step S32: Acquire the coordinates of the center point of the target control image on the screen through image recognition.
7. An application testing method as claimed in claim 4, characterized in that: In step S4, when executing the test step, it is determined whether the Android control execution library or the control image execution library needs to be called. If the control image execution library needs to be called, step S41 is executed; if the Android control execution library needs to be called, step S42 is executed; Step S41, matching the acquired target control information with the control image execution library, and obtaining the corresponding first execution method after matching, and simulating the operation of the HMI through the first execution method; Step S42: first call the control image execution library, simulate clicking the app icon from the HMI, then start the app and switch it to the foreground, and then call the Android control execution library to perform operations on the Android control.
8. An application testing method as claimed in claim 4, characterized in that: Before executing step S1, perform the following two steps: Step S11, obtaining the package information of the application and the location information of the target control of the application; Step S12: Get a screenshot of the screen interface of the device under test, and capture a picture of the target control from the screenshot.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of an application testing method as described in any one of claims 4 to 8 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it is used to implement the steps of an application testing method as described in any one of claims 4-8.