CN117827657A - Test method and system based on OpenHarmony application and electronic equipment - Google Patents

Test method and system based on OpenHarmony application and electronic equipment Download PDF

Info

Publication number
CN117827657A
CN117827657A CN202311872109.XA CN202311872109A CN117827657A CN 117827657 A CN117827657 A CN 117827657A CN 202311872109 A CN202311872109 A CN 202311872109A CN 117827657 A CN117827657 A CN 117827657A
Authority
CN
China
Prior art keywords
test
terminal
application
tested
openharmony
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311872109.XA
Other languages
Chinese (zh)
Inventor
柯历
邓晓春
刘捷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Landi Commercial Equipment Co Ltd
Original Assignee
Fujian Landi Commercial Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Landi Commercial Equipment Co Ltd filed Critical Fujian Landi Commercial Equipment Co Ltd
Priority to CN202311872109.XA priority Critical patent/CN117827657A/en
Publication of CN117827657A publication Critical patent/CN117827657A/en
Pending legal-status Critical Current

Links

Landscapes

  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention discloses a test method, a test system and electronic equipment based on OpenHarmony application, which adopt a cross-platform script tool to generate test scripts through OpenHarmony commands, wherein the hdc command-based tool can simulate user input, so that the limitation that the OpenHarmony automatic test framework scheme needs writing in Deveco is avoided. And the higher stability can be ensured based on PowerShell scripts, and the requirement of the current test times is met. Meanwhile, the hdc command tool supports target equipment instructed by parameters, and can realize that the PC can operate a plurality of equipment simultaneously by combining with PowerShell; and the hdc command tool can realize full event input and memory information return, and the memory information is recorded to the memory information record of the file realization operation process by combining PowerShell. Therefore, the pressure test of the receipt application to the transaction scene is met, and the problems of low test efficiency and poor test effect are solved.

Description

