CN116662200A - Test data generation method and device, electronic equipment and medium - Google Patents

Test data generation method and device, electronic equipment and medium Download PDF

Info

Publication number
CN116662200A
CN116662200A CN202310753542.5A CN202310753542A CN116662200A CN 116662200 A CN116662200 A CN 116662200A CN 202310753542 A CN202310753542 A CN 202310753542A CN 116662200 A CN116662200 A CN 116662200A
Authority
CN
China
Prior art keywords
input data
population
test
iteration
pressure test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310753542.5A
Other languages
Chinese (zh)
Inventor
董金松
李岩
田学明
田娇
张馨予
孟祥泰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FAW Group Corp
Original Assignee
FAW Group Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by FAW Group Corp filed Critical FAW Group Corp
Priority to CN202310753542.5A priority Critical patent/CN116662200A/en
Publication of CN116662200A publication Critical patent/CN116662200A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for generating test data. The method comprises the following steps: generating an initial population according to input domain information of a system to be tested, wherein the initial population comprises input data required by each application program in the system to be tested for pressure test; performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness; and under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process. According to the technical scheme provided by the embodiment of the application, high-load test input data can be automatically generated, the workload of manually constructing test cases is reduced, and the test efficiency is improved.

Description

Test data generation method and device, electronic equipment and medium
Technical Field
The present application relates to the field of pressure testing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating test data.
Background
Stress testing is one of the important means of assessing system stability and reliability. The purpose of stress testing is to find performance bottlenecks and potential failures of the system, so a large enough workload needs to be built to bring the system to a high occupancy state.
However, manually constructing high-load test cases requires a deep understanding of the system architecture and mechanisms, which requires a long time and high experience.
Most of the existing pressure test methods rely on manual work to design test cases, and it is difficult for a system to comprehensively evaluate the performance of the system in a limit state.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for generating test data, which are used for solving the problem that the performance of a system in a limit state cannot be comprehensively evaluated by manually designing a test case.
According to an aspect of the present application, there is provided a test data generation method, including: generating an initial population according to input domain information of a system to be tested, wherein the initial population comprises input data required by each application program in the system to be tested for pressure test;
performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness;
and under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process.
According to another aspect of the present application, there is provided a test data generating apparatus including:
the initial population generation module is used for generating an initial population according to the input domain information of the system to be tested, wherein the initial population comprises input data required by each application program in the system to be tested for pressure test;
the population iteration module is used for carrying out pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and carrying out population iteration according to the individual fitness;
and the test data determining module is used for determining the test data of the pressure test according to the input data corresponding to the pressure test result in the iteration process under the condition that the iteration ending condition is met.
According to another aspect of the present application, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of generating test data according to any one of the embodiments of the present application.
According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a method for generating test data according to any of the embodiments of the present application.
According to the technical scheme, an initial population is generated according to the input domain information of the system to be tested, wherein the initial population comprises input data required by pressure test of each application program in the system to be tested; performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness; and under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process. According to the technical scheme provided by the embodiment of the application, high-load test input data can be automatically generated, the workload of manually constructing test cases is reduced, and the test efficiency is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the application or to delineate the scope of the application. Other features of the present application will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for generating test data according to a first embodiment of the present application;
FIG. 2 is a flowchart of a method for generating test data according to a second embodiment of the present application;
FIG. 3 is a flowchart of a method for generating test data according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a test data generating device according to a fourth embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device implementing a method for generating test data according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a test data generating method according to an embodiment of the present application, where the method may be performed by a test data generating device, and the test data generating device may be implemented in hardware and/or software, and the test data generating device may be configured in an electronic device. As shown in fig. 1, the method includes:
s110, generating an initial population according to input domain information of a system to be tested, wherein the initial population comprises input data required by pressure test of each application program in the system to be tested.
The system to be tested may be an operating system of a vehicle requiring pressure testing, and a plurality of application programs can be run on the operating system. The input field of the system to be tested can be confirmed according to the attribute of the application program running on the system to be tested, and different application programs need different inputs. For example, the input field indicates what data needs to be received, corresponding to the application receiving the data; for monitoring applications, the input field indicates which performance data of other applications to monitor, etc.
Specifically, generating an initial population according to input domain information of a system to be tested includes:
and generating input data required by the first group of pressure tests according to the input domain information of each application program in the system to be tested, and taking the input data required by the first group of pressure tests as an initial population.
The method comprises the steps of generating input data required by a first group of pressure tests according to input domain information of each application program in a system to be tested, taking the input data required by the first group of pressure tests as an initial population, and particularly randomly generating the first group of test input data according to the input domain information of each application program in the system to be tested, wherein the value of the first group of data can be dynamically adjusted according to the performance of a computer executing a pressure test algorithm and/or the expected effect, and each group of input data contains test data corresponding to all application programs in the system to be tested. For example, when the system to be tested includes the application program A, B, C, the input data includes the test data corresponding to the application program A, B, C, such as the test data corresponding to the application program A, B, C, for example, A1, B1, C1, or A2, B2, C2. After generating the input data required for the first set of number of stress tests, the input data required for the first set of number of stress tests is taken as an initial population.
By randomly generating a first group of test input data according to the input domain information of each application program in the system to be tested, the test input data with higher fitness can be obtained, the generated test data is ensured to cover the characteristics of the input domains of all application programs, and the function of full coverage is achieved.
S120, performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness.
The individual fitness refers to the dominance degree of individuals in the population, and the higher the individual fitness is, the better the stress test effect of the input data is.
Specifically, the method for testing the pressure of the system to be tested according to the input data in the initial population, and determining the individual fitness of the input data according to the pressure test result comprises the following steps:
performing pressure test on each application program in the system to be tested according to input data required by each group of pressure test in the initial population to obtain system resource occupation information;
and determining the individual fitness of each group of input data according to the system resource occupation information.
The system resource occupation information comprises CPU occupation information, memory occupation information and response delay information.
Specifically, according to the input data required by each group of pressure tests in the initial population, pressure tests are performed on each application program in the system to be tested to obtain system resource occupation information, which can be to execute the pressure tests on each input data of the initial population in sequence, and in the process of executing the pressure tests on each input data, resource occupation data such as CPU occupation, memory occupation, response delay and the like of the system are recorded.
Specifically, determining the individual fitness of each group of input data according to the system resource occupation information includes:
for each group of input data, determining the individual fitness of the corresponding input data in a linear weighting mode according to the CPU occupation information, the memory occupation information and the response delay information.
Specifically, the individual fitness corresponding to the input data is determined by a linear weighting mode, the corresponding weight can be determined according to the importance of the resource, and the individual fitness is obtained by integrating the resource occupation data according to the weight by a weighting mode. For example, for application a, the CPU occupancy information is of higher importance, requiring 50% of the weight, while the memory occupancy information and the response delay information are of lower importance than the CPU occupancy information, each accounting for 25% of the weight. When the individual fitness of the application A is calculated, the CPU occupation information, the memory occupation information and the response delay information are multiplied by the corresponding weights, and the final individual fitness is obtained.
Specifically, population iteration is performed according to individual fitness, including:
acquiring input data of a second group number in the initial population according to the individual fitness;
and updating the initial population by adopting a random crossing and mutation mode based on the input data of the second group of numbers to obtain a target population.
Specifically, the second group of input data in the initial population is obtained according to the fitness of the individuals, the second group of input data can be selected from the first group of input data from high to low according to the ranking of the fitness of the individuals, and the specific number of the second group of input data can be determined according to the first group of input data. For example, the second set of numbers n may be 2/3 of the first set of numbers m, which may preserve excellent individuals while increasing the randomness of the population.
For example, it is assumed that the operating system includes an application a, an application B, and an application C, and the input data of the first group number is sorted according to the individual fitness corresponding to each input data in each application, and the input data of the second group number is selected from the input data of the first group number from high to low according to the size of the individual fitness. For example, input data { A from a first group number 11 ,A 12 ,A 13 ,B 11 ,B 12 ,B 13 ,C 11 ,C 12 ,C 13 },{A 21 ,A 22 ,A 23 ,B 21 ,B 22 ,B 23 ,C 21 ,C 22 ,C 23 },{A 31 ,A 32 ,A 33 ,B 31 ,B 32 ,B 33 ,C 31 ,C 32 ,C 33 },{A 41 ,A 42 ,A 43 ,B 41 ,B 42 ,B 43 ,C 41 ,C 42 ,C 43 },{A 51 ,A 52 ,A 53 ,B 51 ,B 52 ,B 53 ,C 51 ,C 52 ,C 53 },{A 61 ,A 62 ,A 63 ,B 61 ,B 62 ,B 63 ,C 61 ,C 62 ,C 63 Input data { A) of a second set of numbers, among which the individual fitness rank top is selected 11 ,A 12 ,A 13 ,B 11 ,B 12 ,B 13 ,C 11 ,C 12 ,C 13 },{A 21 ,A 22 ,A 23 ,B 21 ,B 22 ,B 23 ,C 21 ,C 22 ,C 23 },{A 51 ,A 52 ,A 53 ,B 51 ,B 52 ,B 53 ,C 51 ,C 52 ,C 53 },{A 61 ,A 62 ,A 63 ,B 61 ,B 62 ,B 63 ,C 61 ,C 62 ,C 63 }。
Specifically, based on the input data of the second group number, the initial population is updated by adopting a random crossing and mutation mode to obtain the target population, the selected input data of the second group number can be recombined by adopting a random crossing and mutation mode, the recombined input data is used as new input data, the initial population is updated according to the data, and the target population is obtained. For example, for { A } 11 ,A 12 ,A 13 ,B 11 ,B 12 ,B 13 ,C 11 ,C 12 ,C 13 },{A 21 ,A 22 ,A 23 ,B 21 ,B 22 ,B 23 ,C 21 ,C 22 ,C 23 },{A 51 ,A 52 ,A 53 ,B 51 ,B 52 ,B 53 ,C 51 ,C 52 ,C 53 },{A 61 ,A 62 ,A 63 ,B 61 ,B 62 ,B 63 ,C 61 ,C 62 ,C 63 The application does not limit each group of test data in the initial population, and specifically takes the input data generated by adopting a random crossing and mutation mode as the reference.
And S130, under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process.
The iteration ending condition can enable new populations generated by iteration to reach the maximum iteration algebra or population fitness evolution stagnation. Population fitness evolution may be determined by comparing individual fitness of two adjacent iterations, e.g., the performance of population fitness evolution arrest may be such that the fitness of two adjacent iterations is less than a preset population change degree threshold, which may be a fixed value set by the user.
Specifically, the iteration end condition may be set by the user according to the performance of the computer executing the stress test algorithm and/or the amount of test data, and the user may dynamically adjust the iteration end condition according to the performance of the computer executing the stress test algorithm and/or the amount of test data.
Specifically, under the condition that the iteration end condition is met, determining test data of a pressure test according to input data corresponding to a pressure test result in the iteration process. The input data combination which makes the system resources occupy the highest in the iterative process can be selected as the final pressure test case input. The highest system resource occupation can be the input data of each application corresponding to the highest system resource occupation value under the condition that all applications under the operating system are operated and the system is not crashed.
According to the technical scheme, an initial population is generated according to the input domain information of the system to be tested, the system to be tested is subjected to pressure test according to the input data in the initial population, the individual fitness of the input data is determined according to the pressure test result, and population iteration is performed according to the individual fitness. And under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process. The problem that the performance of the system in the limit state is difficult to comprehensively evaluate by using a system due to the manually designed test case is solved.
Example two
Fig. 2 is a flowchart of a test data generating method according to a second embodiment of the present application, where the method is optimized based on the foregoing embodiment, and a scheme not described in detail in the embodiment of the present application is shown in the foregoing embodiment. As shown in fig. 2, the method includes:
s210, generating an initial population according to input domain information of a system to be tested, wherein the initial population comprises input data required by pressure test of each application program in the system to be tested.
Specifically, the generating an initial population according to the input domain information of the system to be tested includes:
and generating input data required by the first group of pressure tests according to the input domain information of each application program in the system to be tested, and taking the input data required by the first group of pressure tests as an initial population.
S220, performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness.
Specifically, the performing a stress test on the system to be tested according to the input data in the initial population, and determining the individual fitness of the input data according to a stress test result includes:
performing pressure test on each application program in the system to be tested according to input data required by each group of pressure test in the initial population to obtain system resource occupation information;
and determining the individual fitness of each group of input data according to the system resource occupation information.
The system resource occupation information comprises CPU occupation information, memory occupation information and response delay information.
Specifically, the determining the individual fitness of each group of input data according to the system resource occupation information includes:
and for each group of input data, determining the individual fitness of the corresponding input data in a linear weighting mode according to the CPU occupation information, the memory occupation information and the response delay information.
Specifically, performing population iteration according to the individual fitness, wherein the population iteration comprises the steps of acquiring input data of a second group number in an initial population according to the individual fitness;
and updating the initial population by adopting a random crossing and mutation mode based on the input data of the second group of numbers to obtain a target population.
S230, judging whether the iteration ending condition is met according to algebra of population iteration or individual fitness, if not, executing step S240, and if so, executing step S250.
The iteration ending condition can enable new populations generated by iteration to reach the maximum iteration algebra or population fitness evolution stagnation. Population fitness evolution can be determined by comparing individual fitness of two adjacent iterations, and population fitness evolution stagnation can be a population change degree threshold value and can be a fixed value set by a user.
Specifically, the iteration end condition may be set by the user according to the performance of the computer executing the stress test algorithm and/or the amount of test data, and the user may dynamically adjust the iteration end condition according to the performance of the computer executing the stress test algorithm and/or the amount of test data.
Specifically, whether the iteration end condition is satisfied is determined according to algebra or individual fitness of the population iteration, which may be whether the iteration end condition is satisfied is determined according to a preset condition for the population iteration end by a user. Specifically, the user can set the maximum iteration number and the threshold value of the individual fitness, and judge whether the population meets the iteration ending condition by acquiring the maximum iteration number and the size of the individual fitness set for the user.
And S240, under the condition that the iteration ending condition is not met, performing pressure test on the system to be tested according to the input data in the target population, and determining the individual fitness of the input data in the target population according to the pressure test result.
And performing pressure test on each application program in the system to be tested according to the input data required by each group of pressure test in the updated initial population, and determining individual fitness of each group of input data according to the system resource occupation information. Specifically, according to the input data required by each group of pressure tests in the updated initial population, pressure tests are performed on each application program in the system to be tested to obtain system resource occupation information, which can be to sequentially execute the pressure tests on each input data in the updated initial population, and in the process of executing the pressure tests on each input data, the resource occupation data such as CPU occupation, memory occupation and response delay of the system are recorded, and the individual fitness of the corresponding input data is determined in a linear weighting mode.
Specifically, the performing population iteration according to the individual fitness further includes:
acquiring the input data of a third group number in the target population according to the individual fitness of the input data in the target population;
and updating the target population by adopting a random crossing and mutation mode based on the input data of the third group of numbers.
Specifically, the third group of input data in the target population is obtained according to the individual fitness of the input data in the target population, the third group of input data can be selected from the first group of input data from high to low according to the size of the individual fitness, and the specific number of the third group of input data can be dynamically adjusted according to the performance of a computer executing the pressure test algorithm and/or the expected effect.
Specifically, based on the input data of the third group number, the target population is updated by adopting a random crossing and mutation mode. The selected third group of input data can be recombined in a random crossing and mutation mode, the recombined input data is used as new input data, and the initial population is updated according to the new input data, so that the target population is obtained.
S250, under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process.
According to the technical scheme, an initial population is generated according to the input domain information of the system to be tested, the system to be tested is subjected to pressure test according to the input data in the initial population, the individual fitness of the input data is determined according to the pressure test result, and population iteration is performed according to the individual fitness. And under the condition that the iteration ending condition is not met, carrying out pressure test on the system to be tested according to the input data in the target population again, and determining the individual fitness of the input data in the target population according to the pressure test result until the iteration ending condition is met. And under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process. Through multi-generation evolution and excellent individual reservation, input combinations which are difficult to construct manually can be found, and higher test coverage rate is achieved.
Fig. 3 is a flowchart of a specific implementation of a test data generating method according to a third embodiment of the present application, and on the basis of the foregoing embodiment, a preferred embodiment is provided, which specifically includes the following steps:
s310, setting genetic algorithm parameters.
Wherein the genetic algorithm parameters may include: parameters such as population size, crossing rate, mutation rate, etc.
S320, generating an initial population according to the input domain information of the system to be tested.
Specifically, generating an initial population according to input domain information of a system to be tested includes:
and generating input data required by the first group of pressure tests according to the input domain information of each application program in the system to be tested, and taking the input data required by the first group of pressure tests as an initial population.
S330, performing pressure test on each application program in the system to be tested according to the input data required by each group of pressure test in the initial population to obtain system resource occupation information.
The system resource occupation information comprises CPU occupation information, memory occupation information and response delay information.
S340, determining individual fitness of each group of input data according to the system resource occupation information.
Specifically, determining the individual fitness of each group of input data according to the system resource occupation information includes:
for each group of input data, determining the individual fitness of the corresponding input data in a linear weighting mode according to the CPU occupation information, the memory occupation information and the response delay information.
S350, acquiring input data of a second group number in the initial population according to the individual fitness.
And S360, updating the initial population by adopting a random crossing and mutation mode based on the input data of the second group of numbers to obtain a target population.
S370, judging whether iteration ending conditions are met according to algebra or individual fitness of population iteration. If yes, go to step S380; if not, repeating the steps from step S330 to step S360 until the iteration end condition is satisfied.
And S380, under the condition that the iteration ending condition is met, selecting the test input data with the highest pressure test effect as a final result.
The highest system resource occupation can be the input data of each application corresponding to the highest system resource occupation value under the condition that all applications under the operating system are operated and the system is not crashed.
Example IV
Fig. 4 is a schematic structural diagram of a test data generating device according to a fourth embodiment of the present application. The test data generating device may be used to perform the test data generating method according to any embodiment of the present application, and the test data generating device may be implemented in hardware and/or software, and the test data generating device may be configured in an electronic device. For example, the electronic device may be a smart car and the processor in the electronic device may be an ECU. As shown in fig. 4, the apparatus includes: an initial population generation module 41, a population iteration module 42, and a test data determination module 43.
The initial population generation module 41 is configured to generate an initial population according to input domain information of a system to be tested, where the initial population includes input data required by each application program in the system to be tested for performing a pressure test;
a population iteration module 42, configured to perform a stress test on the system to be tested according to the input data in the initial population, determine an individual fitness of the input data according to a result of the stress test, and perform population iteration according to the individual fitness;
and the test data determining module 43 is configured to determine test data of a pressure test according to input data corresponding to the pressure test result in the iteration process when the iteration end condition is satisfied.
Further, the initial population generation module 41 is specifically configured to:
and generating input data required by the first group of pressure tests according to the input domain information of each application program in the system to be tested, and taking the input data required by the first group of pressure tests as an initial population.
In an embodiment of the present application, population iteration module 42 comprises:
the individual fitness calculation unit is used for carrying out pressure test on each application program in the system to be tested according to input data required by each group of pressure test in the initial population to obtain system resource occupation information;
and determining the individual fitness of each group of input data according to the system resource occupation information.
The system resource occupation information comprises CPU occupation information, memory occupation information and response delay information;
the individual fitness calculating unit is specifically configured to determine, for each group of input data, the individual fitness of the corresponding input data in a linear weighting manner according to the CPU occupation information, the memory occupation information and the response delay information.
The first population iteration unit is used for acquiring input data of a second group of numbers in the initial population according to the individual fitness;
and updating the initial population by adopting a random crossing and mutation mode based on the input data of the second group of numbers to obtain a target population.
Optionally, the population iteration unit is further configured to:
optionally, the population iteration module 42 further includes:
under the condition that the iteration ending condition is not met, carrying out pressure test on the system to be tested according to the input data in the target population, and determining the individual fitness of the input data in the target population according to the pressure test result;
acquiring the input data of a third group number in the target population according to the individual fitness of the input data in the target population;
and updating the target population by adopting a random crossing and mutation mode based on the input data of the third group of numbers.
Optionally, the test data generating device further includes:
and the population iteration judging module is used for judging whether the iteration ending condition is met according to algebra or individual fitness of population iteration after updating the initial population in a random crossing and mutation mode based on the input data of the second group number to obtain a target population.
The test data generating device provided by the embodiment of the application can execute the test data generating method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the executing method.
Example 5
Fig. 5 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the application. The electronic device may include an intelligent vehicle such as a fuel vehicle, a new energy vehicle, etc. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, such as a test data generation method.
In some embodiments, the test data generation method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the test data generation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the test data generation method in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above can be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present application, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present application are achieved, and the present application is not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. A method of generating test data, comprising:
generating an initial population according to input domain information of a system to be tested, wherein the initial population comprises input data required by each application program in the system to be tested for pressure test;
performing pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and performing population iteration according to the individual fitness;
and under the condition that the iteration ending condition is met, determining test data of the pressure test according to input data corresponding to the pressure test result in the iteration process.
2. The method of claim 1, wherein generating the initial population based on input domain information for the system under test comprises:
and generating input data required by the first group of pressure tests according to the input domain information of each application program in the system to be tested, and taking the input data required by the first group of pressure tests as an initial population.
3. The method of claim 2, wherein the stress testing the system under test based on the input data in the initial population, and determining the individual fitness of the input data based on the stress test results, comprises:
performing pressure test on each application program in the system to be tested according to input data required by each group of pressure test in the initial population to obtain system resource occupation information;
and determining the individual fitness of each group of input data according to the system resource occupation information.
4. The method of claim 3, wherein the system resource occupancy information comprises CPU occupancy information, memory occupancy information, and response delay information.
5. The method of claim 4, wherein determining individual fitness of each set of input data based on the system resource occupancy information comprises:
and for each group of input data, determining the individual fitness of the corresponding input data in a linear weighting mode according to the CPU occupation information, the memory occupation information and the response delay information.
6. The method of claim 1, wherein the iterating the population according to the fitness of the individual comprises:
acquiring input data of a second group number in the initial population according to the individual fitness;
and updating the initial population by adopting a random crossing and mutation mode based on the input data of the second group of numbers to obtain a target population.
7. The method of claim 6, wherein after updating the initial population with random crossover and mutation based on the second set of input data to obtain a target population, further comprising:
judging whether iteration ending conditions are met according to algebra or individual fitness of population iteration;
under the condition that the iteration ending condition is not met, carrying out pressure test on the system to be tested according to the input data in the target population, and determining the individual fitness of the input data in the target population according to the pressure test result;
the population iteration is carried out according to the individual fitness, and the method comprises the following steps:
acquiring the input data of a third group number in the target population according to the individual fitness of the input data in the target population;
and updating the target population by adopting a random crossing and mutation mode based on the input data of the third group of numbers.
8. A test data generating apparatus, comprising:
the initial population generation module is used for generating an initial population according to the input domain information of the system to be tested, wherein the initial population comprises input data required by each application program in the system to be tested for pressure test;
the population iteration module is used for carrying out pressure test on the system to be tested according to the input data in the initial population, determining individual fitness of the input data according to a pressure test result, and carrying out population iteration according to the individual fitness;
and the test data determining module is used for determining the test data of the pressure test according to the input data corresponding to the pressure test result in the iteration process under the condition that the iteration ending condition is met.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of generating test data according to any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the method of generating test data according to any one of claims 1-7.
CN202310753542.5A 2023-06-25 2023-06-25 Test data generation method and device, electronic equipment and medium Pending CN116662200A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310753542.5A CN116662200A (en) 2023-06-25 2023-06-25 Test data generation method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310753542.5A CN116662200A (en) 2023-06-25 2023-06-25 Test data generation method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN116662200A true CN116662200A (en) 2023-08-29

Family

ID=87719009

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310753542.5A Pending CN116662200A (en) 2023-06-25 2023-06-25 Test data generation method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116662200A (en)

Similar Documents

Publication Publication Date Title
CN111145076B (en) Data parallelization processing method, system, equipment and storage medium
US8832839B2 (en) Assessing system performance impact of security attacks
CN115222046A (en) Neural network structure searching method and device, electronic equipment and storage medium
CN114519006A (en) Test method, device, equipment and storage medium
CN115794570A (en) Pressure testing method, device, equipment and computer readable storage medium
CN116662200A (en) Test data generation method and device, electronic equipment and medium
CN114884813B (en) Network architecture determining method and device, electronic equipment and storage medium
CN115481594B (en) Scoreboard implementation method, scoreboard, electronic equipment and storage medium
CN113361621B (en) Method and device for training model
CN114760190A (en) Service-oriented converged network performance anomaly detection method
CN114490405A (en) Resource demand determination method, device, equipment and storage medium
CN112242959A (en) Micro-service current-limiting control method, device, equipment and computer storage medium
CN115905021B (en) Fuzzy test method and device, electronic equipment and storage medium
CN117131784B (en) Global agent optimization-based accelerated degradation test design method and device
CN114372238B (en) Distributed state estimation method
CN114186833A (en) Method, device, equipment and storage medium for constructing supply chain network
CN116089807A (en) Root cause analysis method and device for product quality and electronic equipment
CN117010758A (en) Method, device, equipment, medium and product for generating model verification conclusion
CN118133103A (en) Time sequence data anomaly detection model generation method and device and electronic equipment
CN117608896A (en) Transaction data processing method and device, electronic equipment and storage medium
CN117632748A (en) Method and device for determining smoke emission test case, electronic equipment and storage medium
CN116541187A (en) Buffer space management method, device, equipment and medium of electronic control unit
CN116933896A (en) Super-parameter determination and semantic conversion method, device, equipment and medium
CN118212033A (en) Data processing method, device, equipment and storage medium
CN117851208A (en) Chip evaluation method and device, electronic equipment and medium

Legal Events

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