Application program testing method and device, electronic device and storage medium
By acquiring lock information and test script libraries, generating test configuration files and running applications on mobile terminals, the problem of low application testing efficiency and accuracy in the existing technology is solved, and efficient and accurate smart lock application testing is achieved.
Patent Information
- Application Number
- CN202411909665.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, the efficiency and accuracy of application testing are low, and cannot meet the testing needs of complex and frequent updates of smart lock application functions.
By obtaining the lock information of the locks connected to multiple mobile terminals to be tested, a preset test script library is obtained, the target test script is selected based on the lock information, the corresponding test configuration file is generated, and the application is run on the mobile terminal using the test configuration file, and the test instructions are executed to generate application test results.
It realizes the corresponding test configuration files that are adapted to different lock types, and realizes an automated test method for parallel control of multiple locks, effectively improving testing efficiency and accuracy.
Smart Images

Figure CN119883896A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of application programs, and in particular to an application program testing method, device, electronic device, and storage medium. Background Art
[0002] With the development of smart homes, the functions of smart lock applications are becoming increasingly complex, including but not limited to user registration and login, door lock remote control, permission management, abnormal alarm prompts, etc. Traditional manual testing methods are not only inefficient, but also prone to human errors and cannot meet the needs of frequently updated and improved application testing.
[0003] Currently, no effective solution has been proposed for the problem of low efficiency and accuracy of application testing in related technologies. Summary of the invention
[0004] The embodiments of the present application provide an application testing method, device, electronic device and storage medium to at least solve the problem of low efficiency and accuracy of application testing in the related art.
[0005] In a first aspect, an embodiment of the present application provides an application testing method, the method comprising:
[0006] Obtaining lock information of locks connected to multiple mobile terminals to be tested;
[0007] Acquire a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each of the mobile terminals;
[0008] Based on the lock information, a target test script is selected from each of the automatic test scripts in the test script library, and a test configuration file corresponding to the lock is generated based on the target test script;
[0009] The test configuration file is used to run the application on the corresponding mobile terminal, and the lock is tested by executing the test instruction using the application to generate application test results for a plurality of the locks.
[0010] In some embodiments, the application is a first application of a current version, and the automatic test script includes a first test script for testing the first application; the method further includes:
[0011] In the case of detecting a second application of an updated version, comparing the first application with the second application to obtain difference information between the second application and the first application;
[0012] The first test script is adjusted based on the difference information to obtain a second test script; the second test script is used to test the second application; and the automatic test script also includes the second test script.
[0013] In some embodiments, a first key point of each first display page in the first application is determined, and a second key point of each second display page in the second application is determined;
[0014] For each of the first display page and the second display page, compare the first key point and the second key point to obtain the difference information; or,
[0015] Based on the first test script, running the first application to obtain a first function call result, and running the second application to obtain a second function call result;
[0016] Compare the first function call result and the second function call result to obtain the difference information.
[0017] In some of the embodiments, when the second test script is obtained, the second test script is overwritten on the first test script to obtain the automatic test script.
[0018] In some of these embodiments, a preset lock test function is obtained;
[0019] According to the lock test function, modularize the automatic test script to obtain corresponding functional modules;
[0020] Based on the functional modules, the automatic test script is stored in the test script library.
[0021] In some embodiments, the using the test configuration file to run the application on the corresponding mobile terminal includes:
[0022] Acquiring terminal type information of each of the mobile terminals;
[0023] Based on the terminal type information, generating a corresponding test connection instruction;
[0024] The test connection instruction is issued to the corresponding mobile terminal, and the application is run on the corresponding mobile terminal using the test configuration file.
[0025] In some embodiments, the step of executing a test instruction on the locks using the application to generate application test results for a plurality of the locks includes:
[0026] Utilizing the application to execute a test instruction on the locks to test them, and obtaining lock report information corresponding to each of the locks;
[0027] Aggregate the lock report information to obtain the application test result.
[0028] In a second aspect, an embodiment of the present application provides an application testing device, including:
[0029] A lock acquisition unit, used to acquire lock information of locks connected to multiple mobile terminals to be tested;
[0030] A script acquisition unit, used to acquire a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each of the mobile terminals;
[0031] A script selection unit, configured to select a target test script from each of the automatic test scripts in the test script library based on the lock information, and generate a test configuration file corresponding to the lock based on the target test script;
[0032] The testing unit is used to use the test configuration file to run the application on the corresponding mobile terminal, and use the application to execute the test instruction to test the lock, so as to generate the application test results for the plurality of locks.
[0033] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the application program testing method as described in the first aspect above is implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the application testing method as described in the first aspect above.
[0035] Compared with the related art, the application testing method, device, electronic device and storage medium provided in the embodiment of the present application obtain the lock information of the locks connected to the multiple mobile terminals to be tested; obtain the preset test script library; the test script library stores the automatic test script of the application; the application is used to be deployed on each mobile terminal; based on the lock information, the target test script is selected from each automatic test script in the test script library, and based on the target test script, a test configuration file corresponding to the lock is generated; using the test configuration file, the application is run on the corresponding mobile terminal, and the lock is tested by executing the test instruction using the application, and the application test results for multiple locks are generated. Based on this, it is possible to adapt to different lock types to generate corresponding test configuration files, realize the automated test method for parallel control of multiple locks, and effectively improve the test efficiency and accuracy.
[0036] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 is a hardware structure block diagram of a terminal according to an application program testing method of an embodiment of the present application;
[0039] Figure 2 is a flow chart of an application testing method according to an embodiment of the present application;
[0040] Figure 3 is a structural schematic diagram of an automated testing platform according to an embodiment of the present application;
[0041] Figure 4 is a flow chart of another application testing method according to an embodiment of the present application;
[0042] Figure 5 It is a structural block diagram of an application testing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.
[0044] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0045] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.
[0046] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 1 is a hardware structure diagram of a terminal according to an application testing method of an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0047] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the application program testing method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0048] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0049] This embodiment provides an application testing method that can be applied to a server. In a test environment, the server is used to store test data, manage the execution of test tasks, and communicate with mobile terminals and locks. The server needs to have sufficient computing resources and network bandwidth to support multiple mobile terminals to run automated test scripts at the same time and process a large amount of test data. For example, the server can receive requests from an automation framework, coordinate test operations on different mobile terminals, and communicate with locks at the same time to obtain door lock status information and feedback to the application on the mobile terminal.
[0050] Figure 2 is a flow chart of an application testing method according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0051] Step S210, acquiring lock information of locks connected to multiple mobile terminals to be tested.
[0052] The above-mentioned mobile terminals include but are not limited to various mobile phones, tablets and other devices. Specifically, during the test process, the server can be connected to multiple mobile terminals, and each mobile terminal is connected to a lock. The lock can be an actual door lock or a lock simulator. In order to achieve automated testing, each mobile terminal can read the lock information of the corresponding connected lock, and send the lock information to the server for subsequent processing. Among them, the lock information includes information such as the lock type or lock model corresponding to the lock.
[0053] It should also be noted that, in this embodiment, the mobile terminal can use a mobile device simulator or a real machine. Specifically, in testing, a mobile device simulator or a real mobile device can be used. The simulator is software that simulates the mobile device environment on a computer, which can run different operating system versions and screen size configurations for preliminary testing and development. The real machine is an actual mobile phone or tablet computer, etc., which is used for testing that is closer to the real user environment. In the automated testing of the smart lock application, it is necessary to ensure that the simulator or real machine in the test environment can correctly install and run the application, and effectively communicate with the server and the smart door lock.
[0054] Step S220, obtaining a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each mobile terminal.
[0055] The test script library is used to store automatic test scripts that can be provided for public reuse. The automatic test scripts can be written and generated by staff for applications deployed on various mobile terminals.
[0056] Among them, test scripts are code files written in programming languages such as Python. These files are based on the automated testing framework to realize the automated operation of the smart lock application. The test script contains a series of instructions to simulate the user's behavior on the application, such as starting the application, entering login information, clicking specific function buttons, checking operation results, etc. Each test script usually corresponds to one or more test cases to realize the testing of specific functions or scenarios of the application.
[0057] Step S230: Based on the lock information, a target test script is selected from each automatic test script in the test script library, and a test configuration file corresponding to the lock is generated based on the target test script.
[0058] Considering that different types or models of locks need to test different application functions, the number and type of test scripts to be loaded will also be different. Based on this, in this embodiment, by loading configuration files, a use case set can be combined to adapt to the constantly updated functions and diversified test requirements of smart locks, without frequent large-scale module adjustments or equipment modifications. In actual operation, the type, function, characteristics, etc. of the lock can be obtained based on the above lock information in order to select a suitable test case; then the purpose and expected results of the test are clarified in order to select a suitable test case for verification. According to the lock characteristics and test objectives, a suitable test case is selected from the public use case library. If there is no fully matching test case in the public use case library, it can be customized or modified as needed. More specifically, multiple test cases matching the lock type can be selected from the test script library, and a test script can be designed based on the selected test case to generate a test configuration file. Generally, the test configuration file can be a YAML (YAML Ain't a MarkupLanguage) configuration file.
[0059] In addition, test cases may include functional test cases, compatibility test cases, performance test cases, etc. Among them:
[0060] Functional test cases are a collection of test scenarios designed for various functional modules of smart lock applications. They include user management functions (such as registration, login, password modification, permission management, etc.), door lock control functions (such as remote unlocking, locking, setting door lock mode, etc.), and alarm functions (such as abnormal alarm prompts, low battery alarms, etc.). Each functional test case describes in detail the input conditions (such as entering a specific user name and password), operation steps (such as clicking the login button), and expected output (such as successful login and jumping to the main interface) to verify whether the application functions meet the design requirements.
[0061] Compatibility test cases are used to check the performance of smart lock applications running on a variety of different mobile devices and operating system environments. This includes testing different operating system versions (such as fragmentation issues of different versions on the Android operating system and compatibility of different versions on the iOS operating system), different screen sizes and resolutions (from small-screen mobile phones to large-screen tablets), and different hardware configurations (such as processor performance, memory size, etc.). By designing compatibility test cases, you can find problems such as display anomalies and functional failures that may occur in applications on certain specific devices.
[0062] Performance test cases are used to evaluate the performance of smart lock applications under different load conditions. For example, in a high-concurrency scenario (multiple users remotely operate the door lock at the same time), the application's response time, throughput, and resource utilization (such as CPU usage, memory usage, etc.) are measured. Performance test cases also include stability testing of the application after a long period of operation, checking for memory leaks, freezes, and other issues to ensure that the application can meet the user's performance requirements in actual use.
[0063] Step S240: using the test configuration file, running the application on the corresponding mobile terminal, and using the application to execute the test instruction to test the lock, and generating application test results for multiple locks.
[0064] Specifically, the server can issue test instructions to multiple connected mobile terminals in parallel, and then run the application on each mobile terminal, and use the application to execute the test instructions on the locks connected to each mobile terminal, so as to achieve parallel test control of multiple locks and ensure that each lock can receive the test instructions in time and perform the corresponding operations. These test instructions will be executed based on the previously generated test configuration files to verify whether the interaction between the application and the lock works as expected.
[0065] During this process, the server can also collect the status feedback information of each lock operation in real time through parallel control, so as to evaluate the control effect of the application during the test. After the test is completed, the server will generate the application test results for multiple locks.
[0066] Through the above-mentioned application testing method, according to the lock information of several mobile terminals connected to the locks, the corresponding target test script is selected from the test script library, so that the corresponding test configuration files can be generated to adapt to different lock types, and an automated testing method for parallel control of multiple locks is realized, which effectively improves the test efficiency and accuracy.
[0067] In some embodiments, the application is a first application of the current version, and the automatic test script includes a first test script for testing the first application; the method further includes:
[0068] When an updated version of a second application is detected, the first application and the second application are compared to obtain difference information between the second application and the first application; the first test script is adjusted based on the difference information to obtain a second test script; the second test script is used to test the second application; and the automatic test script also includes the second test script.
[0069] The existence of the second application (which may be an updated version of a software or service) is detected through a version control system, a release notification, or an automatic detection mechanism. Next, the first application (old version) and the second application (new version) are compared. The comparison may include changes in functionality, interface, performance, security, etc. Through the comparison, a detailed difference report is generated, listing all changes in the second application relative to the first application, such as new features, fixed issues, changed interfaces, adjusted configurations, etc.
[0070] Next, based on the difference information, the existing first test script is adjusted. For example, new test cases are added to cover the newly added functions, existing test cases are modified to adapt to the changed interface or configuration, or no longer relevant test cases are deleted. The adjusted test script is the second test script. The second test script is tailored for the second application to ensure that all functions and changes of the new version can be fully covered.
[0071] Through the above embodiment, it can be ensured that when an updated version of the second application is detected, the test script can be adjusted in time and the new version can be fully tested, thereby ensuring the quality and stability of the software.
[0072] Optionally, when generating the second test script, the second test script overwrites the first test script to obtain an automatic test script. In the test script library, the latest updated second test script is retained, and the first test script corresponding to the historical version of the application is deleted, so that the test scripts in the test script library can be continuously iterated and updated, while also avoiding the problem of large database operation and maintenance caused by saving multiple versions of test scripts.
[0073] In some embodiments, the above-mentioned comparison of the first application and the second application to obtain the difference information between the second application and the first application may further include the following steps:
[0074] Determine the first key point of each first display page in the first application, and determine the second key point of each second display page in the second application; for each first display page and second display page, compare the first key point and the second key point to obtain difference information. The first key point in each first display page and the second key point in each second display page can be the position or attribute of a user interaction element such as a button, input box, link, or picture on the page.
[0075] Alternatively, based on the first test script, the first application is run to obtain the first function call result, and the second application is run to obtain the second function call result; the first function call result and the second function call result are compared to obtain difference information. By controlling the first application and the second application to execute the first test script respectively, the differences in function calls, class structures, etc. of the first test script in the two different versions of the application can be compared, and the first test script can be adjusted to generate the second test script.
[0076] Through the above embodiments, a method for comparing the differences between multiple versions of application programs is provided, which helps to improve the automation level of application program testing.
[0077] In some embodiments, the above application testing method may further include the following steps:
[0078] Obtain a preset lock test function; modularize the automatic test script according to the lock test function to obtain a corresponding functional module; based on the functional module, store the automatic test script in a test script library.
[0079] Among them, through functional modular division, the test scripts are restructured and divided into smaller, functionally independent modules. For example, the test scripts corresponding to functions such as user login, door lock control, and permission management are encapsulated into different modules. Each module is only responsible for testing specific functions and has a clear interface. In this way, when a function of the application is updated, only the corresponding module needs to be modified without affecting other unrelated modules. After that, the tested and verified modular scripts are uploaded to the test script library to ensure that each script has a clear mark and description.
[0080] Through the above embodiments, the automatic test scripts are modularized and stored in a test script library, which can greatly improve the efficiency and accuracy of lock application testing.
[0081] In some embodiments, the above-mentioned use of the test configuration file to run the application on the corresponding mobile terminal may also include the following steps:
[0082] The terminal type information of each mobile terminal is obtained; based on the terminal type information, a corresponding test connection instruction is generated; the test connection instruction is sent to the corresponding mobile terminal, and the application is run on the corresponding mobile terminal using the test configuration file.
[0083] Before issuing the test connection instruction, it is necessary to ensure that the mobile terminal has been connected to the test server or test network. In this embodiment, the operating system type of the connected mobile terminal is determined according to the received terminal type information of the connected mobile terminal, and the corresponding test connection instruction is issued to the mobile device for automated testing according to the corresponding operating system type. For example, if it is detected that the operating system of the connected mobile terminal is Android or Hongmeng operating system, the Android Debug Bridge (adb) instruction is issued to the mobile terminal; if the operating system is detected to be iOS, the wda (WebDriverAgent) instruction is issued.
[0084] Through the above embodiments, mobile terminals with different operating systems are managed in the same way based on terminal type information, which solves the problem that lock testing cannot be cross-platform and realizes an automated testing method for device compatibility.
[0085] In some embodiments, the above-mentioned using the application to execute the test instruction on the lock to test and generate the application test results for multiple locks may also include the following steps:
[0086] The application executes the test instructions to test the locks and obtains the lock report information corresponding to each lock; the lock report information is aggregated to obtain the application test results. The server summarizes the test reports of each lock, realizing the effective integration of multiple lock automation test results.
[0087] The present application is described and illustrated below in conjunction with specific embodiments. This embodiment also provides an automated testing platform, which can be deployed on a server. Figure 3 is a schematic diagram of the structure of an automated testing platform according to an embodiment of the present application, such as Figure 3 As shown, the automated testing platform includes: a script differentiation module, a script reuse module and a device management module; wherein:
[0088] The script differentiation module is a module specifically used to analyze the differences between the updated content of the smart lock application version and the application content of the current automated test script. This module can perform static analysis on the new and old versions of the application code to identify information such as functional modifications, changes in interface elements, and interface adjustments. For example, by comparing the changes in function calls, class structures, and Extensible Markup Language (XML) layout files (for applications applied to the Android operating system) in the code, determine which parts of the test script need to be updated.
[0089] The script reuse module is used to perform functional modular division and restructure the test scripts into smaller, functionally independent modules. The automatic test scripts are encapsulated and stored in the script reuse library according to different functional modules; the script reuse library can be used to collect and organize script fragments that can be reused in different test scenarios. For example, some common script codes for checking network connection status, reading application configuration files, etc. can be placed in the script reuse library. When writing new test scripts or updating existing scripts, you can get the appropriate fragments from the reuse library to reduce the workload of repetitive code writing and improve the maintainability of the script.
[0090] The device management module is used to automatically identify and connect mobile terminals of different brands, models, and operating system types. The device management module communicates with the mobile terminal's Universal Serial Bus (USB) interface or network connection (for devices that support remote debugging) to obtain basic information about the device, such as the device model, operating system version, screen resolution, etc.
[0091] Figure 4 is a flowchart of another application testing method according to an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:
[0092] Step S401: The server connects to multiple mobile terminals with different operating systems (such as Android or iOS operating systems).
[0093] Step S402: each mobile terminal is connected to a corresponding lock via Bluetooth.
[0094] Step S403: Each mobile terminal loads the YAML configuration file in parallel.
[0095] Step S404: Run the test case on each mobile terminal and generate a corresponding test report.
[0096] Step S405: The server aggregates the test reports of each mobile terminal and outputs the final application test result.
[0097] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0098] This embodiment also provides an application testing device, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0099] Figure 5 is a structural block diagram of an application testing device according to an embodiment of the present application, such as Figure 5 As shown, the device includes: a lock acquisition unit 51, a script acquisition unit 52, a script selection unit 53 and a testing unit 54; wherein:
[0100] A lock acquisition unit 51, used to acquire lock information of locks connected to multiple mobile terminals to be tested;
[0101] The script acquisition unit 52 is used to acquire a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each mobile terminal;
[0102] A script selection unit 53 is used to select a target test script from each automatic test script in the test script library based on the lock information, and generate a test configuration file corresponding to the lock based on the target test script;
[0103] The testing unit 54 is used to use the test configuration file to run the application on the corresponding mobile terminal, and use the application to execute the test instruction to test the lock, and generate the application test results for multiple locks.
[0104] In some embodiments, the application is a first application of the current version, and the automatic test script includes a first test script for testing the first application; the application testing device further includes:
[0105] a script generating unit, configured to compare the first application program with the second application program to obtain difference information between the second application program and the first application program when an updated version of the second application program is detected;
[0106] The script generation unit is also used to adjust the first test script based on the difference information to obtain a second test script; the second test script is used to test the second application program; and the automatic test script includes the second test script.
[0107] In some of the embodiments, the script generation unit is further used to determine a first key point position of a first display page in a first application, and to determine a second key point position of a second display page in a second application;
[0108] The script generation unit is further used to compare the first key point with the second key point for each first display page and the second display page to obtain difference information; or,
[0109] The script generation unit is also used to run the first application program to obtain a first function call result, and to run the second application program to obtain a second function call result based on the first test script;
[0110] The script generation unit is also used to compare the first function call result and the second function call result to obtain difference information.
[0111] In some of the embodiments, the script generation unit is further configured to, when obtaining the second test script, overwrite the first test script with the second test script to obtain the automatic test script.
[0112] In some of these embodiments, the script generation unit is further used to obtain a preset lock test function;
[0113] The script generation unit is also used to modularize the automatic test script according to the lock test function to obtain the corresponding functional module;
[0114] The script generation unit is also used to store the automatic test scripts in a test script library based on the functional modules.
[0115] In some of the embodiments, the testing unit 54 is further configured to obtain terminal type information of each mobile terminal;
[0116] The test unit 54 is also used to generate a corresponding test connection instruction based on the terminal type information;
[0117] The testing unit 54 is further configured to send a test connection instruction to the corresponding mobile terminal, and use the test configuration file to run the application on the corresponding mobile terminal.
[0118] In some of the embodiments, the testing unit 54 is further used to execute a test instruction on the locks using an application program, and obtain lock report information corresponding to each lock;
[0119] The testing unit 54 is also used to aggregate the lock report information to obtain the application test result.
[0120] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0121] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0122] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0123] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0124] S1, obtaining lock information of locks connected to multiple mobile terminals to be tested.
[0125] S2, obtaining a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each mobile terminal.
[0126] S3, based on the lock information, select a target test script from each automatic test script in the test script library, and generate a test configuration file corresponding to the lock based on the target test script.
[0127] S4, using the test configuration file, running the application on the corresponding mobile terminal, and using the application to execute the test instructions on the locks to test, and generating application test results for multiple locks.
[0128] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0129] In addition, in combination with an application testing method in the above embodiment, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any application testing method in the above embodiment is implemented.
[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0132] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0133] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An application testing method, characterized in that: The method comprises: Obtaining lock information of locks connected to multiple mobile terminals to be tested; Acquire a preset test script library; the test script library stores automatic test scripts of the application; the application is used to be deployed on each of the mobile terminals; Based on the lock information, a target test script is selected from each of the automatic test scripts in the test script library, and a test configuration file corresponding to the lock is generated based on the target test script; The test configuration file is used to run the application on the corresponding mobile terminal, and the lock is tested by executing the test instruction using the application to generate application test results for a plurality of the locks.
2. The application testing method according to claim 1, characterized in that: The application is a first application of a current version, and the automatic test script includes a first test script for testing the first application; The method further comprises: In the case of detecting a second application of an updated version, comparing the first application with the second application to obtain difference information between the second application and the first application; The first test script is adjusted based on the difference information to obtain a second test script; the second test script is used to test the second application; and the automatic test script also includes the second test script.
3. The application testing method according to claim 2, characterized in that: The comparing the first application and the second application to obtain difference information between the second application and the first application includes: Determine a first key point position of each first display page in the first application, and determine a second key point position of each second display page in the second application; For each of the first display page and the second display page, compare the first key point and the second key point to obtain the difference information; or, Based on the first test script, running the first application to obtain a first function call result, and running the second application to obtain a second function call result; Compare the first function call result and the second function call result to obtain the difference information.
4. The application testing method according to claim 2, characterized in that: The method further comprises: When the second test script is obtained, the second test script is used to overwrite the first test script to obtain the automatic test script.
5. The application testing method according to claim 1, characterized in that: The method further comprises: Get the preset lock test function; According to the lock test function, modularize the automatic test script to obtain corresponding functional modules; Based on the functional modules, the automatic test script is stored in the test script library.
6. The application testing method according to claim 1, characterized in that: The using the test configuration file to run the application on the corresponding mobile terminal includes: Acquiring terminal type information of each of the mobile terminals; Based on the terminal type information, generating a corresponding test connection instruction; The test connection instruction is issued to the corresponding mobile terminal, and the application is run on the corresponding mobile terminal using the test configuration file.
7. The application testing method according to any one of claims 1 to 6, characterized in that: The using the application to execute a test instruction on the lock to test and generate application test results for a plurality of the locks includes: Utilizing the application to execute a test instruction on the locks to test them, and obtaining lock report information corresponding to each of the locks; Aggregate the lock report information to obtain the application test result.
8. An application testing device, characterized in that: include: A lock acquisition unit, used to acquire lock information of locks connected to multiple mobile terminals to be tested; A script acquisition unit, used to acquire a preset test script library; The test script library stores automatic test scripts of the application program; The application is used to be deployed on each of the mobile terminals; A script selection unit, configured to select a target test script from each of the automatic test scripts in the test script library based on the lock information, and generate a test configuration file corresponding to the lock based on the target test script; The testing unit is used to use the test configuration file to run the application on the corresponding mobile terminal, and use the application to execute the test instruction to test the lock, so as to generate the application test results for the plurality of locks.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the application testing method according to any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the steps of the application testing method according to any one of claims 1 to 7 when running.
Citation Information
Cited By
Interface test and electromagnetic lock replacement method and device, electronic equipment and readable medium
CN122152393A
Interface test and electromagnetic lock replacement method and device, electronic equipment and readable medium
CN122152393B