Test method and system based on OpenHarmony application and electronic equipment
Technical Field
The invention relates to the technical field of financial application testing, in particular to a testing method and system based on OpenHarmony application and electronic equipment.
Background
With the continuous development of the finance digital service terminal and the continuous increase of the domestic demands, more and more finance terminals will choose to adopt a system based on the OpenHarmony platform.
However, the current test for the OpenHarmony application of the OpenHarmony system has the problems of low test efficiency and poor test effect.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the test method, the test system and the electronic equipment based on OpenHarmony application are provided, and the problems of low test efficiency and poor test effect are solved.
In order to solve the technical problems, the invention adopts the following technical scheme:
the test method based on the OpenHarmony application is characterized by being used for a test terminal, wherein the test terminal is used for testing the OpenHarmony application on the terminal to be tested, and the test terminal is connected with at least one terminal to be tested, and the method comprises the following steps:
acquiring application information of an application to be detected, wherein the application to be detected is an OpenHarmony application;
polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises a terminal to be tested connected with a test terminal;
acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line;
generating a test instruction according to the test item, wherein the test instruction is used for indicating a target terminal to be tested to run an application matched with the application information based on the test item;
and receiving a test result of the target terminal to be tested.
In order to solve the technical problems, the invention adopts another technical scheme that:
a distributed payment system comprises at least two payment terminals and a test terminal;
the test terminal is used for testing OpenHarmony application on the payment terminal, and is connected with all the payment terminals and used for:
acquiring application information of an application to be detected, wherein the application to be detected is an OpenHarmony application;
polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises a payment terminal connected with a test terminal;
acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line;
generating a test instruction according to the test item, wherein the test instruction is used for indicating a target terminal to be tested to run an application matched with the application information based on the test item;
and receiving a test result of the target terminal to be tested.
In order to solve the technical problems, the invention adopts another technical scheme that:
an electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, the processor implementing a test method based on an OpenHarmony application as described above when executing the computer program.
The invention has the beneficial effects that: the test terminal is used for testing the OpenHarmony application on the terminal to be tested, and the test terminal obtains application information of the application to be tested, wherein the application to be tested is the OpenHarmony application; obtaining a target terminal to be tested connected with the test terminal through polling; acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line; generating a test instruction according to the test item, wherein the test instruction is used for indicating a target terminal to be tested to run an application matched with the application information based on the test item; and finally, receiving the test result of the target terminal to be tested, and completing the test of OpenHarmony application on the terminal to be tested. By using the method, the test script in the test item is generated by using the cross-platform script tool through the OpenHarmony command line, so that a user can directly write and modify the test script on the test terminal, and the writing process is convenient; moreover, the cross-platform script tool has higher stability characteristics, so that the test script is more stable in test. Therefore, by the method, the test efficiency and the test effect of the OpenHarmony application of the OpenHarmony system can be improved, and the problems of low test efficiency and poor test effect of the test of the OpenHarmony application of the OpenHarmony system in the related technology are effectively solved.
Drawings
FIG. 1 is a flow chart of steps of a testing method based on an OpenHarmony application in an embodiment of the invention;
fig. 2 is a connection schematic diagram of a test method based on OpenHarmony application in an embodiment of the present invention;
FIG. 3 is a schematic diagram of a script writing method of a test method based on an OpenHarmony application in an embodiment of the invention;
FIG. 4 is a schematic diagram of a test system based on an OpenHarmony application according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical schemes and beneficial effects to be solved by the present application more clear, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
In the related art, a scenario-based test method is a method of performing a test based on an actual usage scenario. The software is comprehensively and deeply tested by simulating a real use scene so as to ensure that the performance and functions of the software under various conditions can be normally operated.
With the continuous development of the finance digital service terminal and the continuous increase of the domestic demands, more and more finance terminals will choose to adopt a system based on the OpenHarmony platform. However, the current test for the OpenHarmony application of the OpenHarmony system has the problems of low test efficiency and poor test effect.
However, test schemes for OpenHarmony native applications are currently known to exist:
(1) The test script is inconvenient to write and needs to be integrated in the application engineering. For example, current developers will conduct testing of OpenHarmony native applications through the DevEco tool (HUAWEIDevEco Studio). The DevEco tool is designed based on IntelliJ IDEA Community open source version, provides a one-stop distributed application development platform for all-scene multi-equipment, and supports distributed multi-terminal development and distributed multi-terminal adjustment; the development tool has the functions of basic code development, compiling construction, debugging and the like. However, when a developer develops by using the tool, the test script can only be modified in the application engineering of the tool, and after modification, clicking is needed to execute the test script, so that the program is complicated. Therefore, when testing the OpenHarmony native application, a developer must install a DevEco tool, modify the test script in the application engineering of the DevEco tool, and execute the modification by clicking alone, which is extremely inconvenient to use.
(2) The designated number of times of operation cannot be stabilized. The DevEco tool cannot stably run for a designated number of times, and if the number of times of running is too large, the DevEco tool can have running errors or cannot run.
(3) Simultaneous operation of multiple devices is not supported. The DevEco tool generally can only process a single device, and cannot be tested by multiple devices at the same time, so in actual testing, the DevEco tool needs to be operated on multiple testing terminals to be tested by multiple devices at the same time, and the procedure is complicated.
(4) Not all input events are supported. Because the DevEco tool can only write programs by users and cannot perform automatic testing, an OpenHarmony stability testing tool wukong (hereinafter referred to as a wukong tool) is developed in related technologies and is used as an important component of an OpenHarmony tool set, so that application stability testing basic capabilities of random event injection, control injection, anomaly capturing, report generation, data traversal screenshot of the accuracy and the like of the accuracy are realized. Although the wukong tool supports recording user operations and playback. But the wukong tool cannot support all input events, e.g., sliding, key input events, and the inter-event interval cannot be specified. I.e. it only provides a fixed centralized choice.
(5) The memory information cannot be recorded at the same time. The Wukong tool cannot record memory information at the same time, and cannot grasp part of test data.
Therefore, the testing requirements cannot be met with the OpenHarmony native application testing tools in the related art. The method can realize the simultaneous test of a plurality of devices and meet the pressure test of the receipt application on the transaction scene.
The application provides a test method, a test system and electronic equipment based on OpenHarmony application for solving the problems of (1) - (5) in the related art.
The following specifically describes the technical scheme of the test method of the application.
Referring to fig. 1, an embodiment of the present application provides a testing method based on OpenHarmony application, which is used for testing a terminal, where the testing terminal is used for testing OpenHarmony application on a terminal to be tested; the test terminal is connected with at least one terminal to be tested.
Referring to fig. 2, the test terminal may be a computer (PC), a mobile phone, and other intelligent devices capable of writing codes, and the terminal to be tested may be an intelligent terminal installed with OpenHarmony applications, such as a cash register, a financial POS machine, an intelligent POS machine, a card swiping machine, a face recognition terminal, a palm print recognition terminal, and a code scanner, where the terminal to be tested includes an intelligent device, such as an OpenHarmony device (abbreviated as an OH device), that is, the terminal to be tested may use OpenHarmony as an operating system to implement distributed connection with other terminals. Reference to distributed is first made to distributed computing. The distributed computing divides the computing problem into a plurality of small computing parts, distributes the computing parts to a plurality of computers which are connected with each other to participate in computing for parallel processing, and finally synthesizes the computing results to obtain a final result; distributed storage disperses data stored on multiple independent machine devices. The greatest benefit of distributed computing is that the computational power of the distributed connected computers can be exploited. The distributed connection is the same, and the terminals to be tested can be connected in a distributed mode, so that the capability of other terminals to be tested can be utilized to process payment. The distributed connection of the present application may be connected by way of a distributed soft bus. A distributed soft bus is a physical bus like hardware that is software, and all devices connected thereto are in the form of software, which is understood to be individual devices, since software can implement a decentralised, distributed arrangement. Moreover, the most important feature is that devices in the distributed soft bus can invoke the capabilities of other devices to process the request. For example, when a mobile phone and a computer are in distributed connection, the mobile phone can apply high computing power of the computer to process pictures in the mobile phone, and the computer can take pictures by using a high-definition camera of the mobile phone.
The test method based on the OpenHarmony application comprises steps S110-S150.
Step S110, acquiring application information of an application to be tested, wherein the application to be tested is an OpenHarmony application.
The application information may include application related information such as an application ID, an application package name, an application name, application version number information, etc. for subsequent matching; the matching may be based solely on application package names. For example, if it is desired to test a test item that the payment application in the intelligent POS machine is continuously clicked and still valid, the intelligent POS machine serves as a terminal to be tested, and the payment application serves as an application to be tested. And the application information of the payment application, for example, the application ID of which is PAYV1.0, can be obtained through step S110.
And step S120, polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises a terminal to be tested connected with the test terminal.
The test terminal and the terminal to be tested can be connected in a wired or wireless mode, for example, the terminal to be tested is connected with the test terminal through USB or TCP. The test is performed through TCP, so that the scene of fewer USB interfaces on the PC is met. Each terminal to be tested has its unique device identifier, and if the terminal to be tested is connected with a device through a wireless network, the identifier can be an IP address: port format. If the USB connection is passed, the device identification is the device SN number. As shown in fig. 2, the test terminal (PC) may poll all the connected terminals under test (OH devices), and select one or more terminals under test connected to the test terminal as a target terminal under test according to actual test requirements.
For example, when it is desired to test a test item that is continuously clicked on by a payment application in a smart POS while still being valid. The intelligent POS machine and the test terminal are connected through wires or wirelessly, and step S120 is performed after the connection, and the intelligent POS machine can be used as the acquired target terminal to be tested.
Step S130, obtaining test items input by a user, wherein the test items comprise test scripts, and the test scripts are generated through OpenHarmony command lines by using a cross-platform script tool.
If the test terminal PC runs the script, prompting the user to input the name of the application package to be run; the application package name is similar to the ID of the application to be tested, after the application package name is input, the application information to be tested is obtained, and then the connection of the OH equipment is waited for testing. The test script can be written based on the PC side. The cross-platform scripting tool comprises a PowerShell (a cross-platform task automation solution, which consists of a command line shell, a scripting language and a configuration management framework, wherein the PowerShell can run on Windows/Linux/macOS and other systems). The OpenHarmony command refers to a command line tool for debugging provided for a developer, for example, may be an HDC uinput command tool (hereinafter referred to as an HDC uinput command), and may, of course, also be other command line tools specifically designed for OpenHarmony. Through the tool, the development machine or simulator can be interacted on a Windows/Linux/MacOS system and the like. Step S130 may be performed before step S120, that is, after the test terminal obtains the test item input by the user, the test terminal polls to obtain the target terminal to be tested. For example, taking the test item that the payment application in the test smart POS is continuously clicked and still valid, the corresponding test script may be the process of the user inputting the payment application to continuously click. The user can edit a required test script according to the requirement through a cross-platform script tool on the PC corresponding to the test terminal.
In one embodiment of the present application, a cross-platform scripting tool comprises:
CukeTest: cukeTest is a cross-platform automatic testing tool, supports Qt automation, and can realize automation 1 of Qt-based or Qt Quick-built application.
PowerShell: powerShell is a cross-platform task automation solution, and consists of a command line shell, a scripting language and a configuration management framework. PowerShell can run 2 on Windows, linux and macOS.
Robot frame work: robot Framework is a generic automated test Framework that supports cross-platform task automation.
Taking PowerShell as an example, a user may write a test script on a PC corresponding to the test terminal through a PowerShell tool through an OpenHarmony command line, for example, through an HDC uinput command.
And step 140, generating a test instruction according to the test item, wherein the test instruction is used for indicating the target terminal to be tested to run the application matched with the application information based on the test item.
The OH equipment serving as the target terminal to be tested runs the application matched with the application information such as the application ID, the application name and the like based on the test script to test. For example, taking a test item that a payment application in the intelligent POS machine is continuously clicked and still valid as an example, the intelligent POS machine is used as a terminal to be tested, and the test instruction is used for instructing the intelligent POS machine to operate with the payment application with the ID of PAYV1.0 based on the continuous clicking of the process by the payment application input by a user.
And step S150, receiving a test result of the target terminal to be tested. Namely, receiving the test results fed back by all OH devices in the test.
The test terminal is used for testing the OpenHarmony application on the terminal to be tested, and the test terminal obtains application information of the application to be tested, wherein the application to be tested is the OpenHarmony application; obtaining a target terminal to be tested connected with the test terminal through polling; acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line; generating a test instruction according to the test item, wherein the test instruction is used for indicating a target terminal to be tested to run an application matched with the application information based on the test item; and finally, receiving the test result of the target terminal to be tested, and completing the test of OpenHarmony application on the terminal to be tested. By using the method, the test script in the test item is generated by using the cross-platform script tool through the OpenHarmony command line, so that a user can directly write and modify the test script on the test terminal, and the writing process is convenient; moreover, the cross-platform script tool has higher stability characteristics, so that the test script is more stable in test. Therefore, by the method, the test efficiency and the test effect of the OpenHarmony application of the OpenHarmony system can be improved, and the problems of low test efficiency and poor test effect of the test of the OpenHarmony application of the OpenHarmony system in the related technology are effectively solved.
Specifically, the method of the application adopts a cross-platform scripting tool to generate test scripts through OpenHarmony commands. The following technical effects can be achieved by utilizing the scheme of the application:
firstly, the cross-platform script tool is adopted to generate the test script through the OpenHarmony command line, for example, the PowerShell script tool is utilized to write the test script through the HDC uinput command on the test terminal, so that user input can be simulated without being integrated in an application project, and therefore the problem that the OpenHarmony automatic test framework scheme is inconvenient to write the test script and needs to be integrated in the application project is solved.
Secondly, the higher stability can be ensured based on a cross-platform script tool (such as a PowerShell script tool), so that the test stability can be kept when the repeated test is executed for a plurality of times, the requirement of the current test times is met, and the problem that the DevEco cannot stably run the designated test times is solved.
Thirdly, the HDC uinput command supports target devices which are designated by parameters, the PowerShell tool can realize that the PC can operate a plurality of devices simultaneously, all target devices which are designated by the HDC uinput command can operate simultaneously based on the PowerShell tool, and the problem that the DevEco does not support the simultaneous testing of a plurality of devices is solved.
Fourth, the HDC uinput command enables full event input, solving the problem that Wukong tools do not support all input events.
Fifthly, the HDC uinput command can be coded through related instructions, memory information is returned through the PowerShell tool, and the PowerShell tool is combined to record the memory information to the memory information record of the file in the running process, so that the problem that the wukong tool cannot record the memory information at the same time is solved. Therefore, the pressure test of the receipt application to the transaction scene is met, and the problems of low test efficiency and poor test effect are solved.
Meanwhile, the scheme is particularly suitable for the receipt application in the financial field, and because the receipt application in the financial field needs higher stability, the scene pressure test needs to be carried out. The scene pressure test refers to: by performing continuous high frequency stress testing on some typical usage scenarios of the device, failure problems and related positioning information of the device during the period are collected to assist the device developer in assessing and optimizing the stability of the design under the scenario.
The scheme of the application can well complete the test, and can be used for the tests including dormancy wakeup, startup and shutdown. For each problem exposed in the test, the test terminal may collect fault-related information from a number of sources, including but not limited to, exception stacks, crash stacks, hilog context, etc., to assist the developer in quickly locating the problem of the order-receiving application. For the transaction flow commonly used in financial application, the memory and the CPU are required to be used stably, so that the continuous transaction for a long time can be ensured to be tested. Namely, the method can be used for continuous high-frequency dormancy wakeup, startup and shutdown, application clicking and other test scenes.
In one embodiment of the present application, the method for obtaining the test item input by the user in step S130 of the present application includes: acquiring a test script and running times input by a user; the running times are used for indicating the times of running the test script of the target terminal to be tested. By acquiring the test scripts and the running times input by the user, the test scripts with corresponding times can be executed according to the actual test requirements of the user so as to meet the test requirements. For example, the user inputs a test script corresponding to a test item that the payment application continuously clicks and is still valid, and the running number is 100 times; indicating that the test item needs to be repeatedly performed 100 times.
In one embodiment of the present application, the method after polling the target terminal under test in step S120 includes steps S210-S220.
Step S210, saving the equipment information of the target terminal to be tested.
For example, all the device information which is connected currently is obtained through polling, such as the device information of the OH device 1, the OH device 2 and the OH device N is obtained; the polling acquisition is to judge that the current PC has a plurality of connected OH devices, for example, 3 OH devices are connected, and then 3 OH device information is stored; if the OH device 1 is connected to the PC through the USB or TCP, the PC detects that the device information is read, and if the information of the OH device 1 is not saved, the information is saved. For each OH device, the test terminal stores corresponding device information and connection information; and the storage of the equipment information is realized by storing an IP address corresponding to the OH equipment, or storing an equipment SN number corresponding to the OH equipment, the code/ID of the OH equipment and the like. For each newly stored OH device, the PC side reads all the single test scripts written in step 130, and prompts the user to input test items and times to be run; prompting a user to input scripts and times to be tested at the PC end so as to adapt to different functions; the test item is then run.
And step 220, stopping testing the disconnection testing terminal when the target terminal to be tested is disconnected with the testing terminal, and deleting the equipment information of the disconnection testing terminal. The disconnection testing terminal comprises a target terminal to be tested which is disconnected with the testing terminal.
Referring to fig. 2, if the OH device 1 is disconnected from the PC side in the process of executing step S210, the PC side deletes the device information related to the OH device 1, and stops the test of the OH device 1. The skipping of step S210 when the OH device 1 is re-connected can be avoided by deleting the information. Meanwhile, the test result completed by the OH device 1 in the test process is saved, and only the device information of the OH device 1 is deleted.
In one embodiment of the present application, the method of receiving the test result of the target terminal to be tested in step S150 includes steps S310-S320.
Step S310, obtaining preset interval times. For example, time is taken as the interval number, or the test number is taken as the interval number, and different parameters can be selected as the interval number according to the test requirement.
And step 320, if the current test times reach the interval times, displaying and recording application information of the application to be tested, and completing the test.
The current test times comprise the times of running the application matched with the application information by the target terminal to be tested based on the test items in the current stage. If the time is taken as the interval times, the application information such as the memory and the CPU information of the target test application is displayed back and recorded in the PC file when the corresponding time interval is reached each time. If the test times are used as the interval times, the application information of the application to be tested is displayed back and recorded when the corresponding test interval is reached each time. After the information such as the record memory is returned to the memory information mainly through the hdchi dump related instruction, the information is recorded to the file through the PowerShell to realize the memory information record of the running process. Meanwhile, hdc can realize full event input, and sleep command control event interval is realized through PowerShell script.
In one embodiment of the present application, before step S110, the method further includes: step S410, at least one test script input by a user through a cross-platform script tool is acquired. I.e. the test script may be one or more. Different test scripts represent different test schemes, and different test schemes can test the application to be tested with different functions respectively, so that a user can select a specific test script for testing according to the test purpose. For example, the user may complete the writing of the corresponding test script on the PC based on CukeTest, powerShell or Robot Framework, not only by testing the test item that the payment application in the intelligent POS machine is continuously clicked and still valid, but also by testing the test item that the payment application is started at.
In one embodiment of the present application, step S410, a method for obtaining at least one test script input by a user through a cross-platform scripting tool, includes step S420.
S420, acquiring at least one test script input by a user through a cross-platform script tool calling command line tool and/or a custom tool; the command line tool is used for generating a test script in a command writing mode; the custom tool is used for automatically generating the test script by recording the operation mode of the user. Referring to fig. 3, an OH apparatus 1 is taken as an example for illustration:
when the PC end writes a single test script, a simulation user input is written by using an HDCuinput related instruction (a test script is written by a command writing mode) or a wukong (wukong is an OpenHarmony stability test automation tool) is used according to an actual application use scene, recording user operation is supported and played back, and the 3.2 system version is preset in the system) to record the simulation user operation (the test script is automatically generated by recording the user operation).
For example, a script is written that clicks on a screen-specified point and returns one second later, the script being in the following specific form:
hdc shell uinput-T-c 400 530/represents click screen coordinates (400, 530);
Start-Sleep-Seconds 1/means wait 1 second;
the hdc shell uinput-K-d 2-u 2/indicates the return key is pressed;
or generating the script by the operation of the hdc calling the playback prerecording of the wukong, namely generating the script according to the returned operation after the recording user clicks a designated point of the screen for one second. Full event input is realized through hdc, namely, simulation is supported to be mostly based on user input, including clicking, sliding, key input and the like, and then the event interval is controlled by combining a PowerShell script dormancy command. Meanwhile, custom script writing can be conducted according to actual application scenes based on the custom script, multiple instruction input schemes are supported, and user testing requirements are met.
In one embodiment of the present application, a first connection is performed between a test terminal and a first terminal to be tested, a second connection is performed between the test terminal and a second terminal to be tested, the first connection and the second connection include bluetooth, WIFI, 4G or USB, and a test instruction is generated according to a test item, including step S510.
S510, generating a first test instruction and a second test instruction according to the test items, sending the first test instruction to the first terminal to be tested through the first connection, and sending the second test instruction to the second terminal to be tested through the second connection. The first test instruction is used for indicating the first terminal to be tested to run the application matched with the application information based on the test item; the second test instruction is used for indicating the second terminal to be tested to run the application matched with the application information based on the test item. If the test terminal PC is connected with the OH device 1 through a USB, and the test terminal PC is connected with the OH device 2 through a TCP, the test terminal PC generates a first test instruction and a second test instruction according to the test items respectively, and then sends the first test instruction to the OH device 1 through a USB connection manner, sends the second test instruction to the OH device 2 through a TCP connection manner, and instructs the OH device 1 and the OH device 2 to perform a test.
In one embodiment of the application, the test terminal is connected with the first terminal to be tested in a first mode, the first terminal to be tested is connected with the second terminal to be tested in a distributed mode, the first connection comprises Bluetooth, wiFi, 4G or USB, and the test terminal is not connected with the second terminal to be tested; according to the test item, a test instruction is generated, including steps S610-S620.
S610, generating a first test instruction according to the test item, and sending the first test instruction to a first terminal to be tested through a first connection; the first test instruction is used for indicating the first terminal to be tested to run the application matched with the application information based on the test item. If the test terminal PC is connected with the OH device 1 through USB, the OH device 1 is connected with the OH device 2 in a distributed mode; after generating a first test instruction according to the test item, the test terminal PC sends the first test instruction to the OH device 1 in a USB connection mode.
S620, generating a second test instruction and a forwarding instruction according to the test item, and sending the second test instruction and the forwarding instruction to the first terminal to be tested through the first connection, wherein the forwarding instruction is used for instructing the first terminal to be tested to forward the second test instruction to the second terminal to be tested through the distributed connection; the second test instruction is used for indicating the second terminal to be tested to run the application matched with the application information based on the test item; in a specific application scenario, the test terminal may not be directly connected with the terminal to be tested, so that a forwarding instruction needs to be generated, and the forwarding instruction is acquired by the terminal to be tested in distributed connection with the test terminal and then sent to the corresponding terminal to be tested. For example, after the test terminal PC respectively second test instructions and forwarding instructions according to the test items, the test terminal PC sends the second test instructions and forwarding instructions to the OH device 1 through a USB connection manner; under the instruction of the forwarding instruction, the OH equipment 1 forwards a second test instruction to the OH equipment 2 through distributed connection; the OH device 2 is then tested on the basis of the second test instruction. According to the scheme, when the forwarding instruction is received by the terminals to be tested through distributed connection, the terminals to be tested corresponding to the forwarding instruction can be searched from any terminals to be tested which are connected in a distributed mode for testing, namely, the terminals to be tested can effectively utilize the computing resources of any terminals to be tested which are connected in a distributed mode, and the diversity and the applicability of payment modes are improved.
Moreover, by utilizing the scheme of the application, the application scene can be expanded, and the OpenHarmony application test of other terminals to be tested which are not connected with the test terminal can be realized. For example, after the test terminal is connected with the first terminal to be tested, the test terminal can perform the test of OpenHarmony application for all terminals to be tested which are in distributed connection with the first terminal to be tested, so that the applicability is improved.
In one embodiment of the application, the test method based on the OpenHarmony application can be applied to a tester, and the tester and a plurality of OH devices are connected in a USB wired manner or a TCP wireless manner; the OH equipment comprises a POS machine, a cash register and other equipment, and meanwhile, the OH equipment is provided with corresponding application to be tested. Including steps S710-S760.
S710, acquiring at least one test script of a user; the user can write analog user input or wukong recording analog user operation by using the HDCuinput related instruction; the test script is written using the powershell tool.
S720, acquiring an application ID to be tested;
s730, all the connected equipment information is acquired in a polling way; when one of the OH devices is connected with the PC through the USB or the TCP, the PC detects and reads the device information and stores the device information.
S740, acquiring script types and running times input by a user.
S750, running scripts corresponding to the script types and the running times, when the scripts are run, indicating the OH equipment to execute the application to be tested, and displaying back and recording the memory and CPU information of the target test application in the PC file at regular intervals to finish the test.
And S760, if the OH device is disconnected from the PC in the process of the step S730, the PC stops the test item of the corresponding device and deletes the corresponding device information.
Referring to fig. 4, another embodiment of the present application provides a distributed payment system, and fig. 4 shows an architecture schematic of a distributed payment system 100 provided in an embodiment of the present application, where the architecture schematic includes at least two payment terminals 102, and a test terminal 101, where the test terminal 101 is used to test OpenHarmony applications on the payment terminals, and in some embodiments, the test terminal is connected to all the payment terminals 102, and the test terminal 101 is used to:
acquiring application information of an application to be detected, wherein the application to be detected is an OpenHarmony application;
polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises a payment terminal 102 connected with a test terminal 101;
acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line;
generating a test instruction according to the test item, wherein the test instruction is used for indicating a target terminal to be tested to run an application matched with the application information based on the test item;
and receiving a test result of the target terminal to be tested.
In other embodiments, the test terminal is connected to at least one payment terminal, and the payment terminals are connected in a distributed manner. The payment terminal 102 may be the terminal to be tested, and the content corresponding to the test terminal 101 and the terminal to be tested in the distributed payment system is disclosed in the above section, which is not repeated herein.
The invention has the beneficial effects that: and generating a test script through an OpenHarmony command line by adopting a cross-platform script tool, wherein the hdc command-based tool can simulate user input, so that the limitation that the OpenHarmony automatic test framework scheme needs writing in DevEco is avoided. And the higher stability can be ensured based on PowerShell scripts, and the requirement of the current test times is met. Meanwhile, the hdc command tool supports target equipment instructed by parameters, and can realize that the PC can operate a plurality of equipment simultaneously by combining with PowerShell; and the hdc command tool can realize full event input and memory information return, and the memory information is recorded to the memory information record of the file realization operation process by combining PowerShell. Therefore, the pressure test of the receipt application to the transaction scene is met, and the problems of low test efficiency and poor test effect are solved.
Referring to fig. 5, still another embodiment provides an electronic device 300, including a memory 301, a processor 302, and a computer program stored in the memory 301 and running on the processor 302, where the processor 302 implements the steps in the above-mentioned testing method based on the OpenHarmony application when executing the computer program.
The test method based on the OpenHarmony application is disclosed in the above section, and is not described herein.
In summary, according to the test method, the system and the electronic device based on the OpenHarmony application provided by the invention, the cross-platform script tool is adopted to generate the test script through the OpenHarmony command line, wherein the hdc command-based tool can simulate user input, so that the limitation that the OpenHarmony automatic test framework scheme needs writing in DevEco is avoided. And the higher stability can be ensured based on PowerShell scripts, and the requirement of the current test times is met. Meanwhile, the hdc command tool supports target equipment instructed by parameters, and can realize that the PC can operate a plurality of equipment simultaneously by combining with PowerShell; and the hdc command tool can realize full event input and memory information return, and the memory information is recorded to the memory information record of the file realization operation process by combining PowerShell. The problems (1) - (5) existing in the prior art are solved, so that the pressure test of the receipt application to the transaction scene is met, and the problems of low test efficiency and poor test effect are solved.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (10)

1. The test method based on the OpenHarmony application is characterized by being used for a test terminal, wherein the test terminal is used for testing the OpenHarmony application on a terminal to be tested, and the test terminal is connected with at least one terminal to be tested, and the method comprises the following steps:
acquiring application information of an application to be detected, wherein the application to be detected is an OpenHarmony application;
polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises the terminal to be tested connected with the test terminal;
acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line;
generating a test instruction according to the test item, wherein the test instruction is used for indicating the target terminal to be tested to run an application matched with the application information based on the test item;
and receiving the test result of the target terminal to be tested.
2. The OpenHarmony application-based test method according to claim 1, wherein the obtaining the test item input by the user comprises:
acquiring the test script and the running times input by a user; and the running times are used for indicating the times of running the test script by the target terminal to be tested.
3. The OpenHarmony application-based testing method according to claim 1, wherein after the polling obtains the target terminal to be tested, the method further comprises:
saving the equipment information of the target terminal to be tested;
when the target terminal to be tested is disconnected with the test terminal, stopping testing the disconnection test terminal, and deleting the equipment information of the disconnection test terminal;
the disconnection test terminal comprises a target terminal to be tested which is disconnected with the test terminal.
4. The method for testing based on OpenHarmony application according to claim 2, wherein the receiving the test result of the target terminal to be tested comprises:
acquiring preset interval times;
if the current test times reach the interval times, displaying and recording application information of the application to be tested, and completing the test;
the current test times comprise the times of running the application matched with the application information by the target terminal to be tested based on the test item in the current stage.
5. The OpenHarmony application-based testing method according to claim 1, wherein before the obtaining the application information of the application to be tested, the method further comprises:
at least one test script input by a user through a cross-platform scripting tool is obtained.
6. The OpenHarmony application-based testing method according to claim 5, wherein the obtaining at least one test script input by a user through a cross-platform scripting tool comprises:
acquiring at least one test script input by a user through a cross-platform script tool calling command line tool and/or a custom tool;
the command line tool is used for generating the test script in a command writing mode;
the self-defining tool is used for automatically generating the test script in a mode of recording user operation.
7. The OpenHarmony application-based test method according to claim 1, wherein the test terminal is connected with a first terminal to be tested in a first manner, the test terminal is connected with a second terminal to be tested in a second manner, the first connection and the second connection include bluetooth, wiFi, 4G or USB, and the generating the test instruction according to the test item includes:
generating a first test instruction and a second test instruction according to the test item, sending the first test instruction to the first terminal to be tested through the first connection, and sending the second test instruction to the second terminal to be tested through the second connection;
the first test instruction is used for indicating the first terminal to be tested to run the application matched with the application information based on the test item;
and the second test instruction is used for indicating the second terminal to be tested to run the application matched with the application information based on the test item.
8. The test method based on OpenHarmony application according to claim 1, wherein the test terminal performs a first connection with a first terminal to be tested, the first terminal to be tested performs a distributed connection with a second terminal to be tested, the first connection includes bluetooth, wiFi, 4G or USB, and the test terminal is not connected with the second terminal to be tested; the generating a test instruction according to the test item comprises the following steps:
generating a first test instruction according to the test item, and sending the first test instruction to the first terminal to be tested through the first connection;
generating a second test instruction and a forwarding instruction according to the test item, and sending the second test instruction and the forwarding instruction to the first terminal to be tested through the first connection, wherein the forwarding instruction is used for indicating the first terminal to be tested to forward the second test instruction to the second terminal to be tested through the distributed connection;
the first test instruction is used for indicating the first terminal to be tested to run the application matched with the application information based on the test item;
and the second test instruction is used for indicating the second terminal to be tested to run the application matched with the application information based on the test item.
9. A distributed payment system comprising at least two payment terminals, and a test terminal;
the test terminal is used for testing OpenHarmony application on the payment terminal, the test terminal is connected with all the payment terminals, and the test terminal is used for:
acquiring application information of an application to be detected, wherein the application to be detected is an OpenHarmony application;
polling to obtain a target terminal to be tested, wherein the target terminal to be tested comprises the payment terminal connected with the test terminal;
acquiring a test item input by a user, wherein the test item comprises a test script, and the test script is generated by using a cross-platform script tool through an OpenHarmony command line;
generating a test instruction according to the test item, wherein the test instruction is used for indicating the target terminal to be tested to run an application matched with the application information based on the test item;
and receiving the test result of the target terminal to be tested.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements a test method based on an OpenHarmony application according to any of claims 1-8 when executing the computer program.
CN202311872109.XA 2023-12-29 2023-12-29 Test method and system based on OpenHarmony application and electronic equipment Pending CN117827657A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311872109.XA CN117827657A (en) 2023-12-29 2023-12-29 Test method and system based on OpenHarmony application and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311872109.XA CN117827657A (en) 2023-12-29 2023-12-29 Test method and system based on OpenHarmony application and electronic equipment

Publications (1)

Publication Number Publication Date
CN117827657A true CN117827657A (en) 2024-04-05

Family

ID=90523901

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311872109.XA Pending CN117827657A (en) 2023-12-29 2023-12-29 Test method and system based on OpenHarmony application and electronic equipment

Country Status (1)

Country Link
CN (1) CN117827657A (en)

Similar Documents

Publication Publication Date Title
CN108804302B (en) Remote testing method, system and related equipment
US6772107B1 (en) System and method for simulating activity on a computer network
WO2016095554A1 (en) Test method, device and system for application
CN108717393A (en) A kind of applied program testing method and mobile terminal
CN108763086A (en) Script method for recording, terminal and computer readable storage medium based on remote real machine
US9645911B2 (en) System and method for debugging firmware/software by generating trace data
CN107357724A (en) Automatic software test method and device in Android system
CN113505082B (en) Application program testing method and device
CN110837474A (en) Script recording method, device, terminal and storage medium
CN115658529A (en) Automatic testing method for user page and related equipment
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN109753437B (en) Test program generation method and device, storage medium and electronic equipment
CN108446224A (en) The method for analyzing performance, storage medium of application program on mobile terminal
CN113849356A (en) Equipment testing method and device, electronic equipment and storage medium
CN111930633A (en) Data testing method, platform, electronic device and storage medium
CN117827657A (en) Test method and system based on OpenHarmony application and electronic equipment
CN116302621A (en) Method and system for picking up information-created environment elements based on QT interface library
CN114116353A (en) Equipment testing method, device, equipment and storage medium
CN110806981B (en) Application program testing method, device, equipment and storage medium
CN113867810A (en) Method, device, terminal and storage medium for checking server hard disk topology
CN113821438A (en) Application response performance test method and system and computing equipment
CN113392002A (en) Test system construction method, device, equipment and storage medium
CN111931465A (en) Method and system for automatically generating user manual based on user operation
CN112579431A (en) Cross-platform script recording and playback method based on image recognition
CN112819760A (en) Image detection method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination