Function test method, computer equipment, storage medium and program product

By dynamically adjusting the occupation of hardware resources in functional tests and adjusting the pressure test resources according to the pressure difference value, the system crash caused by changes in hardware resource pressure is solved, and the stability of the functional test environment and the accuracy of the test results are improved.

CN119645787APending Publication Date: 2025-03-18XIAN YIPU COMM TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411666205.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

When conducting front-end functional testing, the pressure of hardware resources changes in the system cause the system to crash, and the stability of the functional testing environment is poor.

Method used

By obtaining the occupancy data of hardware resources during the stress test, calculating the pressure difference value, and adjusting the hardware resources occupied by the stress test based on this value, to dynamically adjust the occupancy of hardware resources to make it meet the expected occupancy.

Benefits of technology

During the functional testing process, the hardware resource usage always meets expectations, improving the stability of the functional testing environment and the accuracy of the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645787A_ABST
    Figure CN119645787A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a function test method, computer equipment, a storage medium and a program product. The method comprises the following steps: under the condition of performing a pressure test, executing a function test instruction, and acquiring occupation data of hardware resources in the process of executing the function test instruction; determining a pressure difference value according to the occupation data and preset pressure data; and under the condition that the pressure difference value does not meet the pressure condition of the function test, adjusting hardware resources occupied by the pressure test according to the pressure difference value. The method is used for achieving the effect of improving the stability of the function test environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] When testing a front-end function, you need to run the front-end function and determine whether it can work as expected through response and display. Different front-end functions may occupy different hardware resources, which may cause significant changes in the pressure environment of hardware resources. When some front-end functions occupy a large amount of hardware resources, the system may crash, resulting in poor stability of the functional testing environment. Summary of the invention

[0003] The embodiments of the present application provide a functional testing method, a computer device, a storage medium, and a program product to achieve the effect of improving the stability of a functional testing environment.

[0004] In a first aspect, an embodiment of the present application provides a functional testing method, comprising: executing functional testing instructions when performing a stress test, and obtaining hardware resource occupancy data during the execution of the functional testing instructions; determining a pressure difference value based on the occupancy data and preset pressure data; and when the pressure difference value does not meet the pressure conditions of the functional test, adjusting the hardware resources occupied by the stress test based on the pressure difference value.

[0005] In some embodiments, the hardware resources occupied by the stress test are adjusted according to the pressure difference value, including: when the pressure difference value meets the boost condition, adding a first process according to the pressure difference value, and executing the newly added stress test instructions through the first process; when the pressure difference value meets the depressurization condition, selecting a second process from the processes in the execution state, and terminating the second process.

[0006] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; adding a first process based on the pressure difference value, and executing newly added stress test instructions through the first process, including: determining a first quantity based on the processor difference value, and adding a first number of first processes; determining the memory capacity corresponding to each first process based on the memory difference value and the first quantity; obtaining a first number of newly added stress test instructions; and executing the first number of newly added stress test instructions respectively through the first number of first processes.

[0007] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; selecting a second process from the processes in the execution state includes: when the processor difference value and the memory difference value are negative, determining a second number based on the processor difference value; selecting a second number of second processes from the processes in the execution state based on the memory difference value; the total memory usage of the second number of second processes is greater than the absolute value of the memory difference value.

[0008] In some embodiments, terminating the second process includes: when the number of second processes is at least two, determining the priority of at least two second processes according to the memory usage of the at least two second processes; the memory usage of the second process is negatively correlated with the priority; and terminating the at least two second processes in sequence according to the priority.

[0009] In some embodiments, the occupancy data includes processor occupancy data and memory occupancy data, and the preset pressure data includes a first preset occupancy interval of the processor and a second preset occupancy interval of the memory; determining the pressure difference value based on the occupancy data and the preset pressure data includes: determining the processor difference value based on the processor occupancy data and the first preset occupancy interval; determining the memory difference value based on the memory occupancy data and the second preset occupancy interval; the pressure difference value includes the processor difference value and the memory difference value.

[0010] In a second aspect, an embodiment of the present application provides a functional testing device, comprising:

[0011] An acquisition module is used to execute the functional test instructions when performing stress testing, and to obtain the occupation data of the hardware resources during the execution of the functional test instructions;

[0012] a difference determination module, for determining a pressure difference value based on the occupancy data and the preset pressure data;

[0013] The pressure adjustment module is used to adjust the hardware resources occupied by the pressure test according to the pressure difference value when the pressure difference value does not meet the pressure condition of the functional test.

[0014] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory, a processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the first aspect above and / or various possible implementations of the first aspect.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0017] The functional testing method, computer device, storage medium and program product provided in the embodiments of the present application execute functional testing instructions when performing stress testing, so that functional testing is performed when the computer device is running in a stress environment. During the functional testing, the pressure difference value is determined based on the real-time occupancy data of the hardware resources and the preset pressure data. When the pressure difference value does not meet the stress conditions of the functional test, the hardware resources occupied by the stress test are adjusted. In this way, during the functional testing, the stress test can be dynamically adjusted based on the real-time occupancy of the hardware resources, so that during the functional testing, the occupancy of the hardware resources always meets the expected occupancy, so that the functional test is completed under the expected stress environment, thereby improving the stability of the functional testing environment and the accuracy of the functional testing results obtained in this environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0019] Figure 1 A schematic diagram of a scenario for the functional testing method provided in this application;

[0020] Figure 2 Schematic diagram of the functional testing method provided in this application Figure 1 ;

[0021] Figure 3 Schematic diagram of the functional testing method provided in this application Figure 2 ;

[0022] Figure 4 A schematic diagram of the structure of the functional testing device provided in this application;

[0023] Figure 5 A schematic diagram of the structure of the computer device provided for this application.

[0024] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0025] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0026] In combination with the above scenario, it can be seen that in the prior art, when testing the front-end function, it is necessary to run the front-end function and determine whether the front-end function can work as expected through the response situation and the display screen; different front-end functions may have different occupancy of hardware resources, which may cause large changes in the pressure environment of hardware resources. Even when some front-end functions occupy a large amount of hardware resources, the system may crash, resulting in poor stability of the functional testing environment.

[0027] The functional testing method provided in the present application obtains the occupancy data of the hardware resources in the process of the functional testing instructions, and adjusts the hardware resources occupied by the stress test according to the pressure difference value between the occupancy data and the preset pressure data. In the process of the functional testing, the hardware resources occupied by the stress test can be dynamically adjusted according to the actual situation of the occupied hardware resources, so that during the functional testing process, the hardware occupancy of the system meets the expected pressure environment, thereby improving the stability of the functional testing environment.

[0028] The functional testing method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.

[0029] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0030] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0031] Figure 2 The functional testing method provided in the application can be applied to computer equipment, which can be Figure 1 Terminal or server in Figure 2 As shown, the method includes:

[0032] S201. When performing a stress test, execute a functional test instruction, and obtain hardware resource occupancy data during the execution of the functional test instruction.

[0033] Among them, stress testing refers to executing stress testing instructions through computer equipment and detecting the performance of computer equipment during the test; in actual applications, user requests can be processed and data processing can be performed by executing stress testing instructions; stress testing allows computer equipment to operate in a stress environment.

[0034] Functional testing refers to testing the functions of the foreground (or front end); in actual applications, when a user uses a certain function, the background of the computer device may be processing other data. In order to make the functional test consistent with the actual application scenario, during the functional test, the functional test can be performed when the computer device is in a stress environment.

[0035] Hardware resources include but are not limited to processor resources and memory resources; the hardware resource occupancy data can reflect the occupancy of processor resources and the occupancy of memory resources, including but not limited to processor occupancy rate, memory occupancy rate, and disk bandwidth occupancy rate.

[0036] Specifically, the computer device obtains and executes stress test instructions. Executing the stress test instructions will occupy the hardware resources of the computer device, putting the computer device in a stress environment. When the computer device executes the stress test instructions, it obtains and executes functional test instructions to perform functional testing. During the functional testing process, the current occupancy data of the hardware resources is obtained in real time.

[0037] S202: Determine a pressure difference value according to the occupancy data and the preset pressure data.

[0038] Among them, the occupancy data can reflect the actual occupancy of hardware resources when performing stress testing and functional testing, and the preset stress data reflects the expected occupancy of hardware resources when performing stress testing and functional testing.

[0039] For example, if a user wishes to test the execution of front-end functions under a stress environment where the hardware resources are at 70%, then when the computer device performs stress testing and functional testing, the expected hardware resource occupancy data is 70% of the hardware resources.

[0040] Among them, the pressure difference value may indicate that the current hardware resource occupancy is lower than the expected occupancy, or it may indicate that the current hardware resource occupancy is higher than the expected occupancy; in actual applications, the pressure difference value may be a negative number, in which case the current hardware resource occupancy is higher than the expected occupancy, and the pressure difference value may also be a positive number, in which case the current hardware resource occupancy is lower than the expected occupancy; of course, the pressure difference value may also be 0, in which case the current hardware resource occupancy is in line with the expected occupancy.

[0041] Specifically, when the computer device performs a stress test, it also performs a functional test. The actual occupancy data corresponding to the stress test and the functional test may be higher than the preset pressure data, or lower than the preset pressure data, or may fall within the range of the preset pressure data. The computer device obtains a pressure difference value based on the difference between the occupancy data and the preset pressure data.

[0042] In one possible manner, the occupancy data includes a processor occupancy rate, and the preset pressure data includes a preset processor occupancy rate; the pressure difference value is equal to a difference between the preset processor occupancy rate and the processor occupancy rate.

[0043] In one possible manner, the occupancy data includes a memory occupancy rate, the preset pressure data includes a preset memory occupancy rate, and the pressure difference value is equal to a difference between the preset memory occupancy rate and the memory occupancy rate.

[0044] In a possible manner, the occupancy data includes a processor occupancy rate and a memory occupancy rate, and accordingly, the pressure difference value includes a difference between a preset processor occupancy rate and a processor occupancy rate and a difference between a preset processor occupancy rate and a processor occupancy rate.

[0045] S203: When the pressure difference value does not satisfy the pressure condition of the functional test, adjust the hardware resources occupied by the pressure test according to the pressure difference value.

[0046] Among them, the pressure difference value does not meet the pressure condition of the functional test, which means that the pressure difference value indicates that the current hardware resource occupancy is higher or lower than the expected occupancy; that is, when the pressure difference value indicates that the current hardware resource occupancy is consistent with the expected occupancy, the pressure difference value meets the pressure condition of the functional test.

[0047] To adjust the hardware resources occupied by the stress test, you can increase the stress test to increase the hardware resources occupied by the stress test, or reduce the stress test to reduce the hardware resources occupied by the stress test.

[0048] Specifically, the computer device determines whether the pressure difference value belongs to a preset difference range. If the pressure difference value belongs to the preset difference range, it means that the pressure difference value meets the pressure condition of the functional test. If the pressure difference value does not belong to the preset difference range, it means that the pressure difference value does not meet the pressure condition of the functional test.

[0049] When the pressure difference value does not meet the pressure condition of the functional test, the computer device determines whether the pressure difference value is a positive number. If the pressure difference value is a positive number, the pressure test is increased to increase the hardware resources occupied by the pressure test so that the overall occupancy of the hardware resources meets the expected occupancy; if the pressure difference value is a negative number, the pressure test is reduced to reduce the hardware resources occupied by the pressure test so that the overall occupancy of the hardware resources meets the expected occupancy.

[0050] It should be noted that after adjusting the hardware resources occupied by the stress test, return to continue executing S201 until the functional test is completed. That is, during the functional test, the stress test is adjusted in real time according to the occupancy of the hardware resources. The occupancy of the hardware resources is adjusted in real time, so that during the functional test, the occupancy of the hardware resources is always consistent with the expected occupancy, so as to complete the functional test under the expected stress environment.

[0051] In the above-mentioned functional testing method, functional testing instructions are executed when performing stress testing, so that functional testing is performed when the computer device is running in a stress environment. During the functional testing, the pressure difference value is determined based on the real-time occupancy data of the hardware resources and the preset pressure data. When the pressure difference value does not meet the stress conditions of the functional test, the hardware resources occupied by the stress test are adjusted. In this way, during the functional testing, the stress test can be dynamically adjusted based on the real-time occupancy of the hardware resources, so that during the functional testing, the occupancy of the hardware resources always meets the expected occupancy, so that the functional test can be completed under the expected stress environment, thereby improving the stability of the functional testing environment and the accuracy of the functional testing results obtained in this environment.

[0052] In some embodiments, the occupancy data includes processor occupancy data and memory occupancy data, and the preset pressure data includes a first preset occupancy interval of the processor and a second preset occupancy interval of the memory; determining the pressure difference value based on the occupancy data and the preset pressure data includes: determining the processor difference value based on the processor occupancy data and the first preset occupancy interval; determining the memory difference value based on the memory occupancy data and the second preset occupancy interval; the pressure difference value includes the processor difference value and the memory difference value.

[0053] The first preset occupancy interval may be a preset interval of the number of core occupancy of the processor; and the second preset occupancy interval may be a preset interval of the occupancy of the memory.

[0054] Specifically, when the processor occupancy data is the number of core occupancy of the processor, it is determined whether the core occupancy number belongs to a first preset occupancy interval (the preset interval of the core occupancy number of the processor). When the core occupancy number belongs to the first preset occupancy interval, the processor difference value is determined to be 0. When the core occupancy number of the processor does not belong to the first preset occupancy interval, a first intermediate value can be obtained in the first preset occupancy interval, and the difference between the first intermediate value and the core occupancy number is calculated to obtain the processor difference value; wherein, the first intermediate value is the expected core occupancy number, which can be an intermediate value of the first preset occupancy interval.

[0055] When the processor occupancy data is a processor occupancy rate, the number of core occupancy of the processor is calculated according to the product of the processor occupancy rate and the total number of cores of the processor.

[0056] Exemplarily, the processor occupancy data is the processor occupancy rate cpu_prec, the core occupancy number of the processor is cpu_prec*cpu_core, where cpu_core is the total number of cores of the processor; the first intermediate value is cpu_threshold, and the processor difference value is cpu_core*(cpu_threshold-cpu_prec), and the processor difference value can be recorded as cpu_diff.

[0057] When the memory occupancy data is the memory occupancy, determine whether the memory occupancy belongs to a second preset occupancy interval (a preset interval of memory occupancy); if the memory occupancy belongs to the second preset occupancy interval, determine that the memory difference value is 0; if the memory occupancy does not belong to the second preset occupancy interval, obtain a second intermediate value in the second preset occupancy interval, calculate the difference between the second intermediate value and the memory occupancy, and obtain the memory difference value; wherein, the second intermediate value is the expected memory occupancy, which may be an intermediate value of the second preset occupancy interval.

[0058] When the memory usage data is the memory usage rate, the memory usage is calculated according to the total memory amount and the memory usage rate.

[0059] Exemplarily, the memory usage data is the memory usage rate mem_tprec, the memory usage is mem_prec* mem_core, where mem_total is the total memory; the second intermediate value is mem_threshold, the memory difference value is mem_total*(mem_threshold-mem_prec), and the memory difference value can be recorded as mem_diff.

[0060] It should be noted that when the processor difference value and the memory difference value are both 0, it means that the pressure difference value meets the pressure conditions of the functional test. When the processor difference value is not 0 and / or the memory difference value is not 0, it means that the pressure difference value does not meet the pressure conditions of the functional test.

[0061] In the above embodiment, the processor difference value and the memory difference value are determined based on the processor occupancy data and the memory occupancy data, and the occupancy differences of the processor and the memory are comprehensively considered to reflect the pressure difference value, thereby improving the accuracy of the difference between the determined occupancy of hardware resources and the expected occupancy.

[0062] In some embodiments, the hardware resources occupied by the stress test are adjusted according to the pressure difference value, including: when the pressure difference value meets the boost condition, adding a first process according to the pressure difference value, and executing the newly added stress test instructions through the first process; when the pressure difference value meets the depressurization condition, selecting a second process from the processes in the execution state, and terminating the second process.

[0063] Among them, the pressure difference value meets the pressure increase condition, which can be a positive number; the pressure difference value meets the pressure reduction condition, which can be a negative number; the newly added stress test instruction is a newly added stress test instruction; the process in execution state is the process that is executing the stress test instruction; terminating the second process can reduce the executed stress test instructions, thereby reducing the stress environment of the hardware resources.

[0064] Specifically, when the pressure difference value is equal to the preset pressure data minus the occupancy data, if the pressure difference value is a positive number, it is determined that the pressure difference value meets the pressure increase condition; if the pressure difference value is a negative number, it is determined that the pressure difference value meets the pressure reduction condition.

[0065] In an optional manner, the pressure difference value includes a processor difference value. When the processor difference value is a positive number, it indicates that the pressure difference value satisfies a pressure increase condition; when the processor difference value is a negative number, it indicates that the pressure difference value satisfies a pressure reduction condition.

[0066] In an optional manner, the pressure difference value includes a memory difference value. When the memory difference value is a positive number, it indicates that the pressure difference value satisfies a pressure increase condition; when the memory difference value is a negative number, it indicates that the pressure difference value satisfies a pressure reduction condition.

[0067] In an optional manner, the pressure difference value includes a processor difference value and a memory difference value. When the processor difference value and the memory difference value are both positive, it indicates that the pressure difference value meets the pressure increase condition; when the processor difference value and / or the memory difference value are negative, it indicates that the pressure difference value meets the pressure reduction condition.

[0068] Exemplarily, when cpu_diff>0 and mem_diff>0, the pressure difference value satisfies the pressure increase condition; when cpu_diff<0 and / or mem_diff<0, it indicates that the pressure reduction condition is met.

[0069] In the above embodiment, it is determined whether the pressure increase condition or the pressure reduction condition is met based on the pressure difference value, and a new pressure test instruction is executed respectively, or the operation of the second process is terminated to adjust the occupancy of hardware resources. In this way, during the functional test, the occupancy of hardware resources always meets the expected occupancy, so that the functional test can be completed under the expected pressure environment, thereby improving the stability of the functional test environment and the accuracy of the functional test results obtained in this environment.

[0070] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; adding a first process based on the pressure difference value, and executing newly added stress test instructions through the first process, including: determining a first quantity based on the processor difference value, and adding a first number of first processes; determining the memory capacity corresponding to each first process based on the memory difference value and the first quantity; obtaining a first number of newly added stress test instructions; and executing the first number of newly added stress test instructions respectively through the first number of first processes.

[0071] Among them, the processor difference value is the difference value of the processor cores, and the memory difference value is the difference value of the memory usage; the first process is a newly added process, and the memory capacity corresponding to the first process is the memory capacity occupied by the first process; each process occupies a processor core, and adding processes can occupy more processor cores.

[0072] Specifically, when the processor difference value is a positive number and the memory difference value is a positive number, the pressure difference value meets the boost condition, and the computer device takes the processor difference value as the first quantity, calculates the ratio between the memory difference value and the first quantity, and obtains the memory capacity of each first process; obtains a first number of newly added stress test instructions, and sets each first process to execute the newly added stress test instructions while occupying the corresponding memory capacity.

[0073] Exemplarily, cpu_diff=2, mem_diff=100M, the pressure difference value meets the boost condition, and the computer device can use the processor difference value (cpu_diff) as the first number, that is, the first number is 2, that is, 2 first processes are added, each first process occupies 50M; obtain 2 new stress test instructions, and execute the 2 new stress test instructions respectively through the 2 first processes that occupy 50M respectively.

[0074] In the above embodiment, when the boost conditions are met, the number of newly added first processes is determined based on the memory difference value and the processor difference value, and the amount of memory occupied by the first process is set. The newly added stress test instructions are executed through the newly added first process to increase the occupancy of hardware resources, so that the operating pressure of the hardware resources is increased to the pressure environment required for functional testing, thereby improving the stability of the functional testing environment.

[0075] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; selecting a second process from the processes in the execution state includes: when the processor difference value and the memory difference value are negative, determining a second number based on the processor difference value; selecting a second number of second processes from the processes in the execution state based on the memory difference value; the total memory usage of the second number of second processes is greater than the absolute value of the memory difference value.

[0076] The total memory usage of the second process is the sum of the memory usage of the second process.

[0077] Specifically, when the processor difference value is a negative number and the memory difference value is a negative number, the pressure difference value meets the pressure reduction condition. The absolute value of the processor difference value can be used as the second number, and a second number of second processes are selected from the processes in the execution state, so that the sum of the memory usage of the second number of second processes is greater than the absolute value of the memory difference value.

[0078] Exemplarily, cpu_diff=-2, mem_diff=-50M, the pressure difference value meets the pressure reduction condition, and the computer device can use the absolute value of the processor difference value (cpu_diff) as the second number, that is, the second number is 2, and select 2 second processes from the processes in the execution state. The sum of the memory usage of the selected 2 second processes is greater than 50M, and the selected 2 second processes are terminated.

[0079] In an optional manner, when the processor difference value is a negative number and the memory difference value is a positive number, the pressure difference value satisfies the pressure reduction condition, and the absolute value of the processor difference value can be used as the second quantity, and a second number of second processes are selected from the processes in the execution state. The second number of second processes selected are the processes with the smallest memory usage among the processes in the execution state.

[0080] In an optional manner, when the processor difference value is a positive number and the memory difference value is a negative number, the pressure difference value satisfies the pressure reduction condition, and a second process is selected from the processes in the execution state. The selected second process is the process with the largest memory occupancy among the processes in the execution state.

[0081] In the above embodiment, when the pressure reduction condition is met, the number of second processes that need to be terminated and the total memory occupancy of the second processes are determined based on the memory difference value and the processor difference value. By terminating the second process, the occupancy of hardware resources is reduced, so that the operating pressure of the hardware resources is increased to the pressure environment required for functional testing, thereby improving the stability of the functional testing environment.

[0082] In some embodiments, terminating the second process includes: when the number of second processes is at least two, determining the priority of at least two second processes according to the memory usage of the at least two second processes; the memory usage of the second process is negatively correlated with the priority; and terminating the at least two second processes in sequence according to the priority.

[0083] The memory usage of the second process is negatively correlated with the priority, that is, the larger the memory usage, the lower the priority, and the smaller the memory usage, the higher the priority.

[0084] Specifically, after selecting at least two second processes, the priority of removing at least two second processes is determined according to the memory usage of the at least two second processes, that is, the second process with a smaller memory usage is removed first, and then the second process with a larger memory usage is removed; this allows the occupancy of hardware resources to be adjusted more smoothly, avoiding large fluctuations in the occupancy of hardware resources and ensuring the stability of the functional testing environment.

[0085] Exemplarily, there are three second processes, namely L1, L2 and L3; among them, the memory usage of L1 is 40M, the memory usage of L2 is 20M, and the memory usage of L3 is 50M; and the priorities of the three second processes are: L2 has the highest priority, L1 has the second priority, and L3 has the lowest priority. When terminating the second process, L2 is terminated first, then L1, and finally L3.

[0086] In the above embodiment, the priority of terminating the second process is determined according to the memory usage of the second process, that is, the second process with a smaller memory usage is removed first, and then the second process with a larger memory usage is removed; this allows the hardware resource usage to be adjusted more smoothly, avoiding large fluctuations in the hardware resource usage and ensuring the stability of the functional testing environment.

[0087] In some embodiments, Figure 3 As shown in the figure, the functional testing method is applied to the scenario of testing the front-end functions of the application, including:

[0088] Obtain preset pressure data corresponding to the expected pressure environment of the functional test, and perform pressure testing according to the preset pressure data; obtain a front-end function set to be tested, the front-end function set including multiple front-end functions; traverse the front-end function set to obtain the front-end function currently being tested; perform functional testing on the current front-end function, obtain hardware resource occupancy data during the test, and determine processor difference values ​​and memory difference values ​​based on the occupancy data and the preset pressure data.

[0089] When the processor difference value and the memory difference value meet the boost condition, a first quantity is determined based on the processor difference value, a memory capacity corresponding to each first process is determined based on the memory difference value and the first quantity, a first number of first processes are added, and a first number of newly added stress test instructions are obtained; and the first number of newly added stress test instructions are respectively executed by the first number of first processes.

[0090] When the processor difference value and the memory difference value meet the voltage reduction condition, or when the processor difference value and the memory difference value are negative, determine the second number based on the processor difference value; and select a second number of second processes from the processes in the execution state based on the memory difference value, and terminate the second processes.

[0091] Determine whether the process of functional testing the current front-end function is completed. If not, continue to execute the step of obtaining the occupancy data of hardware resources during the test process. If it is completed, determine whether the test of each front-end function in the front-end function set is completed. If not, continue to traverse the front-end function set to obtain the step of the front-end function currently being tested. If it is completed, end the functional test.

[0092] In the above-mentioned functional testing method, functional testing instructions are executed when performing stress testing, so that functional testing is performed when the computer device is running in a stress environment. During the functional testing, the pressure difference value is determined based on the real-time occupancy data of the hardware resources and the preset pressure data. When the pressure difference value does not meet the stress conditions of the functional test, the hardware resources occupied by the stress test are adjusted. In this way, during the functional testing, the stress test can be dynamically adjusted based on the real-time occupancy of the hardware resources, so that during the functional testing, the occupancy of the hardware resources always meets the expected occupancy, so that the functional test can be completed under the expected stress environment, thereby improving the stability of the functional testing environment and the accuracy of the functional testing results obtained in this environment.

[0093] Figure 4 The structural diagram of the functional testing device provided in this application is as follows: Figure 4 As shown, the functional testing device 40 provided in this embodiment includes:

[0094] The acquisition module 401 is used to execute the function test instruction when performing the stress test, and obtain the occupation data of the hardware resources during the execution of the function test instruction;

[0095] A difference determination module 402, for determining a pressure difference value based on the occupancy data and the preset pressure data;

[0096] The pressure adjustment module 403 is used to adjust the hardware resources occupied by the pressure test according to the pressure difference value when the pressure difference value does not meet the pressure condition of the functional test.

[0097] In some embodiments, the pressure adjustment module 403 is used to add a first process based on the pressure difference value when the pressure difference value meets the boost condition, and execute the newly added pressure test instruction through the first process; when the pressure difference value meets the depressurization condition, select the second process from the processes in the execution state and terminate the second process.

[0098] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; the pressure adjustment module 403 is used to determine a first quantity based on the processor difference value, and add a first number of first processes; determine the memory capacity corresponding to each first process based on the memory difference value and the first quantity; obtain a first number of newly added stress test instructions; and execute the first number of newly added stress test instructions respectively through the first number of first processes.

[0099] In some embodiments, the pressure difference value includes a processor difference value and a memory difference value; the pressure adjustment module 403 is used to determine a second number based on the processor difference value when the processor difference value and the memory difference value are negative; based on the memory difference value, select a second number of second processes from the processes in the execution state; the total memory usage of the second number of second processes is greater than the absolute value of the memory difference value.

[0100] In some embodiments, the pressure adjustment module 403 is used to determine the priorities of at least two second processes according to the memory usage of the at least two second processes when the number of second processes is at least two; the memory usage of the second process is negatively correlated with the priority; and terminate the at least two second processes in sequence according to the priority.

[0101] In some embodiments, the occupancy data includes processor occupancy data and memory occupancy data, and the preset pressure data includes a first preset occupancy interval of the processor and a second preset occupancy interval of the memory; the difference determination module 402 is used to determine the processor difference value based on the processor occupancy data and the first preset occupancy interval; determine the memory difference value based on the memory occupancy data and the second preset occupancy interval; the pressure difference value includes the processor difference value and the memory difference value.

[0102] The functional testing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0103] Figure 5 This is a schematic diagram of the structure of the computer device provided in this application. Figure 5 As shown, the computer device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.

[0104] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0105] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0106] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.

[0107] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.

[0108] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0109] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0110] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0111] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0112] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0113] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0116] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0117] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0118] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A functional testing method, characterized in that: include: In the case of stress testing, executing functional test instructions, and obtaining hardware resource occupancy data during the execution of the functional test instructions; determining a pressure difference value based on the occupancy data and the preset pressure data; When the pressure difference value does not satisfy the pressure condition of the functional test, the hardware resources occupied by the pressure test are adjusted according to the pressure difference value.

2. The method according to claim 1, characterized in that The adjusting the hardware resources occupied by the stress test according to the stress difference value includes: When the pressure difference value satisfies the pressure boost condition, adding a first process according to the pressure difference value, and executing a newly added pressure test instruction through the first process; When the pressure difference value satisfies the pressure reduction condition, a second process is selected from the processes in the execution state, and the second process is terminated.

3. The method according to claim 2, characterized in that The pressure difference value includes a processor difference value and a memory difference value; The adding of a first process according to the pressure difference value and executing the newly added pressure test instruction through the first process includes: Determine a first number according to the processor difference value, and increase the first number of first processes; Determine a memory capacity corresponding to each of the first processes according to the memory difference value and the first quantity; Obtaining the first number of newly added stress test instructions; The first number of the newly added stress test instructions are respectively executed by the first number of the first processes while occupying corresponding memory capacity.

4. The method according to claim 2, characterized in that: The pressure difference value includes a processor difference value and a memory difference value; The selecting a second process from the processes in the execution state includes: In the case where the processor difference value and the memory difference value are negative numbers, determining a second quantity according to the processor difference value; According to the memory difference value, the second number of second processes are selected from the processes in the execution state; the total memory usage of the second number of second processes is greater than the absolute value of the memory difference value.

5. The method according to claim 2 or 4, characterized in that: The terminating the second process includes: When the number of the second processes is at least two, determining the priorities of the at least two second processes according to the memory usage of the at least two second processes; the memory usage of the second process is negatively correlated with the priority; At least two of the second processes are terminated in sequence according to the priority level.

6. The method according to any one of claims 1 to 4, characterized in that The occupancy data includes processor occupancy data and memory occupancy data, and the preset pressure data includes a first preset occupancy interval of the processor and a second preset occupancy interval of the memory; The determining of the pressure difference value according to the occupancy data and the preset pressure data comprises: Determining a processor difference value according to the processor occupancy data and the first preset occupancy interval; Determining a memory difference value according to the memory occupancy data and the second preset occupancy interval; The pressure difference value includes the processor difference value and the memory difference value.

7. A functional testing device, characterized in that: include: An acquisition module, used to execute a functional test instruction when performing a stress test, and to acquire hardware resource occupancy data during the execution of the functional test instruction; a difference determination module, configured to determine a pressure difference value based on the occupancy data and the preset pressure data; The pressure adjustment module is used to adjust the hardware resources occupied by the pressure test according to the pressure difference value when the pressure difference value does not meet the pressure condition of the functional test.

8. A computer device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Cited By

  • Data isolation automatic test method based on multi-mode mobile terminal

    CN121071900A

  • A multi-mode mobile terminal data isolation automatic testing method

    CN121071900B