CN113448859B - Test data generation method and device based on distributed system - Google Patents
Test data generation method and device based on distributed system Download PDFInfo
- Publication number
- CN113448859B CN113448859B CN202110779314.6A CN202110779314A CN113448859B CN 113448859 B CN113448859 B CN 113448859B CN 202110779314 A CN202110779314 A CN 202110779314A CN 113448859 B CN113448859 B CN 113448859B
- Authority
- CN
- China
- Prior art keywords
- data
- data structure
- structure models
- test data
- generating
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 125
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000013499 data model Methods 0.000 claims abstract description 36
- 238000013142 basic testing Methods 0.000 claims description 32
- 239000000203 mixture Substances 0.000 claims description 23
- 238000004590 computer program Methods 0.000 claims description 12
- 238000003860 storage Methods 0.000 claims description 12
- 238000013100 final test Methods 0.000 claims description 4
- 238000013522 software testing Methods 0.000 abstract description 2
- 238000012545 processing Methods 0.000 description 33
- 230000006870 function Effects 0.000 description 12
- 230000002688 persistence Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000003993 interaction Effects 0.000 description 8
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000002452 interceptive effect Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000000750 progressive effect Effects 0.000 description 2
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000006698 induction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000011112 process operation Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention belongs to the technical field of distributed system software testing, and provides a distributed system-based test data generation method and device, wherein the distributed system-based test data generation method comprises the following steps: generating a plurality of data structure models according to the data structures required by the distributed system; connecting the plurality of data structure models according to field meanings in the plurality of data structure models to determine association relations among the plurality of data structure models; and generating test data according to the field attributes in the data structure models and the association relation. The invention provides a method for generating test data by converting the test data into a corresponding data model without depending on a test environment and only by focusing on service requirements.
Description
Technical Field
The application can be used in the technical field of distributed system software testing, and particularly relates to a distributed system-based test data generation method and device.
Background
Today, where the information industry is evolving at a high rate, computer systems are becoming larger in size so that all business units can be deployed centrally on one or several mainframes, but this situation has become increasingly inadequate for today's computer systems.
Computer systems are undergoing an unprecedented revolution from centralized to distributed architecture. The transformation of distributed architecture has also become more demanding for the original testers. A distributed system is a system in which hardware or software components are distributed on different network computers and communicate and coordinate with each other only through messaging, and in comparison with a centralized system, how to deploy multiple nodes to a service and a distributed collaboration problem between nodes are also required to be considered. The collaboration problem between the nodes of the server also directly affects the efficiency of generating test data.
When the system software test is performed, the testers test through normal business processes, and test data are generated through business process operation. The longer the transaction link, the higher the stability requirements for the test environment when one business function service is in the distributed system, the more server nodes involved. On a transaction key link, under the condition that any one server node cannot work normally, test personnel cannot generate test data through a normal business process, and the test progress is blocked, so that a bottleneck is caused. If the tester prepares the data by directly inserting the data into the database by hands to avoid the influence of the test environment, the method is definitely a huge workload, the manufacturing cost of the test data is increased, and the test efficiency is reduced.
Disclosure of Invention
The invention can be used in the technical field of test data generation based on a distributed system in the financial field, and can also be used in any field except the financial field. The invention provides a method capable of generating test data by converting the test data into a corresponding data model without depending on a test environment and only by focusing on service requirements. The invention can better solve the problem of low count efficiency caused by the fact that testers need to pay attention to the cooperation relation of server nodes because of complex systems in the current distributed software system test, and can also solve the problem that the testers cannot initiate transaction to finish test data generation through normal business processes because of no business function entrance.
In order to solve the technical problems, the invention provides the following technical scheme:
In a first aspect, the present invention provides a method for generating test data based on a distributed system, including:
Generating a plurality of data structure models according to the data structures required by the distributed system;
connecting the plurality of data structure models according to field meanings in the plurality of data structure models to determine association relations among the plurality of data structure models;
And generating test data according to the field attributes in the data structure models and the association relation.
In one embodiment, the generating a plurality of data structure models according to the data structures required by the distributed system includes:
determining model names, field definitions and data composition rules of the plurality of data structure models according to the categories of the data structures;
And generating the plurality of data structure models according to the data structures, the model names, the field definitions and the data composition rules.
In an embodiment, the generating test data according to the field attributes in the data structure models and the association relationship includes:
generating basic test data of a plurality of first data structure models according to field attributes in the first data structure models;
Generating basic test data of a plurality of second data structure models according to the association relation and according to the basic test data of the plurality of first data structure models and field attributes of the plurality of second data structure models;
Combining the basic test data of the plurality of first data structure models with the basic test data of the plurality of second data structure models to generate test data.
In one embodiment, the field attributes include: data type definition, data range parameters and the data composition rules.
In a second aspect, the present invention provides a test data generating apparatus based on a distributed system, the apparatus comprising:
a data model generating module, configured to generate a plurality of data structure models according to a data structure required by the distributed system;
the data model connection module is used for connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models;
and the data generation module is used for generating test data according to the field attributes in the data structure models and the association relation.
In one embodiment, the data model generation module includes:
A composition specification determining unit configured to determine model names, field definitions, and data composition rules of the plurality of data structure models according to the categories of the data structures;
And the data model generating unit is used for generating the data structure models according to the data structure, the model name, the field definition and the data composition rule.
In one embodiment, the data generation module includes:
The test data generating unit is used for generating basic test data of a plurality of first data structure models according to field attributes in the plurality of first data structure models;
The post-test data generation unit is used for generating a plurality of basic test data of the second data structure models according to the association relation and according to the basic test data of the first data structure models and the field attributes of the second data structure models;
And the final test data generating unit is used for combining the basic test data of the plurality of first data structure models and the basic test data of the plurality of second data structure models to generate test data.
In one embodiment, the field attributes include: data type definition, data range parameters and the data composition rules.
In a third aspect, the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of a test data generation method based on a distributed system when the program is executed by the processor.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a distributed system based test data generation method.
As can be seen from the above description, the embodiments of the present invention provide a method and an apparatus for generating test data based on a distributed system, which first generate a plurality of data structure models according to a data structure required by the distributed system; then, connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models; and finally, generating test data according to field attributes and association relations in the data structure models. The invention provides a method capable of generating test data by converting the test data into a corresponding data model without depending on a test environment and only by focusing on service requirements. The invention mainly solves the problem that in the current distributed software system test, the number making efficiency is low because the testers need to pay attention to the server node cooperation relationship because of the complex system, and can also solve the problem that the testers cannot initiate transaction to finish test data generation through normal business processes because of no business function entrance. The advantages are that:
1. the dependence on the software system when generating test data is reduced. The testers do not need to pay attention to the hardware architecture of the software system, so that the testers can concentrate on analysis of service requirements and design of test cases.
2. The test data generation threshold is reduced, and the test data generation efficiency is improved. The system can generate a data model based on the database detailed design completed by the software system, and after the data model is maintained by a tester, a large amount of available test data can be generated through the data model in the later period, so that the repeatability is reduced.
3. Accurate and comprehensive test data can be provided. Because the data model is designed based on the physical data structure of the system, and the test data generation is based on all possible permutation and combination of each field in the data model, the integrity and the accuracy of the generated test data are ensured. Sufficient data preparation also provides good assistance for testing the coverage of the test scene of the better completed software system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present invention, 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 based on a distributed system according to an embodiment of the invention;
FIG. 2 is a flow chart of step 100 in an embodiment of the invention;
FIG. 3 is a flow chart of step 300 in an embodiment of the invention;
FIG. 4 is a block diagram of a distributed system-based test data generation system in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of a data structure model processing interface in accordance with an embodiment of the present invention;
FIG. 6 is a schematic diagram of a model relationship handling interface in accordance with an embodiment of the present invention;
FIG. 7 is a schematic diagram of a data generation interface in accordance with an embodiment of the present invention;
FIG. 8 is a schematic diagram of a model relationship processing module in accordance with an embodiment of the present invention;
FIG. 9 is a flow chart of a method for generating test data based on a distributed system according to an embodiment of the present invention;
FIG. 10 is a block diagram of a distributed system-based test data generation apparatus in accordance with an embodiment of the present invention;
FIG. 11 is a block diagram of the data model generation module 10 in an embodiment of the present invention;
FIG. 12 is a block diagram of the data generation module 30 in an embodiment of the present invention;
Fig. 13 is a schematic structural diagram of an electronic device in an embodiment of the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It is noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present application and in the foregoing figures, 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 or inherent to such process, method, article, or apparatus.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
An embodiment of the present invention provides a specific implementation manner of a test data generating method based on a distributed system, referring to fig. 1, the method specifically includes the following contents:
Step 100: a plurality of data structure models are generated from the data structures required by the distributed system.
Specifically, after analysis and induction of the data structure required by the distributed system, a data structure model with model names, field definitions and data composition rules is established.
Step 200: and connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models.
And connecting the plurality of independent data structure models by specifying the interrelationships among the fields in the data structure models.
Step 300: and generating test data according to the field attributes in the data structure models and the association relation.
Specifically, first, basic test data of a single data structure model is generated from field data in the data structure model, and a plurality of such basic test data are combined in accordance with an association relationship, thereby generating test data.
As can be seen from the above description, the embodiments of the present invention provide a test data generating method based on a distributed system, which includes generating a plurality of data structure models according to a data structure required by the distributed system; then, connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models; and finally, generating test data according to field attributes and association relations in the data structure models. According to the invention, the testers can get rid of dependence on the test environment, do not need to care about the cooperative relationship among the distributed server nodes, greatly improve the test data generation efficiency, ensure the comprehensiveness of the test data and perfect the coverage of various test scenes.
In one embodiment, referring to fig. 2, step 100 comprises:
Step 101: determining model names, field definitions and data composition rules of the plurality of data structure models according to the categories of the data structures;
Step 102: and generating the plurality of data structure models according to the data structures, the model names, the field definitions and the data composition rules.
In one embodiment, referring to fig. 3, step 300 comprises:
Step 301: generating basic test data of a plurality of first data structure models according to field attributes in the first data structure models;
Step 302: generating basic test data of a plurality of second data structure models according to the association relation and according to the basic test data of the plurality of first data structure models and field attributes of the plurality of second data structure models;
Step 303: combining the basic test data of the plurality of first data structure models with the basic test data of the plurality of second data structure models to generate test data.
In one embodiment, the field attributes include: data type definition, data range parameters and the data composition rules.
In steps 301 to 303, each data structure model in the system is first obtained, each independent data structure model is processed separately, each data field attribute (including data type definition, data range parameter, composition rule) in the data structure model is obtained, a batch of basic data is generated for each field according to the data field attribute constraint, and then the basic data of each field is arranged and combined to generate model basic data. Then, according to the association relation existing between the data structure models, the priority (association relation) of each model generation data is adjusted according to the association relation, then, based on the model base data with high priority, additional model base data are generated, and final test data are combined.
In one embodiment, the invention further provides a specific embodiment of the test data generation method based on the distributed system.
First, the embodiment of the present invention further provides a test data generating system based on a distributed system, referring to fig. 4, the system includes: the system comprises an interface interaction module, a data structure model processing module, a model relation processing module, a data generating module and a data model persistence module, and specifically:
the interface interaction module is responsible for providing a friendly interface and interaction method for users, and mainly comprises 3 units, namely: the system comprises a data structure model processing interface, a model relation processing interface and a data generating interface.
The data structure model processing interface provides an interactive interface for creating a data structure model for a user, and mainly comprises a database statement conversion area and a data structure model display area, as shown in fig. 5. The interface provides two modes of modeling:
a method for modeling the data structure model includes inputting the table sentence by user in input box in sentence conversion region, transmitting sentence information to data structure model processing module by interface interaction module, traversing each field in said module after sentence information is received by data structure model processing module, automatically converting table field information and type definition to data structure model information, outputting it to data model persistence module for storage, outputting it to data structure model processing interface after storage is successful, displaying it in data structure model display region by data structure model processing interface, and creating the simplest data structure model.
The other way is that the user directly inputs the related information of the data structure model in the data structure model display area, wherein the related information comprises the data structure model name and the data structure model field information (field name, field description, data type, data length, generation type and generation rule), and after inputting, the user clicks a save button to save. The interface interaction module transmits the data structure model information input by the user to the data structure model processing module, and the data structure model processing module outputs the information to the data model persistence module for storage.
The model relation processing interface provides an interactive interface for establishing the association relation of the data structure model for the user, as shown in fig. 6. When the interface is entered, the interface requests the model relation processing module to acquire the data structure model relation information, and the model relation processing module acquires the information from the data model persistence module after receiving the request and then outputs the information to the interface. The interface will exhibit the relationships between the data structure models that have been currently completed. The user can establish the connection between the models by selecting the two models, and when the user completes the selection of the second model, the interface can require the user to input the conditions of the connection between the models. After the user inputs and stores, the interface transmits the information to the model relation processing module, and the model relation processing module transmits the information to the data model persistence module for storage.
The data generation interface provides a user with an interactive interface for establishing association relation of the data structure model, as shown in fig. 7. When the interface is entered, the interface requests the model relation processing module to acquire the data structure model relation information, and the model relation processing module acquires the information from the data model persistence module after receiving the request and then outputs the information to the interface. The interface will exhibit the data structure model already in the current system.
The user can select the data structure model to be generated on the data generation interface, and when the data structure model selected by the user is associated with other data models, the system automatically performs linkage selection. When the user selects the data structure model ready for generating data, the data generating operation can be performed. The system transmits the data model information required to generate data to the data generation module, and the data generation module processes the data model information to generate test data and displays the test data to a test information display area of the data generation interface.
And the data structure model processing module is responsible for receiving the data structure model information sent by the interface interaction module and performing relevant processing. When the interface interaction module sends in a database sentence, for example:
CREATE TABLE`department`(
"department _id" VARCHAR (10) NOT NULL COMMENT department number',
The ' department _name ' VARCHAR (30) NOT NULL COMMENT ' department name,
The ' department _addr ' VARCHAR (100) NOT NULL COMMENT ' department address,
The ' department _type ' int (1) NOT NULL COMMENT ' department type,
PRIMARY KEY(`department_id`)
) Engine= INNODB AUTO _increment=4 DEFAULT CHARSET =utf8mb 4 com= 'department information table';
CREATE TABLE`staff`(
the 'staff_id' VARCHAR (15) NOT NULL COMMENT 'employee number',
"Department _id" VARCHAR (10) NOT NULL COMMENT department number',
The 'staff_name' VARCHAR (30) NOT NULL COMMENT 'employee name',
"Staff_sex" INT (1) NOT NULL COMMENT 'employee gender',
'Staff_age' INT (3) NOT NULL COMMENT 'employee age',
"Bakfield" VARCHAR (100) NOT NULL COMMENT' note,
PRIMARY KEY(`staff_id`),
KEY`index_department`(`department_id`,`staff_name`)
) Engine= INNODB AUTO _internal=4 DEFAULT CHARSET =utf8mb 4 com= 'staff information table';
The data structure model processing module will obtain the field names (e.g. staff_id), field descriptions (e.g. employee number), field types (e.g. VARCHAR), field lengths (e.g. 15) defined in the statement one by one and convert them into corresponding fields in the data structure model. The generation of the database structure model according to the database statement lacks information of a generation type and a generation rule, and a user can complement the model information through an interface interaction module, wherein the generation type supports random numbers, data dictionaries and fixed values, and the generation rule can also have random number characters, random Chinese characters, random numbers, specific data dictionaries and specific fixed values according to the generation type. After completing the model after the database statement conversion, the data structure model shown in table 1 and table 2 can be obtained:
TABLE 1
TABLE 2
And the model relation processing module is responsible for processing the association relation among the data structure models. As shown in fig. 6, this means that there is an association between the data structure model "employee information table" and the data structure model "department information table" through the "department number" field. When a user adds such a model association, the model association processing module correspondingly generates association information (the department number of the employee information table is equal to the department number of the department information table) and stores the association information through the data model persistence module for the subsequent data generation module. In addition, the module also provides a function of modifying and deleting the association relation information.
The data generation module is responsible for acquiring the data structure model information generated by the data structure model processing module and the model association relation information generated by the model relation processing module through the data model persistence module, and then generating data according to the model selected by the user.
In view of the above-mentioned two data structure models and the model association relationship of fig. 8, when the user selects to generate test data for the data structure model "employee information table" and the data structure model "department information table", the data generating module will first acquire the information of the data structure model "employee information table", and then generate data according to the information definition of each field. When the generation type defined by the field is a random number or a fixed value, the system generates a numerical value for the field according to the generation rule; when the generation type is dictionary value, the system can generate according to the dictionary value defined in the generation rule, and generate a numerical value covering the data dictionary. When the fields in the model generate data, the data are arranged and combined to form a data table.
The data structure model "employee information table" contains 6 fields, wherein the "employee gender" field is of data dictionary type, contains 2 data dictionaries, has 2 possibilities, and the other fields are all 1 possibility, so 2 types of data are arranged and combined in total, and a test data table shown in table 3 can be obtained:
TABLE 3 Table 3
By performing data generation on the data structure model "department information table" in the same manner, a test data table as shown in table 4 can be obtained:
TABLE 4 Table 4
However, because the association relation of the department numbers exists between the two data structure models, and the field of the department numbers defines the unique in the table in the generation rule of the department information table of the data structure model, the value of the field of the department information table has higher priority, so that the model basic data of the department information table is preferentially generated when data is generated, and then the field definition of the employee information table model is combined on the basis to perform permutation and combination calculation and generate the data. The final data table is shown in table 5 and table 6:
TABLE 5
TABLE 6
The test data table is the final output data of the tool system, which is made by combining the model association relation of fig. 8 with the two data structure models of the example. And then, the user can export the data into a database file through the data generation module, and the user can obtain the generated test data and develop a software system test only by putting the database file on a corresponding server database for execution.
The data model persistence module is responsible for persistence storage of data information generated in the operation of the whole tool system, cooperates with the data structure model processing module, the model relation processing module and the data generating module, receives the data information of the modules and performs read-write operation on the database according to module instructions.
Referring to fig. 9, based on the above-mentioned test data generating system based on a distributed system, a specific embodiment of the present invention provides a test data generating method based on a distributed system, including the following steps:
s1: and establishing a data structure model.
S2: and creating an association relation between the data structure models.
S3: data model conversion.
As can be seen from the above description, the embodiments of the present invention provide a test data generating method based on a distributed system, which includes generating a plurality of data structure models according to a data structure required by the distributed system; then, connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models; and finally, generating test data according to field attributes and association relations in the data structure models. The invention provides a method capable of generating test data by converting the test data into a corresponding data model without depending on a test environment and only by focusing on service requirements. The invention mainly solves the problem that in the current distributed software system test, the number making efficiency is low because the testers need to pay attention to the server node cooperation relationship because of the complex system, and can also solve the problem that the testers cannot initiate transaction to finish test data generation through normal business processes because of no business function entrance.
Based on the same inventive concept, the embodiment of the present application also provides a test data generating device based on a distributed system, which can be used to implement the method described in the above embodiment, such as the following embodiment. Because the principle of solving the problem of the test data generating device based on the distributed system is similar to that of the test data generating method based on the distributed system, the implementation of the test data generating device based on the distributed system can be implemented by referring to the test data generating method based on the distributed system, and the repetition is omitted. As used below, the term "unit" or "module" may be a combination of software and/or hardware that implements the intended function. While the system described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
An embodiment of the present invention provides a specific implementation manner of a test data generating device based on a distributed system, which can implement a test data generating method based on a distributed system, and referring to fig. 10, the test data generating device based on a distributed system specifically includes the following contents:
a data model generating module 10, configured to generate a plurality of data structure models according to a data structure required by the distributed system;
A data model connection module 20, configured to connect the plurality of data structure models according to field meanings in the plurality of data structure models, so as to determine association relationships between the plurality of data structure models;
the data generating module 30 is configured to generate test data according to field attributes in the multiple data structure models and the association relationships.
In one embodiment, referring to fig. 11, the data model generating module 10 includes:
a composition specification determination unit 101 for determining model names, field definitions, and data composition rules of the plurality of data structure models according to the categories of the data structures;
a data model generating unit 102, configured to generate the plurality of data structure models according to the data structure, model name, field definition, and data composition rule.
In one embodiment, referring to fig. 12, the data generating module 30 includes:
A test data generating unit 301, configured to generate basic test data of a plurality of first data structure models according to field attributes in the plurality of first data structure models;
A post-test data generating unit 302, configured to generate, according to the association relationship, a plurality of basic test data of the second data structure models according to the basic test data of the first data structure models and field attributes of the second data structure models;
And a final test data generating unit 303, configured to combine the basic test data of the plurality of first data structure models with the basic test data of the plurality of second data structure models to generate test data.
In one embodiment, the field attributes include: data type definition, data range parameters and the data composition rules.
As can be seen from the above description, the embodiments of the present invention provide a test data generating device based on a distributed system, which firstly generates a plurality of data structure models according to a data structure required by the distributed system; then, connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models; and finally, generating test data according to field attributes and association relations in the data structure models. The invention provides a method capable of generating test data by converting the test data into a corresponding data model without depending on a test environment and only by focusing on service requirements. The invention mainly solves the problem that in the current distributed software system test, the number making efficiency is low because the testers need to pay attention to the server node cooperation relationship because of the complex system, and can also solve the problem that the testers cannot initiate transaction to finish test data generation through normal business processes because of no business function entrance.
The embodiment of the present application further provides a specific implementation manner of an electronic device capable of implementing all the steps in the test data generating method based on the distributed system in the foregoing embodiment, and referring to fig. 13, the electronic device specifically includes the following contents:
A processor 1201, a memory 1202, a communication interface (Communications Interface) 1203, and a bus 1204;
wherein the processor 1201, the memory 1202 and the communication interface 1203 perform communication with each other through the bus 1204; the communication interface 1203 is configured to implement information transmission between the server device and the client device;
The processor 1201 is configured to invoke a computer program in the memory 1202, and when the processor executes the computer program, the processor implements all the steps in the test data generation method based on the distributed system in the above embodiment, for example, when the processor executes the computer program, the processor implements the following steps:
step 100: generating a plurality of data structure models according to the data structures required by the distributed system;
Step 200: connecting the plurality of data structure models according to field meanings in the plurality of data structure models to determine association relations among the plurality of data structure models;
Step 300: and generating test data according to the field attributes in the data structure models and the association relation.
The embodiment of the present application also provides a computer-readable storage medium capable of implementing all the steps in the distributed system-based test data generation method in the above embodiment, on which a computer program is stored, which when executed by a processor implements all the steps in the distributed system-based test data generation method in the above embodiment, for example, the processor implements the following steps when executing the computer program:
step 100: generating a plurality of data structure models according to the data structures required by the distributed system;
Step 200: connecting the plurality of data structure models according to field meanings in the plurality of data structure models to determine association relations among the plurality of data structure models;
Step 300: and generating test data according to the field attributes in the data structure models and the association relation.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for a hardware+program class embodiment, the description is relatively simple, as it is substantially similar to the method embodiment, as relevant see the partial description of the method embodiment.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Although the application provides method operational steps as an example or a flowchart, more or fewer operational steps may be included based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented by an actual device or client product, the instructions may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiments or figures.
For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, when implementing the embodiments of the present disclosure, the functions of each module may be implemented in the same or multiple pieces of software and/or hardware, or a module that implements the same function may be implemented by multiple sub-modules or a combination of sub-units, or the like. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller can be regarded as a hardware component, and means for implementing various functions included therein can also be regarded as a structure within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
The present embodiments may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments. In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present specification. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
The foregoing is merely an example of an embodiment of the present disclosure and is not intended to limit the embodiment of the present disclosure. Various modifications and variations of the illustrative embodiments will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of the embodiments of the present specification, should be included in the scope of the claims of the embodiments of the present specification.
Claims (6)
1. A test data generation method based on a distributed system, comprising:
Generating a plurality of data structure models according to the data structures required by the distributed system;
connecting the plurality of data structure models according to field meanings in the plurality of data structure models to determine association relations among the plurality of data structure models;
Generating test data according to field attributes in the data structure models and the association relation;
The generating a plurality of data structure models according to the data structures required by the distributed system comprises the following steps:
determining model names, field definitions and data composition rules of the plurality of data structure models according to the categories of the data structures;
Generating the plurality of data structure models according to the data structures, model names, field definitions and data composition rules;
the generating test data according to the field attributes in the data structure models and the association relation comprises the following steps:
generating basic test data of a plurality of first data structure models according to field attributes in the first data structure models;
Generating basic test data of a plurality of second data structure models according to the association relation and according to the basic test data of the plurality of first data structure models and field attributes of the plurality of second data structure models;
Combining the basic test data of the plurality of first data structure models with the basic test data of the plurality of second data structure models to generate test data.
2. The distributed system-based test data generation method of claim 1, wherein the field attributes comprise: data type definition, data range parameters and the data composition rules.
3. A test data generation apparatus based on a distributed system, comprising:
a data model generating module, configured to generate a plurality of data structure models according to a data structure required by the distributed system;
the data model connection module is used for connecting the plurality of data structure models according to field meanings in the plurality of data structure models so as to determine association relations among the plurality of data structure models;
The data generation module is used for generating test data according to field attributes in the data structure models and the association relation;
the data model generation module includes:
A composition specification determining unit configured to determine model names, field definitions, and data composition rules of the plurality of data structure models according to the categories of the data structures;
a data model generating unit, configured to generate the plurality of data structure models according to the data structure, model name, field definition, and data composition rule;
the data generation module comprises:
The test data generating unit is used for generating basic test data of a plurality of first data structure models according to field attributes in the plurality of first data structure models;
The post-test data generation unit is used for generating a plurality of basic test data of the second data structure models according to the association relation and according to the basic test data of the first data structure models and the field attributes of the second data structure models;
And the final test data generating unit is used for combining the basic test data of the plurality of first data structure models and the basic test data of the plurality of second data structure models to generate test data.
4. The distributed system-based test data generating apparatus as recited in claim 3, wherein the field attributes include: data type definition, data range parameters and the data composition rules.
5. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the distributed system based test data generation method of any one of claims 1 to 2 when the program is executed by the processor.
6. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the distributed system based test data generating method of any one of claims 1 to 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110779314.6A CN113448859B (en) | 2021-07-09 | 2021-07-09 | Test data generation method and device based on distributed system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110779314.6A CN113448859B (en) | 2021-07-09 | 2021-07-09 | Test data generation method and device based on distributed system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113448859A CN113448859A (en) | 2021-09-28 |
CN113448859B true CN113448859B (en) | 2024-08-02 |
Family
ID=77815784
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110779314.6A Active CN113448859B (en) | 2021-07-09 | 2021-07-09 | Test data generation method and device based on distributed system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113448859B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108984712A (en) * | 2018-07-06 | 2018-12-11 | 深圳前海微众银行股份有限公司 | Counting method, equipment and readable storage medium storing program for executing are made based on business scenario |
CN111340062A (en) * | 2020-02-04 | 2020-06-26 | 恩亿科(北京)数据科技有限公司 | Mapping relation determining method and device |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111382069A (en) * | 2020-03-02 | 2020-07-07 | 北京九州云动科技有限公司 | Data flow testing method and system |
CN112035366B (en) * | 2020-09-02 | 2023-08-18 | 中国银行股份有限公司 | Test case generation method, device and equipment |
-
2021
- 2021-07-09 CN CN202110779314.6A patent/CN113448859B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108984712A (en) * | 2018-07-06 | 2018-12-11 | 深圳前海微众银行股份有限公司 | Counting method, equipment and readable storage medium storing program for executing are made based on business scenario |
CN111340062A (en) * | 2020-02-04 | 2020-06-26 | 恩亿科(北京)数据科技有限公司 | Mapping relation determining method and device |
Also Published As
Publication number | Publication date |
---|---|
CN113448859A (en) | 2021-09-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111722839B (en) | Code generation method and device, electronic equipment and storage medium | |
US5390320A (en) | Automatically converting structured analysis tool database outputs into an integrated simulation model via transportable standardized metafile | |
CN112199086B (en) | Automatic programming control system, method, device, electronic equipment and storage medium | |
CN110554958A (en) | Graph database testing method, system, device and storage medium | |
CN111506444A (en) | Form approval method and device, storage medium and electronic equipment | |
CN107391142A (en) | The method and device that a kind of application is split | |
US20060184468A1 (en) | Automatic test program generation using extended conditional constraint satisfaction | |
CN113238740B (en) | Code generation method, code generation device, storage medium and electronic device | |
CN115170048B (en) | Workflow realization method, system and medium based on model and rule | |
CN112860260A (en) | Web-based cross-platform application construction tool and method in college scene | |
CN112559525B (en) | Data checking system, method, device and server | |
Pfeiffer et al. | Evaluation of conceptual models-a structuralist approach | |
CN108536718A (en) | A kind of method and system for the IT application in management realized based on input and output semantization | |
CN116992092A (en) | Method and device for establishing flow model, storage medium and terminal equipment | |
CN114491064A (en) | Internet of things platform construction method and device, storage medium and terminal | |
CN113448859B (en) | Test data generation method and device based on distributed system | |
CN116307503A (en) | Method for constructing domain model flow | |
CN115525321A (en) | Distributed task generation method, device, equipment and storage medium | |
CN115543428A (en) | Simulated data generation method and device based on strategy template | |
CN115422202A (en) | Service model generation method, service data query method, device and equipment | |
Janiesch et al. | Conceptual modeling of event processing networks | |
CN117435177B (en) | Application program interface construction method, system, equipment and storage medium | |
Heavey et al. | A model management systems approach to manufacturing systems design | |
CN116755684B (en) | OAS Schema generation method, device, equipment and medium | |
CN116090183B (en) | Digital simulation method and system for SCR demand model |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |