Function test method and device of application program, equipment and medium

By using simulated function functions in the desktop browser environment to simulate the API of mobile devices, the problem of inconsistency between the development environment and the running environment is solved, and the function of testing mobile applications in the desktop browser is realized, which improves development efficiency.

CN119127641APending Publication Date: 2024-12-13BEIYIN FINANCIAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411146800.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When developing mobile applications, the existing technology cannot test the functions of the application in the development environment of the desktop browser, resulting in inconsistent development environment and operating environment, reducing development efficiency.

Method used

By obtaining the test script of the target application and the preset simulation function entry file, loading the simulation function entry file and executing the test script, calling the simulation function function, obtaining the call result of the simulation function function, and comparing the calls of the simulation function function The results and the preset function call results determine the functional test results of the target application. After the test is passed, the simulated function function is replaced by the mobile device's native function function, and the installation package to be tested is generated and sent to the mobile device for functional testing.

Benefits of technology

It realizes the function of directly testing applications in the desktop browser development environment, improves developers' debugging and optimization efficiency, and simplifies the code development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127641A_ABST
    Figure CN119127641A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a function testing method and device for an application program, equipment and a medium, and aims to solve the problem that functions of the application program cannot be tested in a development environment of a desktop browser. According to the method, in the development environment of the desktop browser, the simulation performance function is used for simulating the built-in API function of the application program of the mobile equipment, so that the function of the application program can be directly tested in the development environment of the desktop browser, a developer can debug and optimize the code of the application program in real time in the development environment, and the development efficiency is improved. And the development efficiency of the application program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and medium for functional testing of an application program. Background Art

[0002] With the rapid development of mobile Internet, more and more applications are widely used in various mobile devices. These applications include a large number of built-in APIs (Application Programming Interface) to interact with the hardware and operating system functions of mobile devices.

[0003] When developing these applications, developers usually write and debug code in a desktop browser environment. However, the built-in APIs in these applications can only run on mobile devices, which results in inconsistencies between the application development environment and the running environment. It is impossible to test the application's functions in the desktop browser development environment, greatly reducing the application development efficiency. Summary of the invention

[0004] In order to solve the above-mentioned problems in the prior art, the embodiments of the present application provide a method, apparatus, device and medium for functional testing of an application program, which are used to test the functions of an application program in a development environment of a desktop browser, thereby improving the development efficiency of the application program.

[0005] In a first aspect, an embodiment of the present application provides a method for functional testing of an application program, the method comprising:

[0006] In response to a first function test instruction for a target application, obtaining a script to be tested and a preset simulation function entry file corresponding to the target application, wherein the simulation function entry file includes a simulation function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded;

[0007] Loading the simulation function entry file, and executing the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function;

[0008] By comparing the calling result of the simulated function with the preset function calling result, a first test result of the function to be tested of the target application is determined.

[0009] In a possible implementation, before obtaining the preset simulation function entry file, the method further includes:

[0010] In response to an instruction to add a simulation function, in the entry file of the desktop browser development environment of the target application, the simulation function in the simulation function code library is added to obtain the simulation function entry file, wherein the simulation function code library includes multiple simulation function functions.

[0011] In a possible implementation, executing the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function includes:

[0012] Calling the simulation function in the simulation function entry file through the function calling function in the script to be tested, and obtaining the return value of the simulation function;

[0013] The return value of the simulation function is used as the calling result of the simulation function.

[0014] In a possible implementation, after determining the functional test result of the target application, the method further includes:

[0015] If the function test result of the target application is that the test passes, the simulated function function is replaced by the native function function of the target application on the mobile device; the native function function is an application programming interface provided by the operating system of the mobile device;

[0016] The target code script corresponding to the target application and the native function are packaged to generate a test installation package of the target application, wherein the target code script corresponding to the target application is a test script that has passed the test;

[0017] The installation package to be tested is sent to the mobile device, so that the mobile device performs a function test on the installation package to be tested.

[0018] In a second aspect, an embodiment of the present application provides a method for functional testing of an application, the method comprising:

[0019] Receive an installation package to be tested sent by a browser, the installation package to be tested including a target code script and a native function function of a target application, the target code script is a script to be tested corresponding to the target application that has passed the test under a running environment provided after a simulation function entry file corresponding to the target application is loaded, the simulation function entry file includes a simulation function function, the function test result is determined by comparing a preset function call result and a call result of the simulation function function called by the script to be tested, and the native function function is an application programming interface provided by the operating system of the mobile device;

[0020] In response to a second function test instruction for the target application, the native function function is called through a function call function in the target code script to obtain a call result of the native function function;

[0021] By comparing the calling result of the native function with the preset function calling result, a second test result of the function to be tested of the target application is determined.

[0022] In a third aspect, an embodiment of the present application provides a functional testing device for an application program, the device comprising:

[0023] an acquisition unit, configured to respond to a first function test instruction for a target application, acquire a script to be tested and a preset simulation function entry file corresponding to the target application, wherein the simulation function entry file includes a simulation function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded;

[0024] A first calling unit is used to load the simulation function entry file and execute the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function;

[0025] The first testing unit is used to determine a first testing result of the function to be tested of the target application by comparing the calling result of the simulated function with the preset function calling result.

[0026] In a possible implementation manner, the acquisition unit is further configured to:

[0027] In response to an instruction to add a simulation function, in the entry file of the desktop browser development environment of the target application, the simulation function in the simulation function code library is added to obtain the simulation function entry file, wherein the simulation function code library includes multiple simulation function functions.

[0028] In a possible implementation manner, the first calling unit is specifically configured to:

[0029] Calling the simulation function in the simulation function entry file through the function calling function in the script to be tested, and obtaining the return value of the simulation function;

[0030] The return value of the simulation function is used as the calling result of the simulation function.

[0031] In a possible implementation manner, the first testing unit is further used to:

[0032] If the function test result of the target application is that the test passes, the simulated function function is replaced by the native function function of the target application on the mobile device; the native function function is an application programming interface provided by the operating system of the mobile device;

[0033] The target code script corresponding to the target application and the native function are packaged to generate a test installation package of the target application, wherein the target code script corresponding to the target application is a test script that has passed the test;

[0034] The installation package to be tested is sent to the mobile device, so that the mobile device performs a function test on the installation package to be tested.

[0035] In a fourth aspect, an embodiment of the present application provides a functional testing device for an application program, the device comprising:

[0036] A receiving unit is used to receive an installation package to be tested sent by a browser, wherein the installation package to be tested includes a target code script and a native function function of a target application, wherein the target code script is a script to be tested corresponding to the target application that has passed the test under a running environment provided after a simulation function entry file corresponding to the target application is loaded, wherein a function test result is a script to be tested corresponding to the target application that has passed the test, wherein the simulation function entry file includes a simulation function function, wherein the function test result is determined by comparing a preset function call result with a call result of the simulation function function called by the script to be tested, wherein the native function function is an application programming interface provided by an operating system of a mobile device;

[0037] A second calling unit is used to respond to a second function test instruction for the target application, call the native function function through the function call function in the target code script, and obtain a call result of the native function function;

[0038] The second testing unit is used to determine a second testing result of the function to be tested of the target application by comparing the calling result of the native function function with the preset function calling result.

[0039] In a fifth aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and when the computer program is executed by the processor, it implements any one of the functional testing methods of the application program in the first aspect and the functional testing method of the application program in the second aspect.

[0040] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the functional testing method of the application program in the first aspect and the functional testing method of the application program in the second aspect is implemented.

[0041] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:

[0042] In the embodiment of the present application, in response to the first function test instruction for the target application, after obtaining the script to be tested corresponding to the target application and the preset simulation function entry file, the simulation function entry file is loaded, and the script to be tested corresponding to the target application is executed to call the simulation function function to obtain the call result of the simulation function function, and then, by comparing the call result of the simulation function function with the preset function call result, the first test result of the function to be tested of the target application is determined. In the development environment of the desktop browser, the built-in API function of the application of the mobile device is simulated by using the simulation function function, and the function of the application can be tested directly in the development environment of the desktop browser, so that the developer can debug and optimize the code of the application in real time in the development environment, which is conducive to improving the development efficiency of the application.

[0043] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of an application scenario of a functional testing method for an application provided in an embodiment of the present application;

[0045] Figure 2 A flowchart of a functional testing method for an application provided in an embodiment of the present application;

[0046] Figure 3 A structural diagram of a functional testing device for an application provided in an embodiment of the present application;

[0047] Figure 4 A structural diagram of another functional testing device for an application provided in an embodiment of the present application;

[0048] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0050] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0051] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0052] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0053] Before introducing the functional testing method of an application provided in an embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced in detail below.

[0054] With the rapid development of mobile Internet, more and more applications (APPs) are widely used in various mobile devices. These applications include a large number of built-in APIs (Application Programming Interfaces) to interact with the hardware and operating system functions of mobile devices.

[0055] Related technologies When developing an application, the following methods are usually used to test and debug the application code:

[0056] 1. Use simulators for testing and debugging: simulators are commonly used tools for developing applications. They can simulate the operating environment of mobile devices in a desktop environment. Developers can use simulators to run applications and debug application codes. However, simulators cannot simulate all functions of mobile devices, especially APIs that are closely related to hardware (such as GPS, camera, etc.), and their effects and behaviors may be different from those of real mobile devices. In addition, the performance of simulators is not as good as that of real mobile devices, which affects the efficiency of code debugging.

[0057] 2. Use real mobile devices to test and debug the code: Developers can deploy applications to real mobile devices for testing and debugging, and use the debugging tools that come with the mobile devices (such as Android Studio, Xcode) to perform functional testing of the application. Although this method can obtain the most accurate test results, it requires continuous packaging, deployment, and running after each code modification. This process is very time-consuming and cumbersome, greatly reducing the efficiency of application development. At the same time, the limited resources of mobile devices also increase the complexity of debugging.

[0058] 3. Use remote debugging tools for testing and debugging: Some remote debugging tools (such as Weinre and ChromeDevTools Remote Debugging) can view and modify the code on the mobile device in the browser environment. These tools establish a connection between the mobile device and the browser, allowing developers to view and modify the code on the mobile device in the browser. However, remote debugging tools usually only support debugging of some front-end codes and cannot cover all the functions of the built-in API.

[0059] 4. Use third-party simulation libraries for testing and debugging: Developers can also use third-party simulation libraries to implement some of the built-in API functions. For example, some simulation libraries provide simulation implementations of APIs such as geolocation and network requests, allowing developers to test and debug some functions in a desktop browser environment. However, the functions of these simulation libraries are usually limited, and developers are required to manually write simulation code, which increases the complexity of application development.

[0060] In view of this, the embodiments of the present application provide a method, device, equipment and medium for functional testing of an application, which are used to solve the problem that the development environment and the operating environment of the application are inconsistent, the function of the application cannot be tested in the development environment of the desktop browser, and the development efficiency of the application is low.

[0061] The inventive concept of the present application can be summarized as follows: for the first function test instruction of the target application, after obtaining the script to be tested corresponding to the target application and the preset simulation function entry file, the simulation function entry file is loaded, and the script to be tested corresponding to the target application is executed to call the simulation function function to obtain the call result of the simulation function function, and then, by comparing the call result of the simulation function function with the preset function call result, the first test result of the function to be tested of the target application is determined. In the development environment of the desktop browser, the built-in API function of the application of the mobile device is simulated using the simulation function function, and the function of the application can be tested directly in the development environment of the desktop browser, so that the developer can debug and optimize the code of the application in real time in the development environment, which is conducive to improving the development efficiency of the application.

[0062] After introducing the inventive concept of this application, Figure 1 , the application scenarios of the embodiments of the present application are introduced.

[0063] Reference Figure 1 , is an application scenario diagram of a functional testing method for an application provided in an embodiment of the present application. Figure 1 As shown, the scenario includes: a terminal device 110 and a server 120, and the terminal device 110 and the server 120 can communicate with each other through a communication network.

[0064] In an optional implementation, the communication network may be a wired network or a wireless network. Therefore, the terminal device 110 and the server 120 may be directly or indirectly connected via a wired or wireless communication. For example, the terminal device 110 may be indirectly connected to the server 120 via a wireless access point, or the terminal device 110 may be directly connected to the server 120 via the Internet, and this application does not limit this.

[0065] In the embodiment of the present application, the terminal device 110 includes but is not limited to mobile phones, tablet computers, laptop computers, desktop computers, e-book readers, intelligent voice interaction devices, smart home appliances, car terminals and other devices.

[0066] The server 120 is a background server corresponding to the terminal device 110. The server 120 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0067] It should be noted that the functional testing method of the application in the embodiment of the present application can be deployed in an electronic device, which can be a server or a terminal device.

[0068] The server can be Figure 1 The server 120 shown in FIG. Figure 1 The terminal device may be other servers other than the server 120 shown in FIG. Figure 1 The terminal device 110 shown in FIG. 1 may also be Figure 1 Other terminal devices other than the terminal device 110 shown in FIG.

[0069] Figure 1 The figure is only an example. In fact, the number of terminal devices 110 and servers 120 is not limited and is not specifically limited in the embodiments of the present application.

[0070] Based on the above application scenarios, the functional testing method of the application provided by the exemplary embodiment of the present application is described below in combination with the application scenarios described above according to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this respect.

[0071] refer to Figure 2 , Figure 2 An exemplary method for testing the function of an application in an embodiment of the present application is provided. The method can be executed by an electronic device and includes the following steps:

[0072] Step S201, responding to a first function test instruction for a target application, obtaining a script to be tested and a preset simulation function entry file corresponding to the target application.

[0073] The simulation function entry file includes a simulation function function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded.

[0074] When developing applications for mobile devices, developers can choose appropriate front-end frameworks according to project requirements, such as ReactNative, Vue.js, Flutter, etc. These frameworks can package front-end code into applications that can run on mobile devices.

[0075] After the developer selects the front-end framework, he can use the command line tools provided by the selected front-end framework to create a new project. For example, using React Native, you can run npx react-native init MyApp to create a project. Then, you can write the front-end code in the created project and implement the business logic, UI components, etc. in a format supported by the framework. Then, you can use the packaging tool of the front-end framework to package the front-end code to generate an APP file that can be run on a mobile device, that is, the script to be tested corresponding to the target application to be tested in this application.

[0076] Furthermore, various functions of mobile devices can be simulated in a desktop browser environment through simulation functions, so that developers can test and debug codes in a consistent development environment.

[0077] Specifically, the simulation function code library can be introduced into the desktop browser environment, and then a simulation function entry file containing the simulation function is created.

[0078] In some embodiments, the simulated function function may be a function in a Polyfill script used to simulate various functions of a mobile device in a desktop browser environment. For example, it may be a function function that simulates a geographic location API, or, as another example, it may be a function function that simulates a camera API. Alternatively, it may be a function function that simulates a device information API of a mobile device. The simulated function code library may be a Polyfill library, for example, it may be an existing core-js, babel-Polyfill, or, as another example, it may be a Polyfill library that implements specific functions through customization.

[0079] After the simulation function code library is introduced into the desktop browser environment, in response to the instruction to add the simulation function, the simulation function in the simulation function code library can be added to the entry file of the desktop browser development environment of the target application to obtain the simulation function entry file.

[0080] After responding to the first functional test instruction for the target application, the script to be tested and the preset simulation function entry file corresponding to the target application can be obtained to prepare for subsequent functional testing.

[0081] Step S202, loading the simulation function entry file, and executing the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function.

[0082] After obtaining the script to be tested corresponding to the target application and the preset simulation function entry file, the simulation function entry file can be loaded to provide a running environment for the script to be tested corresponding to the target application. Then, the script to be tested corresponding to the target application can be executed, and the simulation function function in the simulation function entry file can be called through the function call function in the script to be tested. After obtaining the return value of the simulation function function, the return value is used as the calling result of the simulation function function.

[0083] Step S203 , determining a first test result of the function to be tested of the target application by comparing the call result of the simulated function with the preset function call result.

[0084] After obtaining the calling result of the simulated function, the first test result of the function to be tested of the target application can be determined by comparing the calling result of the simulated function with the preset function calling result.

[0085] Specifically, if the calling result of the simulated function is consistent with the preset function calling result, the first test result of the target application's function under test can be determined as passed, otherwise, the first test result of the target application's function under test is determined as failed.

[0086] Exemplarily, assuming that the simulated function simulates the geographic location API, the function call function in the script to be tested can be used to call the function function that simulates the geographic location API to obtain the return value of the function function, for example, the return value can be longitude and latitude. If the longitude and latitude are consistent with the preset longitude and latitude, it can be determined that the test result of the function of obtaining the geographic location in the target application is a passed test. If the longitude and latitude are inconsistent with the preset longitude and latitude, it can be determined that the test result of the function of obtaining the geographic location in the target application is a failed test.

[0087] It should be noted that in addition to simulating the geographic location API, the simulation function can also simulate other built-in APIs. For example, assuming that the simulation function simulates the device information API of a mobile device, then the calling result of the function function that simulates the device information API can be compared with the device information of the preset mobile device to determine whether it is consistent, thereby determining whether the function test has passed. This application does not impose any limitation on the functions of the built-in API simulated by the simulation function.

[0088] If the first test result of the target application's function under test is test failure, an error message can be displayed in the user interface to facilitate developers to debug the front-end code of the application until the first test result of the target application's function under test is test passing.

[0089] After determining that the first test result of the target application's function under test is passed, the simulated function function can be replaced by the target application's native function function on the mobile device, and then the target code script and the native function function corresponding to the target application can be packaged to generate a test installation package for the target application.

[0090] The native function is an application programming interface provided by the operating system of the mobile device, for example, a built-in API provided by the iOS system, or a built-in API provided by the Android system.

[0091] Furthermore, the installation package to be tested may be sent to a mobile device, so that the mobile device performs a functional test on the installation package to be tested.

[0092] After the mobile device receives the installation package to be tested sent by the browser, in response to the second function test instruction for the target application, the native function function can be called through the function call function in the target code script to obtain the call result of the native function function, and then the second test result of the function to be tested of the target application can be determined by comparing the call result of the native function function with the preset function call result. Based on the second test result determined on the real mobile device, the target code script can be further modified and optimized until the overall performance of the application meets expectations.

[0093] Based on the foregoing description, in the embodiment of the present application, for the first function test instruction of the target application, after obtaining the script to be tested corresponding to the target application and the preset simulation function entry file, the simulation function entry file is loaded, and the script to be tested corresponding to the target application is executed to call the simulation function function to obtain the call result of the simulation function function, and then, by comparing the call result of the simulation function function with the preset function call result, the first test result of the function to be tested of the target application is determined. In the development environment of the desktop browser, the built-in API function of the application of the mobile device is simulated using the simulation function function, and the function of the application can be tested directly in the development environment of the desktop browser, so that the developer can debug and optimize the code of the application in real time in the development environment, which is conducive to improving the development efficiency of the application.

[0094] Based on the same inventive concept, the present application embodiment provides a functional testing device for an application program, please refer to Figure 3 The device includes: an acquisition unit 301, a first calling unit 302 and a first testing unit 303, wherein:

[0095] The acquisition unit 301 is used to respond to the first function test instruction for the target application, acquire the script to be tested corresponding to the target application and a preset simulation function entry file, wherein the simulation function entry file includes a simulation function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded;

[0096] The first calling unit 302 is used to load the simulation function entry file and execute the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function;

[0097] The first testing unit 303 is used to determine a first test result of the function to be tested of the target application by comparing the calling result of the simulated function with the preset function calling result.

[0098] In a possible embodiment, the acquiring unit 301 is further configured to:

[0099] In response to the instruction to add a simulation function, the simulation function in the simulation function code library is added to the entry file of the desktop browser development environment of the target application to obtain a simulation function entry file, and the simulation function code library includes multiple simulation function functions.

[0100] In a possible embodiment, the first calling unit 302 is specifically configured to:

[0101] The function call function in the script to be tested is used to call the simulation function in the simulation function entry file to obtain the return value of the simulation function;

[0102] The return value of the simulated function is used as the call result of the simulated function.

[0103] In a possible embodiment, the first testing unit 303 is further configured to:

[0104] If the function test result of the target application is that the test passes, the simulated function function is replaced with the native function function of the target application on the mobile device; the native function function is an application programming interface provided by the operating system of the mobile device;

[0105] The target code script and native function corresponding to the target application are packaged to generate a test installation package of the target application, and the target code script corresponding to the target application is the test script that has passed the test;

[0106] The installation package to be tested is sent to the mobile device, so that the mobile device performs a functional test on the installation package to be tested.

[0107] Based on the same inventive concept, the present application embodiment provides another functional testing device for an application program, please refer to Figure 4 The device comprises: a receiving unit 401, a second calling unit 402 and a second testing unit 403, wherein:

[0108] The receiving unit 401 is used to receive the installation package to be tested sent by the browser, the installation package to be tested includes the target code script and native function function of the target application, the target code script is the running environment provided after the simulation function entry file corresponding to the target application is loaded, the function test result is the script to be tested corresponding to the target application that passed the test, the simulation function entry file includes the simulation function function, the function test result is determined by comparing the preset function call result and the call result of the simulation function function called by the script to be tested, and the native function function is the application programming interface provided by the operating system of the mobile device;

[0109] The second calling unit 402 is used to respond to the second function test instruction for the target application, call the native function function through the function call function in the target code script, and obtain the calling result of the native function function;

[0110] The second testing unit 403 is used to determine a second test result of the function to be tested of the target application by comparing the calling result of the native function with the preset function calling result.

[0111] The application functional testing device provided in the embodiment of the present application and the application functional testing method provided in the above embodiment have the same beneficial effects, which will not be described one by one here.

[0112] After introducing the application function test method and application function test device according to the exemplary embodiment of the present application, next, an electronic device provided according to the embodiment of the present application is introduced.

[0113] The present application embodiment provides an electronic device, which can implement the functional testing method of the application program discussed above. Figure 5 , the device includes a memory 501, a processor 502 and a bus 503.

[0114] The memory 501 is used to store computer programs executed by the processor 502. The memory 501 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0115] The memory 501 may be a volatile memory, such as a random-access memory (RAM); the memory 501 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 501 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 501 may be a combination of the above memories.

[0116] The processor 502 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 502 is used to implement the function testing method of the application program in the above embodiment when calling the computer program stored in the memory 501 .

[0117] The specific connection medium between the memory 501 and the processor 502 is not limited in the embodiment of the present application. Figure 5 In the embodiment, the memory 501 and the processor 502 are connected via a bus 503. The bus 503 is connected to the processor 502 via a bus 503. Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. Bus 503 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0118] Based on the same inventive concept, the embodiment of the present application provides a computer-readable storage medium, and the computer program product includes: computer program code, when the computer program code is run on a computer, the computer executes any of the functional testing methods for application programs discussed above. Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to the functional testing method for application programs, the implementation of the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.

[0119] Based on the same inventive concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the functional testing methods for application programs discussed above. Since the principle of solving the problem by the above computer program product is similar to the functional testing method for application programs, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.

