Application testing methods, apparatus and computer-readable storage media

By receiving and transforming data from the target application to automatically determine and execute test commands, the problem of high human resource consumption in application compatibility testing is solved, and testing efficiency is improved.

CN115705296BActive Publication Date: 2026-06-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-08-17
Publication Date
2026-06-30

Smart Images

  • Figure CN115705296B_ABST
    Figure CN115705296B_ABST
Patent Text Reader

Abstract

This application discloses an application testing method, apparatus, and computer-readable storage medium. Based on a preset application service environment, it receives data to be processed sent by a target application through a visual interface. Based on a preset data model object, it converts the data to be processed into a parameter set. Based on the parameter set, it determines the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from a preset set of test commands. It updates the running task of the component to be tested according to the data to be loaded. It then tests the component to be tested according to the command to be executed and the running task, obtaining test results. This simulates the data loading scenario of the component to be tested in the application, enabling testing based on the simulated scenario without requiring manual operation of the application, thus improving the efficiency of application development or testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically to an application testing method, apparatus, and computer-readable storage medium. Background Technology

[0002] With the development of computer technology, the functions of applications on terminals are constantly emerging, bringing users a variety of experiences. However, during the development or testing phase of an application, compatibility testing is required to determine if any anomalies exist. Related technologies involve manually accessing the relevant pages of the application and performing tests to ascertain its compatibility.

[0003] In the process of researching and practicing existing technologies, the inventors of this application discovered that when conducting compatibility testing on existing applications, relevant personnel need to manually operate the applications, which consumes a lot of human resources and reduces the efficiency of application development or testing. Summary of the Invention

[0004] This application provides an application testing method, apparatus, and computer-readable storage medium. It can save manpower and improve the efficiency of application development or testing.

[0005] This application provides an application testing method, including:

[0006] Based on a preset application service environment, it receives data to be processed sent by the target application through a visual interface;

[0007] Based on a preset data model object, the data to be processed is converted into a set of parameters.

[0008] Based on the parameter set, the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested are determined from the preset test command set;

[0009] Update the running task of the component to be tested according to the data to be loaded;

[0010] The component to be tested is tested according to the command to be executed and the task to be run, and the test results are obtained.

[0011] Accordingly, embodiments of this application provide an application testing apparatus, including:

[0012] The receiving unit is used to receive data to be processed sent by the target application through a visual interface based on a preset application service environment.

[0013] The conversion unit is used to convert the data to be processed into a set of parameters based on a preset data model object;

[0014] The determining unit is used to determine the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from the preset test command set based on the parameter set.

[0015] An update unit is used to update the running task of the component to be tested according to the data to be loaded;

[0016] The testing unit is used to test the component to be tested according to the command to be executed and the task to be run, and to obtain the test results.

[0017] In some embodiments, the receiving unit is further configured to:

[0018] Obtain the memory address information corresponding to the application service environment;

[0019] The memory address information is updated to the child thread socket to obtain the updated child thread socket;

[0020] The updated child thread socket is run by a preset thread creation function to obtain the preset application service environment.

[0021] In some embodiments, the conversion unit is further configured to:

[0022] The data to be processed is parsed to obtain the command identifier, the information of the component to be tested, and the data to be loaded;

[0023] Based on a preset data model object, the command identifier, the information of the component to be tested, and the data to be loaded are converted into a parameter set corresponding to the data to be processed.

[0024] In some embodiments, the determining unit is further configured to:

[0025] Obtain the command identifier from the parameter set;

[0026] The command to be executed is matched with the command identifier from the preset set of test commands. The command to be executed is obtained by marking the initial execution command of the component to be tested according to the preset command marking rules.

[0027] In some embodiments, the updating unit is further configured to:

[0028] Detect the operating status of the component under test;

[0029] When the running state of the component under test is detected to be in the data loading state, the task queue of the component under test is obtained;

[0030] Update the running tasks in the task queue according to the data to be loaded.

[0031] In some embodiments, the updating unit is further configured to:

[0032] When the running status of the component under test is detected to be off, the component under test is started.

[0033] Update the running tasks of the component to be tested after startup based on the data to be loaded.

[0034] In some embodiments, the test unit is further configured to:

[0035] Obtain the execution function corresponding to the command to be executed;

[0036] The execution function runs the command to be executed, and the target test instruction is obtained;

[0037] The test component is controlled to process the running task according to the target test instruction, and the test result is obtained.

[0038] In some embodiments, the application testing apparatus further includes a detection unit for:

[0039] When the test result is detected to contain multiple running records corresponding to the command to be executed, the running time corresponding to each running record is obtained from the test result;

[0040] Two running records with adjacent running times among the multiple running records are identified as running record pairs, and the running time difference of the running record pairs is obtained;

[0041] When the time difference between the running record pairs is detected to be less than a preset time difference threshold, the multiple running records of the command to be executed and the running time corresponding to each running record are updated to the attribute table file.

[0042] Furthermore, embodiments of this application also provide a computer device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the steps in the application testing method provided in embodiments of this application.

[0043] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the application testing methods provided in embodiments of this application.

[0044] Furthermore, embodiments of this application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the application testing methods provided in embodiments of this application.

[0045] This application embodiment can receive data to be processed sent by a target application through a visual interface based on a preset application service environment; convert the data to be processed into a parameter set based on a preset data model object; determine the component to be tested, the corresponding data to be loaded, and the execution command corresponding to the component to be tested from a preset test command set based on the parameter set; update the running task of the component to be tested according to the data to be loaded; and test the component to be tested according to the execution command and the running task to obtain the test results. Therefore, this application embodiment, by receiving data to be processed sent by the target application, determining the component to be tested, the execution command, and the data to be loaded according to the data model object corresponding to the data to be processed, and then testing the component to be tested that loads the data according to the execution command, allows the component to be tested in the application to simulate the scenario of loading data, and tests are performed based on the simulated scenario, without the need for manual operation of the application, thus improving the efficiency of application development or testing. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 This is a schematic diagram of a scenario for the application testing system provided in an embodiment of this application;

[0048] Figure 2 This is a flowchart illustrating the steps of the application testing method provided in the embodiments of this application;

[0049] Figure 3 This is a flowchart illustrating another step of the application testing method provided in this application embodiment;

[0050] Figure 4 This is a schematic diagram of the structure of the visual interface of the target application provided in the embodiments of this application;

[0051] Figure 5 This is a block flowchart illustrating the application testing method provided in the embodiments of this application;

[0052] Figure 6 This is a schematic diagram of the application testing device provided in the embodiments of this application;

[0053] Figure 7 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0055] This application provides an application testing method, apparatus, and computer-readable storage medium. Specifically, this application will be described from the perspective of the application testing apparatus, which can be integrated into a computer device, such as a server or a terminal. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0056] The solutions provided in this application involve technologies such as application testing of artificial intelligence, which are specifically illustrated through the following embodiments:

[0057] For example, see Figure 1 This is a schematic diagram of an application testing system provided in an embodiment of this application. The scenario includes a test device 10 and a device under test 20, which are connected wirelessly to achieve data interaction.

[0058] The user selects or inputs instructions in the instruction editing area of ​​the target application's visual interface on the test device 10, and selects the identifier / information of the component to be tested, the data to be loaded for the component to be tested, and other parameters, so as to generate corresponding data to be processed based on the instruction content, the identifier / information of the component to be tested, the data to be loaded, and other parameters; then, the target application of the test device 10 sends the data to be processed to the device under test 20 so that the device under test 20 can respond.

[0059] The device under test (DUT) 20 can receive data to be processed sent by the target application through a visual interface based on a preset application service environment; convert the data to be processed into a parameter set based on a preset data model object; determine the component to be tested, the corresponding data to be loaded, and the execution command corresponding to the component to be tested from a preset test command set based on the parameter set; update the running task of the component to be tested according to the data to be loaded; and test the component to be tested according to the execution command and the running task to obtain the test results. Furthermore, the DUT can also return the test results to the test device 10.

[0060] Application testing can include processing methods such as receiving data to be processed, transforming data to be processed, determining the components to be tested, commands to be executed, and data to be loaded, updating the running tasks of the components to be tested, and testing the components to be tested.

[0061] The following sections provide detailed descriptions of each example. It should be noted that the order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0062] In this embodiment, the description will focus on the application testing device, which can be integrated into a computer device such as a terminal or server. See also Figure 2 , Figure 2 This application provides a flowchart illustrating the steps of an application testing method. Taking an example where an information processing device is specifically integrated into a terminal, the specific process when the processor on the terminal executes the program corresponding to the information processing method is as follows:

[0063] 101. Based on the preset application service environment, receive the data to be processed sent by the target application through the visual interface.

[0064] The application service environment can be a simulated server or application server (phone server) environment built on the application, which can be used to receive data information sent by other applications on the same device or applications on other devices, so as to realize data interaction between the application and other applications.

[0065] The target application can be an application on the same terminal as the application receiving the data, or it can be an application on a different terminal, i.e., an application on another terminal. It should be noted that the target application may include a visual interface, which may include a command editing area, a data loading selection area, and a component selection area to be tested. Users can select or input corresponding data through the target application's visual interface to generate data to be processed based on the user's selected or input data, parameters, commands, etc., and send it to the current application's receiving terminal.

[0066] The data to be processed can consist of test instructions containing command identifiers and data to be loaded. This data is used to control and test the application's receiving end. The target application can be understood as the test application end, i.e., the test instruction sending end. For example, in the application implementation, in order to test the current application's receiving end, the target application generates the data to be processed and sends it to the current application's receiving end, causing the current application's receiving end to execute the instructions (commands) and the data to be loaded corresponding to the data to be processed, thereby achieving testing of the current application's receiving end through the target application.

[0067] For ease of understanding and description, the embodiments of this application use the current application receiving end as the application to be tested or the application to be tested, so as to facilitate understanding.

[0068] In order to test the application under test, in this embodiment of the application, the application under test needs to receive unprocessed data sent by the target application, so as to conduct subsequent tests on the application's functionality, compatibility, etc. based on the unprocessed data.

[0069] It should be noted that, in order for the application under test to receive the data to be processed sent by the target application (the test instruction application), this embodiment of the application requires the pre-establishment of an application service environment on the side of the application under test. Specifically, a simulation server on the application side is created through the target interface of a multi-threaded framework, and the simulation server on the application side is started to obtain the application service environment.

[0070] In some implementations, the step "receiving data to be processed sent by the target application through a visual interface based on a preset application service environment" may include:

[0071] (1) Obtain the memory address information corresponding to the application service environment.

[0072] The memory address information can be the memory address of the simulated server environment within the application under test. This memory address allows for the development and maintenance of the simulated server environment's resource space to support its operation. For example, data generated by the simulated server environment during runtime, as well as components and code generated during server updates, can be stored in the memory corresponding to this memory address.

[0073] In order to obtain the memory address information corresponding to the application service environment, this application embodiment can obtain the identification information of the components of the application service environment and determine the memory address information corresponding to the application service environment based on the identification information.

[0074] (2) Update the memory address information to the child thread socket to obtain the updated child thread socket.

[0075] The sub-thread socket can be an endpoint for communication between the application under test and the target application, and can be used to enable the application under test to receive data to be processed sent by the target application.

[0076] To create an application service environment on the application under test to receive data to be processed sent by the target application, this embodiment of the application application requires initialization of the application service environment. Specifically, the initialization process of the application service environment may involve initializing a sub-thread socket object, which can be a simulated server, thereby initializing the application service environment. The initialization process of the sub-thread socket object may involve updating the memory address information to the sub-thread socket to transmit the memory address information corresponding to the application service environment to the sub-thread socket, thus initializing the sub-thread socket object. This completes the initialization of the application service environment.

[0077] (3) The updated child thread socket is run through the preset thread creation function to obtain the preset application service environment.

[0078] The thread creation function can be a function or program that runs / executes / generates child threads, and can be used to create a main thread or child threads. For example, in this embodiment, the thread creation function can be used to create other child threads of the application to be tested for the operation of other components or subroutines.

[0079] To ensure that the application under test has the corresponding application service environment, this embodiment of the application starts a simulated server after initialization, thereby providing the application under test with the application service environment. Specifically, the process of starting the simulated server after initialization may include: running a sub-thread socket containing memory address information through a preset thread creation function to obtain the preset application service environment.

[0080] In some implementations, the step "running the updated child thread socket through a preset thread creation function to obtain a preset application service environment" may include:

[0081] (3.1) Generate running subtasks based on the updated child thread sockets and add the running subtasks to the asynchronous execution queue.

[0082] (3.2) Based on the asynchronous execution queue, the updated child thread socket is run through the preset thread creation function to obtain the preset application service environment.

[0083] The asynchronous execution queue can be a queue for real-time response to tasks, used to sequentially execute subtasks added to the queue in real time, enabling multiple subtasks to be executed in parallel. It should be noted that this asynchronous execution queue corresponds to a sub-thread.

[0084] It should be noted that the main process is mainly used to load data of the application under test or run its own parameters. In order to reduce the time when initializing the application service environment, this embodiment adds the running subtask corresponding to the updated sub-thread socket to the asynchronous execution queue (corresponding to the sub-thread) so as to run the updated sub-thread socket in real time through the preset thread creation function to obtain the preset application service environment.

[0085] By using the above methods, the application service environment is started, and based on the application service environment, the application under test receives the data to be processed sent by the target application, so as to facilitate subsequent testing of the application's functionality, compatibility, etc. based on the data to be processed.

[0086] 102. Based on the preset data model object, convert the data to be processed into a parameter set.

[0087] The data model object can be a model object that transforms different types of data, converting them into data that the application can recognize. For example, in this embodiment, based on the data model object, various types of data in the data to be processed are converted into a data set that the application to be tested can recognize. This data set may include test instructions carrying command identifiers, information about the components to be tested, data to be loaded, and other parameters.

[0088] The parameter set can be a collection of one or more test parameters, each of which instructs the application under test to respond or proceed accordingly during testing. For example, the parameter set may include command identifiers, information about the component under test, and data to be loaded. Specifically, the command identifier determines the corresponding command to be executed by the application under test, the information about the component under test instructs the application to determine the corresponding target component, and the data to be loaded determines the data loading task for the target component of the application under test.

[0089] In some implementations, the step "converting the data to be processed into a parameter set based on a preset data model object" may include:

[0090] (1) Parse the data to be processed to obtain the command identifier, the information of the component to be tested, and the data to be loaded;

[0091] (2) Based on the preset data model object, the command identifier, the information of the component to be tested and the data to be loaded are converted into the parameter set corresponding to the data to be processed.

[0092] The command identifier can be the instruction identifier carried by the test instruction, which is used to match the corresponding command or instruction from the preset command library of the application under test.

[0093] The information about the component to be tested can include the identifier, parameters, and other information of the component to be tested in the application to be tested.

[0094] The data to be loaded can be the data loaded when testing the component under test in the application under test, and is used to set the data execution task of the component under test when testing the application under test.

[0095] In order to obtain a set of parameters that the application under test can directly recognize, this embodiment of the application needs to convert the data to be processed into one or more parameters that the application can directly recognize after receiving the data to be processed, that is, to obtain a set of parameters corresponding to the data to be processed. Specifically, the data conversion process can be as follows: parse the data to be processed to obtain command identifiers, information of the component under test, data loaded by the component under test during testing, etc., and after the parsing is completed, create a data model object, and use the data model object to convert the command identifiers, information of the component under test, and data to be loaded into parameters in the corresponding data format, such as converting binary / string / JSON data into data parameters that the application can recognize, to obtain a set containing multiple parameters that the application can recognize.

[0096] By employing the above methods, when processing data, the data is first parsed to determine the parameters required for testing the components in the application under test. Furthermore, the parameters are transformed using a data model object, enabling direct identification and invocation in application-oriented object programming. This facilitates data acquisition during application runtime, preventing data corruption due to application inability to recognize data, thus ensuring efficient data transmission and improving the success rate and efficiency of application testing.

[0097] 103. Based on the parameter set, determine the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from the preset test command set.

[0098] The component to be tested can be a component within the application being tested, such as a component that needs to be tested during application testing. For example, the component to be tested could be a video player component, an audio playback component, etc.

[0099] The command to be executed can be an execution command used to test the application and control the components to be tested in the application.

[0100] To identify the components to be tested during application testing, this embodiment of the application, after obtaining the parameter set corresponding to the data to be processed, can determine the components to be tested based on the parameter set. Specifically, the process of determining the components to be tested can be: obtaining information about the components to be tested from the parameter set; and determining the corresponding components to be tested based on the information about the components to be tested. This facilitates subsequent testing of the determined components to be tested in the application.

[0101] To determine the commands to be executed when testing the component under test, embodiments of this application can determine the commands to be executed based on a parameter set. Specifically, a command identifier is obtained from the parameter set; the command to be executed corresponding to the command identifier is matched from a preset test command set, wherein the command to be executed is obtained by marking the initial execution command of the component under test according to a preset command marking rule. In this way, the commands to be executed required for testing the component under test in the semantic program are obtained, so that the component under test can be tested subsequently based on the commands to be executed.

[0102] It should be noted that the preset test command set contains multiple executable commands of the application. These executable commands can be converted commands. Specifically, the conversion process can be as follows: when the application service environment is detected, the initial execution command of the component under test is obtained; the initial execution command is marked according to the preset command marking rules to obtain the executable command corresponding to each initial execution command. The preset command marking rules can be format rules that define the format of the commands to be executed.

[0103] By using the above methods, the component to be tested, the data to be loaded during testing, and the commands to be executed during testing of the component to be tested can be determined, so as to test the application based on the above parameters.

[0104] 104. Update the running tasks of the component to be tested based on the data to be loaded.

[0105] The running task can be a task for the corresponding component in the application to load data, which is used to instruct the corresponding component in the application to load relevant data during testing.

[0106] Since the application under test may have built-in components with corresponding running tasks before testing, or the components under test may not contain any running tasks, it is necessary to set the running tasks of the components under test in order to enable them to load data according to the determined data to be loaded during testing. In this embodiment, the running tasks of the components under test are updated according to the data to be loaded, so that the components under test can load data according to the commands to be executed.

[0107] In some implementations, the step "update the running task of the component under test according to the data to be loaded, and obtain the updated component under test" may include:

[0108] (1) Detect the running status of the component to be tested.

[0109] The running state can be the state of a component, which can include the loading state (data loading state), the closed state, etc.

[0110] In order to set the running tasks of the component under test, this embodiment of the application needs to first detect the status of the component under test. Specifically, the task process queue of the application under test is obtained; the component process identifiers contained in the task process queue are extracted to obtain a set of component process identifiers; based on the set of component process identifiers, the running status of the target component corresponding to the component information under test is determined. It can be understood that when it is detected that the set of component process identifiers contains a component process identifier that matches the component information under test, it is determined that the target component corresponding to the component under test is in a loading state; when it is detected that the set of component process identifiers does not contain a component process identifier that matches the component information under test, the target component corresponding to the component under test is in a closed state.

[0111] By using the above methods, the running status of the component to be tested corresponding to the component information is determined, so as to facilitate the subsequent setting of running tasks and application testing.

[0112] (2) When the running state of the component under test is detected to be loading data, obtain the task queue of the component under test.

[0113] (3) Update the running tasks in the task queue according to the data to be loaded.

[0114] The task queue can be a queue that records the running tasks of the component under test, used to manage or store the running tasks so that the component under test can load data or perform other processing according to the running tasks in the task queue.

[0115] In order to enable the component under test to load according to the determined data to be loaded during testing, this embodiment of the application updates the running task of the component under test in the data loading state when it is detected that the current running state of the component under test is in the data loading state, so as to obtain the updated component under test.

[0116] Specifically, the process of updating the running tasks of the component under test can be as follows: stop the data loading state of the component under test, delete the running tasks in the task queue of the component under test, and obtain the task queue after deletion; generate the running tasks corresponding to the data to be loaded in the task queue, and obtain the updated component under test.

[0117] In addition, the process of updating the running task of the component under test can also be as follows: control the component under test to pause the first running task in the task queue; generate the running task corresponding to the data to be loaded in the task queue of the component under test; update the running task corresponding to the data to be loaded to the first running task in the task queue, and obtain the updated component under test.

[0118] By using the above methods, the running tasks of the components under test in the application under test that are in the data loading state can be updated, so that the components under test can be loaded according to the determined data to be loaded during subsequent testing, which fits the application testing requirements and improves the accuracy of application testing.

[0119] In addition, the step "update the running task of the component under test according to the data to be loaded, and obtain the updated component under test" may also include:

[0120] (3) When the running state of the component under test is detected to be closed, start the component under test;

[0121] (4) Update the running tasks of the component to be tested after startup based on the data to be loaded.

[0122] To ensure that the component under test meets the testing requirements, this embodiment of the application needs to start the component under test when its running state is detected as closed, to ensure timely response during subsequent testing. Furthermore, a running task corresponding to the data to be loaded is generated in the started component under test, resulting in an updated component under test. This allows for testing of the component under test process while it is loading the data to be loaded.

[0123] By using the above methods, the running tasks of the components under test in the application that are in the data loading state or closed state can be updated to obtain the updated components under test, so as to facilitate subsequent testing of the components under test and improve the accuracy and efficiency of testing.

[0124] 105. Test the component to be tested according to the command to be executed and the task to be run, and obtain the test results.

[0125] To test the application under test, this embodiment primarily tests target components within the application, such as the component under test, to determine its functionality when running relevant tasks. Specifically, the component under test, which has a running task corresponding to the data to be loaded, is tested using commands to be executed, and test results are obtained.

[0126] In some implementations, the step "testing the component to be tested according to the command to be executed and the task to be run, and obtaining the test results" may include:

[0127] (1) Obtain the running function corresponding to the command to be executed.

[0128] The running function can be a function that executes the corresponding executable command in the component under test. The executable command can be run through the running function to test the component under test.

[0129] To obtain the execution function corresponding to the command to be executed, the process in this embodiment can be as follows: obtain the target function pointer in the component to be tested based on the command identifier corresponding to the command to be executed, and then find the execution function of the corresponding executable command based on the target function pointer. This allows the command to be executed subsequently through this execution function to obtain test results.

[0130] (2) Run the command to be executed through the running function to obtain the target test instruction.

[0131] It should be noted that the running function may contain a command pointer, which may contain a mapping relationship between the current running function and the corresponding initial execution command or corresponding execution command of the component under test. The command pointer may point to the corresponding execution command so that the running function executes the corresponding execution command.

[0132] To obtain the test instructions for the component under test when it is loading and running a task, this embodiment of the application, after obtaining the run function, runs the command to be executed through the run function to obtain the target test instructions. Specifically, the target command code of the command to be executed is obtained, and the target command code is run through the run function to obtain the target test instructions, so that the component under test in the loading and running task can be tested according to the target test instructions.

[0133] In some implementations, before the step "running the command to be executed through the running function to obtain the target test instruction," the process may include: obtaining the target identifier of the command to be executed corresponding to the command pointer in the running function; when it is detected that the target command identifier pointed to by the command pointer matches the command identifier of the command to be executed, running the command to be executed through the running function to obtain the target test instruction. Thus, before executing the task through the running function, the correspondence between the running function and the command to be executed is determined based on the command pointer contained in the running function. When the running function corresponds to the command to be executed, the command to be executed can be run through the running function to ensure that the command to be executed can run normally, improving the efficiency of subsequent testing of the application.

[0134] Understandably, when a discrepancy is detected between the target command identifier pointed to by the command pointer and the command identifier of the command to be executed, the corresponding execution function for the command to be executed is retrieved again. If a function with a high degree of matching with the command to be executed is retrieved, the target command identifier pointed to by the command pointer of the re-retrieved execution function is compared with the command identifier of the command to be executed. If they match, the command to be executed is run through the execution function to obtain the target test instruction. This ensures that the command to be executed can run normally, improving the efficiency of subsequent application testing.

[0135] In the above way, the command to be executed is run through the function, so that the component to be tested in the loading and running task can be tested according to the target test instructions obtained.

[0136] (3) Control the component under test to process the running task according to the target test instructions and obtain the test results.

[0137] In order to test the component under test, this embodiment of the application, after receiving the target test instruction, controls the component under test based on the target test instruction, specifically controlling the component under test to process the running task and obtain the test result.

[0138] For example, taking a video playback application as an example, the component under test is a player component. When the target test command is a play command, the player component is controlled to load the video data corresponding to the running task; when the target test command is a pause command, the player component is controlled to pause loading the video data corresponding to the running task; when the target test command is a stop playback command, the player component is controlled to stop loading the video data corresponding to the running task; when the target test command is to read local playback data, the player component is controlled to switch the video data corresponding to the running task, specifically switching the video data corresponding to the running task to local playback data and loading the local playback data; when the target test command is to adjust the playback progress command, the player component is controlled to adjust the data loading progress of the video data corresponding to the running task, and so on. Furthermore, the response status of the component under test in the above test scenarios is obtained in real time, such as the response time of the component under test when responding to the target test command, and other test results. The above are only examples; the embodiments of this application can also be applied to test scenarios of audio applications and other equivalent applications.

[0139] In some implementations, after the step "test the updated component under test according to the command to be executed and obtain the test results", the following steps may be included: reading the generation time and response time of the target test command in the test results; determining the response time of the component under test based on the generation time and response time of the target test command; determining that the component under test is in an abnormal response state corresponding to the target test command when the response time is detected to be greater than a preset response time threshold; and updating the abnormal response state corresponding to the target test command to the attribute table file.

[0140] It should be noted that the test results may include the generation time of the target test instruction and the response time of the component under test in response to the target test instruction. Since the target test instruction is usually responded to immediately after its generation, the time taken by the component under test to respond to the target test instruction can reflect whether there is an anomaly in the component under test.

[0141] To test whether the component under test has any abnormalities, in this embodiment, the generation time and response time of the target test instruction contained in the test results can be read to determine the current response time of the component under test. Furthermore, when the response time exceeds a preset response time threshold, it can be confirmed that the component under test is in an abnormal response state corresponding to the target test instruction, and the abnormal response state corresponding to the target test instruction is updated to the attribute table file. This allows the attribute table file to be subsequently fed back to the target application for relevant personnel to access.

[0142] In some implementations, the step "testing the updated component to be tested according to the command to be executed and obtaining the test results" may include:

[0143] A. When the test results contain multiple running records corresponding to the command to be executed, obtain the running time corresponding to each running record from the test results;

[0144] B. Identify two running records with adjacent running times from among multiple running records as a running record pair, and obtain the running time difference between the running record pairs;

[0145] C. When the time difference between the execution records is less than the preset time difference threshold, the multiple execution records of the command to be executed and the execution time corresponding to each execution record are updated to the attribute table file.

[0146] It should be noted that, in this embodiment, when performing automated testing on the component under test, if the component under test cannot respond to the command to be executed in real time, such as due to malfunction or error in the component's operation, the command to be executed will be executed multiple times until the component under test responds or the corresponding number of command executions is reached. Therefore, when the test results contain multiple consecutive execution records of the command to be executed and the time difference between two adjacent execution commands is too small, it can be determined that the component under test has an abnormal response.

[0147] To test whether the component under test has any anomalies, in this embodiment, after testing the updated component under test according to the command to be executed, when multiple running records corresponding to the command to be executed are detected in the test results, the running time corresponding to each running record can be obtained, and the running time difference between any two running records with adjacent running times can be obtained. When the running time difference is less than a preset running time difference threshold, it indicates that the component under test may contain an anomaly. Furthermore, the multiple running records of the command to be executed and the running time corresponding to each running record are updated to an attribute table file, so that the attribute table file can be subsequently fed back to the target application for relevant personnel to be aware of.

[0148] In this embodiment, to automate the testing of applications on a terminal, such as by simulating the operation of the application on the terminal through automated testing, the response of the components under test in the application can be determined. Specifically, the application under test can launch an application service environment to receive data to be processed sent by the target application on other devices (senders) through a visual interface. This allows relevant users to perform operations related to the data to be processed through the visual interface of the target application and send it to the application under test, thereby enabling testing of the application under test through the target application, improving testing efficiency and convenience.

[0149] Furthermore, after receiving the data to be processed from the target application through the visual interface, the application under test transforms the data to be processed through the created data model object to obtain a parameter set containing multiple parameters. This allows the application under test to directly identify the transformed parameters, improving the transmission efficiency of the instructions or information corresponding to the data to be processed, as well as improving the recognition rate of the application under test for relevant parameters or instructions, thus ensuring reliability.

[0150] Furthermore, based on the parameter set obtained from the transformation, the components to be tested, the data to be loaded, and the commands to be executed in the current test process are determined within the application under test. The runtime tasks of the components under test are updated according to the data to be loaded, ensuring that the components can load the determined data during testing. This simulates the data loading scenario for the components in the application, achieving the expected test environment and making subsequent test results more realistic. After updating the runtime tasks of the components under test, they are tested according to the commands to be executed and the runtime tasks to obtain test results. These results reveal the status of the components under test and identify any anomalies. This method enables testing based on simulated application loading scenarios without manual intervention, improving the efficiency of application development and testing.

[0151] As can be seen from the above, the embodiments of this application can receive data to be processed sent by the target application through a visual interface based on a preset application service environment; convert the data to be processed into a parameter set based on a preset data model object; determine the component to be tested, the corresponding data to be loaded, and the execution command corresponding to the component to be tested from a preset test command set based on the parameter set; update the running task of the component to be tested according to the data to be loaded; and test the component to be tested according to the execution command and the running task to obtain the test result. Therefore, the embodiments of this application, by receiving data to be processed sent by the target application, determining the component to be tested, the execution command, and the data to be loaded according to the data model object corresponding to the data to be processed, and then testing the component to be tested that loads the data according to the execution command, simulate the scenario of data loading in the application, and perform testing based on the simulated scenario, without requiring manual operation of the application, thus improving the efficiency of application development or testing.

[0152] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.

[0153] This application takes application testing as an example to further describe the application testing method provided in this application embodiment.

[0154] See Figure 3 , Figure 3 This is a schematic diagram of another step in the application testing method provided in the embodiments of this application. Figure 4 This is a schematic diagram of the structure of the visual interface of the target application provided in the embodiments of this application. Figure 5 This is a block flowchart illustrating the application testing method provided in the embodiments of this application; for ease of understanding, please refer to it in conjunction with... Figure 3 , Figure 4 and Figure 5 The embodiments of this application will be described below.

[0155] In this embodiment, the description will focus on the application testing device, which can be integrated into a computer device. This computer device can be a test terminal or a terminal under test, where the test terminal contains the target application, and the terminal under test contains the application to be tested. When the processor on the test terminal or the terminal under test executes the program corresponding to the application testing method, the specific flow of the application testing method is as follows:

[0156] 201. The target application obtains the data set generated in the visualization interface and determines the data to be processed based on the obtained data set.

[0157] The data set can be a collection containing multiple types or multiple data, and the data in the data set is generated by the user inputting or selecting data in the visual interface.

[0158] For example, such as Figure 4 As shown, the visual interface 40 of the target application is not limited to including an instruction editing area 41, a data loading selection area 42, and a component to be tested selection area 43. Users can input or select control instructions through the instruction editing area 41. These control instructions may carry command identifiers to determine the corresponding commands to be executed in the application under test. Users can select or set the type of data to be loaded through the data loading selection area 42, so that the application under test can set the loading task of the component under test based on the data. Users can select or set information about the component under test (such as an identifier) ​​through the component to be tested selection area 43 to determine the component under test in the application under test. The above are merely examples; other data may also be included in the embodiments of this application.

[0159] 202. The target application sends the data to be processed to the application under test through a visual interface.

[0160] In this embodiment of the application, after the target application determines the data to be processed based on the data set generated in the visualization interface, it needs to send the data to be processed to the application to be tested.

[0161] For example, when a user clicks the "Send Command" button in the visual interface through the target application, the target application on the test terminal will scan the port number of the application service environment (PhoneServer) of the application under test on the test terminal, and select the target port number corresponding to the application under test to send data for testing.

[0162] 203. The application to be tested is based on the application service environment and receives data to be processed sent by the target application through a visual interface.

[0163] The application service environment can be a simulated server or application server (Phonesever) environment built on the application, which can be used to receive data information sent by other applications on the same device or applications on other devices, so as to realize data interaction between the application and other applications.

[0164] The target application can be an application on the same terminal as the application receiving the data, or it can be an application on a different terminal, i.e., an application on another terminal. It should be noted that the target application may include a visual interface, which may include a command editing area, a data loading selection area, and a component selection area to be tested. Users can select or input corresponding data through the target application's visual interface to generate data to be processed based on the user's selected or input data, parameters, commands, etc., and send it to the current application's receiving terminal.

[0165] In order to test the application under test, in this embodiment of the application, the application under test needs to receive unprocessed data sent by the target application, so as to conduct subsequent tests on the application's functionality, compatibility, etc. based on the unprocessed data.

[0166] For example, an application service environment (PhoneServer) is built on the application under test using the relevant interfaces (APIs) of the multi-threading (pthread) framework. The process of starting the receiving service and executing the tests both occur in a sub-thread, using multi-core programming (Grand Central Dispatch Apple, GCD) to start the sub-thread, as detailed below:

[0167] dispatch_async(dispatch_get_main_queue(), ^

[0168] {

[0169] / / Initialize PhoneServer

[0170] });

[0171] It should be noted that the application under test handles user events such as swiping, clicking, pinching, and page rendering on the main thread. To improve testing efficiency, this embodiment of the application starts a sub-thread to perform application testing.

[0172] Specifically, the process of creating an application service environment can be as follows: obtain the memory address information corresponding to the application service environment, update the memory address information to the child thread socket, obtain the updated child thread socket, and run the updated child thread socket through a preset thread creation function to obtain the preset application service environment. For example, the thread_ret socket is initialized through a function. This socket needs to initialize an object attr of the pthread_attr_t class to describe the service attributes. Calling pthread_attr_init and passing in the address of attr completes the initialization of the attr object. Set attr to SCHED_RR (polling). Pass the finally generated attr address to thread_ret to complete the initialization of PhoneServer. When the application starts, calling the start method of PhoneServer will start detecting data input on a specific port.

[0173] By using the above methods, the application service environment is started, and based on the application service environment, the application under test receives the data to be processed sent by the target application, so as to facilitate subsequent testing of the application's functionality, compatibility, etc. based on the data to be processed.

[0174] 204. The application under test parses the data to be processed to obtain the command identifier, the information of the component under test, and the data to be loaded.

[0175] The command identifier can be the instruction identifier carried by the test instruction, which is used to match the corresponding command or instruction from the preset command library of the application under test.

[0176] The information about the component to be tested can include the identifier, parameters, and other information of the component to be tested in the application to be tested.

[0177] The data to be loaded can be the data loaded when testing the component under test in the application under test, and is used to set the data execution task of the component under test when testing the application under test.

[0178] In this embodiment of the application, the data to be processed is parsed to obtain the parameters that need to be executed when testing the component to be tested in the application to be tested, such as obtaining the command identifier, the component to be tested information, and the data to be loaded.

[0179] For example, the application under test may include a data analysis module (DataParse), which parses the received raw data into commands and related parameters. In some examples, a plist file can be created, and then the data to be processed can be parsed to obtain the execution parameters, such as command identifiers, information about the component under test, and data to be loaded. The command identifiers, information about the component under test, and data to be loaded are then added to the plist file, thus achieving plist formatting of the data to be processed.

[0180] Furthermore, the DataParse module can add log fields to the property table file (plist) after formatting the plist of the data to be processed. For example, taking a video client as the application to be tested and the player component as the component to be tested, the log fields can include businessType (the business type of the player component), page_number (the page number; each playback page is numbered sequentially after loading, and this field allows direct indexing of the playback page), cachePlay (whether to use cached data; during development and testing, some playback resources are local; if they exist locally and cachePlay is true, then local resources are loaded), pageData (page element data, generally referring to other tag elements on the page), and controlData (interface data controlling playback, including the identifier of the execution command calling the player component, the passed parameters, etc.). This facilitates subsequent access to the data in the property table file (plist).

[0181] 205. The application under test converts the command identifier, the information of the component under test, and the data to be loaded into a parameter set corresponding to the data to be processed, based on a preset data model object.

[0182] The data model object can be a model object that transforms different types of data, converting them into data that the application can recognize. For example, in this embodiment, based on the data model object, various types of data in the data to be processed are converted into a data set that the application to be tested can recognize. This data set may include test instructions carrying command identifiers, information about the components to be tested, data to be loaded, and other parameters.

[0183] In order to obtain a set of parameters that the application under test can directly recognize, this embodiment of the application creates a data model object after parsing the data to be processed. The data model object is used to convert command identifiers, information of the components under test and data to be loaded into parameters in the corresponding data format. For example, binary / string / JSON data are converted into data parameters that the application can recognize, resulting in a set of parameters that can be recognized by multiple applications.

[0184] By employing the above methods, direct identification and direct parameter calling in application-oriented object programming facilitate data acquisition during application runtime. This avoids data corruption caused by the application's inability to identify the data, thereby ensuring efficient data transmission and improving the success rate and efficiency of application testing.

[0185] 206. The application to be tested determines the components to be tested and the corresponding data to be loaded based on the parameter set.

[0186] The component to be tested can be a component within the application being tested, such as a component that needs to be tested during application testing. For example, the component to be tested could be a video player component, an audio playback component, etc.

[0187] To identify the components to be tested during application testing, this embodiment of the application, after obtaining the parameter set corresponding to the data to be processed, can determine the components to be tested based on the parameter set. Specifically, the process of determining the components to be tested can be: obtaining information about the components to be tested from the parameter set; and determining the corresponding components to be tested based on the information about the components to be tested. This facilitates subsequent testing of the determined components to be tested in the application.

[0188] 207. The application under test determines the execution command corresponding to the component under test from the preset test command set based on the parameter set.

[0189] The command to be executed can be an execution command used to test the application and control the components to be tested in the application.

[0190] To determine the commands to be executed when testing the component under test, embodiments of this application can determine the commands to be executed based on a parameter set. Specifically, a command identifier is obtained from the parameter set; the command to be executed corresponding to the command identifier is matched from a preset test command set, wherein the command to be executed is obtained by marking the initial execution command of the component under test according to a preset command marking rule. In this way, the commands to be executed required for testing the component under test in the semantic program are obtained, so that the component under test can be tested subsequently based on the commands to be executed.

[0191] It should be noted that the preset test command set contains multiple executable commands of the application. These executable commands can be converted commands. Specifically, the conversion process can be as follows: when the application service environment is detected, the initial execution command of the component under test is obtained; the initial execution command is marked according to the preset command marking rules to obtain the executable command corresponding to each initial execution command. The preset command marking rules can be format rules that define the format of the commands to be executed. For example, the application under test may include a hook function module (hook module), which hooks the original initial execution command of the component under test, generating executable commands with an underscore prefix. The original initial execution commands of the component under test include the following:

[0192]

[0193] The initial execution command is transformed by the hook function module to obtain the corresponding executable command, which is then stored in the preset test command set. This allows the system to determine the corresponding executable command for the component under test from the preset test command set based on the command identifier in the parameter set.

[0194] 208. The application under test updates the running tasks of the component under test based on the data to be loaded.

[0195] The running task can be a task for the corresponding component in the application to load data, which is used to instruct the corresponding component in the application to load relevant data during testing.

[0196] Since the application under test may have built-in components with corresponding running tasks before testing, or the components under test may not contain any running tasks, in order to enable the components under test to load according to the determined data to be loaded during testing, it is necessary to set the running tasks of the components under test.

[0197] In this embodiment of the application, it is necessary to detect the running status of the component under test. When the running status of the component under test is detected to be loading data, the running task of the component under test needs to be updated according to the data to be loaded. When the running status of the component under test is detected to be closed, the component under test is started, and the running task of the started component under test is updated according to the data to be loaded.

[0198] For example, taking a video client as the application to be tested, the video client may contain multiple player components. If player component A is chosen as the component to be tested, after determining that player component A needs to be tested, it is necessary to determine whether the current video client has player component A open / started. If the video client has already opened / started player component A, the playback data of player component A can be refreshed based on the data to be loaded. For example, the data to be loaded could be a specific video data or the playback page data corresponding to that video data; that is, player component A can be refreshed based on a specific video data or the corresponding playback page data (page_number). If the video client has not opened / started player component A, then player component A is started, and player component A is refreshed based on a specific video data or the corresponding playback page data (page_number).

[0199] 209. The application under test performs tests on the components under test according to the commands to be executed and the tasks to be run, and obtains the test results.

[0200] The embodiments of this application mainly test the target components in the application to be tested, such as testing the component to be tested, in order to determine the functionality of the component to be tested when running relevant running tasks.

[0201] Specifically, the testing process can be as follows: Obtain the execution function corresponding to the command to be executed. For example, obtain the target function pointer in the component under test based on the command identifier corresponding to the command to be executed, and find the execution function of the corresponding executable command based on the target function pointer; run the command to be executed through the execution function to obtain the target test instruction. It should be noted that the execution function may contain a command pointer, which may contain a mapping relationship between the current execution function and the corresponding initial execution command or the corresponding command to be executed in the component under test. The command pointer may point to the corresponding command to be executed, so that the execution function runs the corresponding command to be executed; furthermore, control the component under test to process the running task according to the target test instruction to obtain the test result.

[0202] For example, taking a video client as the application to be tested and the player component as the component to be tested, the target function pointer (IMP) of the initial execution command matching the command to be executed in the player component is obtained by calling the method function (objc_getMethod) of the object. This IMP pointer can be interpreted as the address of the initial execution command. The list of running functions and the attributes of the initial execution command can be indirectly obtained based on the address of the initial execution command. Therefore, the running function corresponding to the initial execution command can be found through the IMP pointer. Specifically, the search can be performed first in the base class. If it is not found in the base class, the search continues in the parent class until the running function to be called is found. Furthermore, the execution function runs the command to be executed to test the player component when the task is executed. For example, by calling the hook, the command pointer (isa) of the execution function is made to point to the target command code in the command to be executed. For example, when the hook call occurs, in "_startPlay" which starts with "_", the command pointer (isa) of the execution function points to "startPlay" to realize the call of the self command. In this way, code instrumentation can be performed while ensuring that the original method functions can be executed normally.

[0203] For example, taking a video playback application as the test application, the component under test is a player component. When the target test command is a play command, the player component is controlled to load the video data corresponding to the running task; when the target test command is a pause command, the player component is controlled to pause loading the video data corresponding to the running task; when the target test command is a stop playback command, the player component is controlled to stop loading the video data corresponding to the running task; when the target test command is to read local playback data, the player component is controlled to switch the video data corresponding to the running task, specifically switching the video data corresponding to the running task to local playback data and loading the local playback data; when the target test command is to adjust the playback progress command, the player component is controlled to adjust the data loading progress of the video data corresponding to the running task, and so on. Furthermore, the response status of the component under test in the above test scenarios is obtained in real time, such as the response time of the component under test when responding to the target test command, and other test results. The above are only examples; the embodiments of this application can also be applied to test scenarios of audio applications and other equivalent applications.

[0204] 210. The application under test updates the test results to the property table file and feeds back the updated property table file to the target application, so that the target application can display the updated property table file through a visual interface.

[0205] The test results can include the generation time of the target test instruction and the response time of the component under test in response to the target test instruction. Since the target test instruction is usually responded to immediately after its generation, the time taken by the component under test to respond to the target test instruction can reflect whether there is an anomaly in the component under test.

[0206] For example, to test whether a component under test has any anomalies, the generation and response times of the target test command contained in the test results can be read. Based on these times, the current response time of the component under test can be determined. Furthermore, if the response time exceeds a preset response time threshold, it can be confirmed that the component under test is in an abnormal response state corresponding to the target test command, and the abnormal response state corresponding to the target test command can be updated in the attribute table file. This allows the attribute table file to be subsequently fed back to the target application for relevant personnel to access.

[0207] For example, when performing automated testing on a component under test, if the component cannot respond in real time to the command to be executed, such as due to malfunction or error in the component's operation, the command will be executed multiple times until the component responds or the corresponding number of command executions is reached. Therefore, if the test results contain multiple consecutive execution records of the command to be executed and the execution time difference between two adjacent executions is too small, it can be determined that the component under test has a response anomaly. Specifically, after testing the updated component under test according to the command to be executed, when multiple execution records corresponding to the command to be executed are detected in the test results, the execution time corresponding to each execution record can be obtained, and the execution time difference between any two execution records with adjacent execution times can be obtained. If the execution time difference is less than a preset execution time difference threshold, it indicates that the component under test may contain an anomaly. Furthermore, the multiple execution records of the command to be executed and the execution time corresponding to each execution record are updated to the attribute table file so that the attribute table file can be fed back to the target application for relevant personnel to be informed.

[0208] Furthermore, the application under test can generate logs based on the test results (which may include relevant data on the abnormal or normal response status of the component under test) and update them in the property list file (plist). For example, when the test results contain data on the abnormal response status of the component under test, an exception report log is generated and written to the property list file (plist).

[0209] In addition, after updating the property table file, the application under test sends the updated property table file back to the target application, allowing the target application to display the updated property table file through a visual interface for relevant personnel to see.

[0210] like Figure 5The diagram shown is a block flowchart illustrating the application testing method provided in this application embodiment. In this application embodiment, steps 201-210 are executed to achieve the following: Figure 5 The process, specifically... Figure 5 The application testing method flow shown is as follows:

[0211] 301. The target application sends data to be processed.

[0212] 302. Based on the application service environment (Phonesever), receive data to be processed.

[0213] 303. The Data Parse module creates an attribute table file (plist).

[0214] 304. The Data Parse module parses the data to be processed and creates data model objects.

[0215] 305. Determine whether the player component is open in the application under test. If not, proceed to step 306. If yes, proceed to step 307.

[0216] 306. Start the player component and create playback page data, then execute process 308.

[0217] 307. Refresh the playback page data of the already started player component, and then execute process 308.

[0218] 308. Call the hook function module to perform data operations in the control data and obtain the test results.

[0219] 309. Generate an exception report log based on the test results and write it to the attribute table text (plist).

[0220] It should be noted that, in the embodiments of this application, a sending end (target application) can be constructed on the test terminal (such as PC, mobile terminal, server, etc.) through a progressive framework, so that the target application includes a visual interface or user interface. When it is necessary to send test instructions to the application under test, the data to be processed is transmitted to the client, i.e. the application under test, by scanning the port number of the application service environment (Phonesever). This process is implemented by calling the interface script.

[0221] In addition, the client (the application to be tested) includes a receiving module, which can specifically include an application service environment (Phonesever), a data analysis module (DataParse), and a hook function module (hook). It should be noted that the client holds these three modules by creating a user framework (PlayerConfiguration) class. The data analysis module (DataParse) acts as a bridge between the application service environment (Phonesever) and the hook function module (hook). When data to be processed is sent from the sender, it is received by the application service environment (Phonesever), passed to the data analysis module (DataParse) for parsing into instructions and parameters, and finally passed to the hook function module (hook) for functional execution.

[0222] The embodiments of this application eliminate the need for manual clicking on the player entry point, improving the efficiency of the development and testing process; in addition, it can simulate various user behaviors while watching videos, enabling the automation of some test cases.

[0223] As can be seen from the above, the embodiments of this application can receive data to be processed sent by the target application through a visual interface based on a preset application service environment; convert the data to be processed into a parameter set based on a preset data model object; determine the component to be tested, the corresponding data to be loaded, and the execution command corresponding to the component to be tested from a preset test command set based on the parameter set; update the running task of the component to be tested according to the data to be loaded; and test the component to be tested according to the execution command and the running task to obtain the test result. Therefore, the embodiments of this application, by receiving data to be processed sent by the target application, determining the component to be tested, the execution command, and the data to be loaded according to the data model object corresponding to the data to be processed, and then testing the component to be tested that loads the data according to the execution command, simulate the scenario of data loading in the application, and perform testing based on the simulated scenario, without requiring manual operation of the application, thus improving the efficiency of application development or testing.

[0224] To better implement the above methods, this application embodiment also provides an application testing device, which can be integrated into network devices, such as servers or terminals. The terminal may include tablet computers, laptop computers, and / or personal computers.

[0225] For example, such as Figure 6 As shown, the application testing device may include a receiving unit 601, a conversion unit 602, a determining unit 603, an updating unit 604, and a testing unit 605.

[0226] The receiving unit 601 is used to receive data to be processed sent by the target application through a visual interface based on a preset application service environment.

[0227] The conversion unit 602 is used to convert the data to be processed into a parameter set based on a preset data model object;

[0228] The determining unit 603 is used to determine the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from the preset test command set based on the parameter set.

[0229] Update unit 604 is used to update the running task of the component under test according to the data to be loaded;

[0230] Test unit 605 is used to test the component to be tested according to the command to be executed and the task to be run, and to obtain the test results.

[0231] In some embodiments, the receiving unit 601 is further configured to: obtain memory address information corresponding to the application service environment; update the memory address information to the sub-thread socket to obtain the updated sub-thread socket; and run the updated sub-thread socket through a preset thread creation function to obtain the preset application service environment.

[0232] In some embodiments, the receiving unit 601 is further configured to: generate a running subtask based on the updated sub-thread socket, and add the running subtask to the asynchronous execution queue; based on the asynchronous execution queue, run the updated sub-thread socket through a preset thread creation function to obtain a preset application service environment.

[0233] In some embodiments, the conversion unit 602 is further configured to: parse the data to be processed to obtain a command identifier, information of the component to be tested, and data to be loaded; and convert the command identifier, information of the component to be tested, and data to be loaded into a parameter set corresponding to the data to be processed based on a preset data model object.

[0234] In some embodiments, the determining unit 603 is further configured to: obtain a command identifier from a parameter set; and match the command to be executed corresponding to the command identifier from a preset test command set, wherein the command to be executed is obtained by marking the initial execution command of the component to be tested using a preset command marking rule.

[0235] In some embodiments, the determining unit 603 is further configured to: obtain information about the component to be tested from the parameter set; and determine the corresponding component to be tested based on the information about the component to be tested.

[0236] In some embodiments, the update unit 604 is further configured to: detect the running status of the component under test; when the running status of the component under test is detected to be a data loading status, obtain the task queue of the component under test; and update the running tasks in the task queue according to the data to be loaded.

[0237] In some embodiments, the update unit 604 is further configured to: start the component under test when the running state of the component under test is detected to be closed; and update the running task of the started component under test according to the data to be loaded.

[0238] In some embodiments, the test unit 605 is further configured to: obtain the execution function corresponding to the command to be executed; execute the command to be executed through the execution function to obtain the target test instruction; control the component to be tested to process the execution task according to the target test instruction to obtain the test result.

[0239] In some embodiments, the application testing apparatus further includes a detection unit, configured to: when the test result contains multiple running records corresponding to a command to be executed, obtain the running time corresponding to each running record from the test result; determine two running records with adjacent running times among the multiple running records as a running record pair, and obtain the running time difference of the running record pair; when the running time difference of the running record pair is detected to be less than a preset running time difference threshold, update the multiple running records of the command to be executed and the running time corresponding to each running record to the attribute table file.

[0240] As can be seen from the above, the embodiments of this application can receive data to be processed sent by the target application through a visual interface based on a preset application service environment by receiving unit 601; convert the data to be processed into a parameter set based on a preset data model object by conversion unit 602; determine the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from a preset test command set by determining the parameter set by determining unit 603; update the running task of the component to be tested according to the data to be loaded by updating unit 604; and test the component to be tested according to the command to be executed and the running task by testing unit 605 to obtain the test result. Therefore, the embodiments of this application, by receiving data to be processed sent by the target application, determining the component to be tested, the command to be executed, and the data to be loaded according to the data model object corresponding to the data to be processed, and then testing the component to be tested that loads the data according to the command to be executed, simulates the scenario of loading data in the application, and tests based on the simulated scenario, without requiring manual operation of the application, thus improving the efficiency of application development or testing.

[0241] This application also provides a computer device, such as... Figure 7As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically:

[0242] The computer device may include components such as a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will understand that... Figure 7 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0243] The processor 701 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 702, and by calling data stored in the memory 702, it performs various functions of the computer device and processes data, thereby performing overall detection of the computer device. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 701.

[0244] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.

[0245] The computer device also includes a power supply 703 that supplies power to the various components. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 703 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0246] The computer device may also include an input unit 704, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0247] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in the embodiments of this application, the processor 701 in the computer device loads the executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 runs the application programs stored in the memory 702 to realize various functions, as follows:

[0248] Based on a preset application service environment, the system receives data to be processed sent by the target application through a visual interface; based on a preset data model object, it converts the data to be processed into a parameter set; based on the parameter set, it determines the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from a preset test command set; it updates the running task of the component to be tested according to the data to be loaded; and it tests the component to be tested according to the command to be executed and the running task to obtain the test results.

[0249] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0250] As can be seen from the above, the embodiments of this application can receive data to be processed sent by the target application through a visual interface based on a preset application service environment; convert the data to be processed into a parameter set based on a preset data model object; determine the component to be tested, the corresponding data to be loaded, and the execution command corresponding to the component to be tested from a preset test command set based on the parameter set; update the running task of the component to be tested according to the data to be loaded; and test the component to be tested according to the execution command and the running task to obtain the test result. Therefore, the embodiments of this application, by receiving data to be processed sent by the target application, determining the component to be tested, the execution command, and the data to be loaded according to the data model object corresponding to the data to be processed, and then testing the component to be tested that loads the data according to the execution command, simulate the scenario of data loading in the application, and perform testing based on the simulated scenario, without requiring manual operation of the application, thus improving the efficiency of application development or testing.

[0251] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0252] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the application testing methods provided in embodiments of this application. For example, the instructions can execute the following steps:

[0253] Based on a preset application service environment, the system receives data to be processed sent by the target application through a visual interface; based on a preset data model object, it converts the data to be processed into a parameter set; based on the parameter set, it determines the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from a preset test command set; it updates the running task of the component to be tested according to the data to be loaded; and it tests the component to be tested according to the command to be executed and the running task to obtain the test results.

[0254] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0255] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0256] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the application testing methods provided in the embodiments of this application, the beneficial effects that any of the application testing methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0257] The above provides a detailed description of an application testing method, apparatus, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An application testing method, characterized in that, include: Obtain the memory address information corresponding to the application service environment; The memory address information is updated to the child thread socket to obtain the updated child thread socket; The updated child thread socket is run by a preset thread creation function to obtain a preset application service environment; Based on a preset application service environment, it receives data to be processed sent by the target application through a visual interface; Based on a preset data model object, the data to be processed is converted into a parameter set. The data model object is a model object that converts different types of data into data that the application can recognize. Based on the parameter set, the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested are determined from the preset test command set; Update the running task of the component to be tested according to the data to be loaded; The component to be tested is tested according to the command to be executed and the task to be run, and the test results are obtained.

2. The method according to claim 1, characterized in that, The process, based on a preset data model object, converts the data to be processed into a parameter set, including: The data to be processed is parsed to obtain the command identifier, the information of the component to be tested, and the data to be loaded; Based on a preset data model object, the command identifier, the information of the component to be tested, and the data to be loaded are converted into a parameter set corresponding to the data to be processed.

3. The method according to claim 1, characterized in that, The step of determining the command to be executed corresponding to the component to be tested from the preset test command set includes: Obtain the command identifier from the parameter set; The command to be executed is matched with the command identifier from the preset set of test commands. The command to be executed is obtained by marking the initial execution command of the component to be tested according to the preset command marking rules.

4. The method according to claim 1, characterized in that, The step of updating the running task of the component under test according to the data to be loaded includes: Detect the operating status of the component under test; When the running state of the component under test is detected to be in the data loading state, the task queue of the component under test is obtained; Update the running tasks in the task queue according to the data to be loaded.

5. The method according to claim 4, characterized in that, Also includes: When the running status of the component under test is detected to be off, the component under test is started. Update the running tasks of the component to be tested after startup based on the data to be loaded.

6. The method according to claim 1, characterized in that, The step of testing the component under test according to the command to be executed and the task to be run, and obtaining the test results, includes: Obtain the execution function corresponding to the command to be executed; The execution function runs the command to be executed, and the target test instruction is obtained; The test component is controlled to process the running task according to the target test instruction, and the test result is obtained.

7. The method according to claim 1, characterized in that, After testing the component under test according to the command to be executed and the task to be run, and obtaining the test results, the method further includes: When the test result is detected to contain multiple running records corresponding to the command to be executed, the running time corresponding to each running record is obtained from the test result; Two running records with adjacent running times among the multiple running records are identified as running record pairs, and the running time difference of the running record pairs is obtained; When the time difference between the running record pairs is detected to be less than a preset time difference threshold, the multiple running records of the command to be executed and the running time corresponding to each running record are updated to the attribute table file.

8. An application testing device, characterized in that, include: The receiving unit is used to obtain the memory address information corresponding to the application service environment. The memory address information is updated to the child thread socket to obtain the updated child thread socket; The updated sub-thread socket is run by a preset thread creation function to obtain a preset application service environment; based on the preset application service environment, data to be processed sent by the target application through a visual interface is received. The conversion unit is used to convert the data to be processed into a parameter set based on a preset data model object. The data model object is a model object for converting different types of data into data that the application can recognize. The determining unit is used to determine the component to be tested, the corresponding data to be loaded, and the command to be executed corresponding to the component to be tested from the preset test command set based on the parameter set. An update unit is used to update the running task of the component to be tested according to the data to be loaded; The testing unit is used to test the component to be tested according to the command to be executed and the task to be run, and to obtain the test results.

9. The apparatus according to claim 8, characterized in that, The conversion unit is further configured to: The data to be processed is parsed to obtain the command identifier, the information of the component to be tested, and the data to be loaded; Based on a preset data model object, the command identifier, the information of the component to be tested, and the data to be loaded are converted into a parameter set corresponding to the data to be processed.

10. The apparatus according to claim 8, characterized in that, The determining unit is further configured to: Obtain the command identifier from the parameter set; The command to be executed is matched with the command identifier from the preset set of test commands. The command to be executed is obtained by marking the initial execution command of the component to be tested according to the preset command marking rules.

11. The apparatus according to claim 8, characterized in that, The update unit is further configured to: Detect the operating status of the component under test; When the running state of the component under test is detected to be in the data loading state, the task queue of the component under test is obtained; Update the running tasks in the task queue according to the data to be loaded.

12. The apparatus according to claim 11, characterized in that, The update unit is further configured to: When the running status of the component under test is detected to be off, the component under test is started. Update the running tasks of the component to be tested after startup based on the data to be loaded.

13. The apparatus according to claim 8, characterized in that, The test unit is also used for: Obtain the execution function corresponding to the command to be executed; The execution function runs the command to be executed, and the target test instruction is obtained; The test component is controlled to process the running task according to the target test instruction, and the test result is obtained.

14. The apparatus according to claim 8, characterized in that, The application testing device further includes a detection unit for: When the test result is detected to contain multiple running records corresponding to the command to be executed, the running time corresponding to each running record is obtained from the test result; Two running records with adjacent running times among the multiple running records are identified as running record pairs, and the running time difference of the running record pairs is obtained; When the time difference between the running record pairs is detected to be less than a preset time difference threshold, the multiple running records of the command to be executed and the running time corresponding to each running record are updated to the attribute table file.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium is computer-readable and stores a plurality of instructions adapted for loading by a processor to perform the steps of the application testing method according to any one of claims 1 to 7.

16. A computer device, characterized in that, It includes a processor and a memory, the memory storing an application program, and the processor running the application program in the memory to implement the steps of the application testing method according to any one of claims 1 to 7.

17. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; the processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the application testing method according to any one of claims 1 to 7.