[0120] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0121] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0122] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of user-operated steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0124] Obviously, a person skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A functional testing method for an application, characterized in that: The method comprises: In response to a first function test instruction for a target application, obtaining a script to be tested and a preset simulation function entry file corresponding to the target application, wherein the simulation function entry file includes a simulation function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded; Loading the simulation function entry file, and executing the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function; By comparing the calling result of the simulated function with the preset function calling result, a first test result of the function to be tested of the target application is determined.

2. The method according to claim 1, characterized in that Before obtaining the preset simulation function entry file, the method further includes: In response to an instruction to add a simulation function, in the entry file of the desktop browser development environment of the target application, the simulation function in the simulation function code library is added to obtain the simulation function entry file, wherein the simulation function code library includes multiple simulation function functions.

3. The method according to claim 1, characterized in that The executing the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function includes: Calling the simulation function in the simulation function entry file through the function calling function in the script to be tested, and obtaining the return value of the simulation function; The return value of the simulation function is used as the calling result of the simulation function.

4. The method according to claim 1, characterized in that After determining the functional test result of the target application, the method further includes: If the function test result of the target application is that the test passes, the simulated function function is replaced by the native function function of the target application on the mobile device; the native function function is an application programming interface provided by the operating system of the mobile device; The target code script corresponding to the target application and the native function are packaged to generate a test installation package of the target application, wherein the target code script corresponding to the target application is a test script that has passed the test; The installation package to be tested is sent to the mobile device, so that the mobile device performs a function test on the installation package to be tested.

5. A functional testing method for an application, characterized in that: The method comprises: Receive an installation package to be tested sent by a browser, the installation package to be tested including a target code script and a native function function of a target application, the target code script is a script to be tested corresponding to the target application that has passed the test under a running environment provided after a simulation function entry file corresponding to the target application is loaded, the simulation function entry file includes a simulation function function, the function test result is determined by comparing a preset function call result and a call result of the simulation function function called by the script to be tested, and the native function function is an application programming interface provided by the operating system of the mobile device; In response to a second function test instruction for the target application, the native function function is called through a function call function in the target code script to obtain a call result of the native function function; By comparing the calling result of the native function with the preset function calling result, a second test result of the function to be tested of the target application is determined.

6. A functional testing device for an application, characterized in that: The device comprises: an acquisition unit, configured to respond to a first function test instruction for a target application, acquire a script to be tested and a preset simulation function entry file corresponding to the target application, wherein the simulation function entry file includes a simulation function, and the simulation function entry file is used to provide a running environment for the script to be tested corresponding to the target application after being loaded; A first calling unit is used to load the simulation function entry file and execute the script to be tested corresponding to the target application to call the simulation function and obtain the calling result of the simulation function; The first testing unit is used to determine a first testing result of the function to be tested of the target application by comparing the calling result of the simulated function with the preset function calling result.

7. The device according to claim 6, characterized in that The acquisition unit is further used for: In response to an instruction to add a simulation function, in the entry file of the desktop browser development environment of the target application, the simulation function in the simulation function code library is added to obtain the simulation function entry file, wherein the simulation function code library includes multiple simulation function functions.

8. A functional testing device for an application, characterized in that: The device comprises: A receiving unit is used to receive an installation package to be tested sent by a browser, wherein the installation package to be tested includes a target code script and a native function function of a target application, wherein the target code script is a script to be tested corresponding to the target application that has passed the test under a running environment provided after a simulation function entry file corresponding to the target application is loaded, wherein a function test result is a script to be tested corresponding to the target application that has passed the test, wherein the simulation function entry file includes a simulation function function, wherein the function test result is determined by comparing a preset function call result with a call result of the simulation function function called by the script to be tested, wherein the native function function is an application programming interface provided by an operating system of a mobile device; A second calling unit is used to respond to a second function test instruction for the target application, call the native function function through the function call function in the target code script, and obtain a call result of the native function function; The second testing unit is used to determine a second testing result of the function to be tested of the target application by comparing the calling result of the native function function with the preset function calling result.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the method according to any one of claims 1 to 5 is implemented.

10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.