CN111078545A - Method and system for automatically generating test data - Google Patents

Method and system for automatically generating test data Download PDF

Info

Publication number
CN111078545A
CN111078545A CN201911231886.XA CN201911231886A CN111078545A CN 111078545 A CN111078545 A CN 111078545A CN 201911231886 A CN201911231886 A CN 201911231886A CN 111078545 A CN111078545 A CN 111078545A
Authority
CN
China
Prior art keywords
data
data type
test data
generation rule
matched
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
CN201911231886.XA
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.)
Beike Technology Co Ltd
Original Assignee
Beike Technology Co Ltd
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 Beike Technology Co Ltd filed Critical Beike Technology Co Ltd
Priority to CN201911231886.XA priority Critical patent/CN111078545A/en
Publication of CN111078545A publication Critical patent/CN111078545A/en
Pending legal-status Critical Current

Links

Images

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/3672Test management
    • G06F11/3688Test 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 relates to the technical field of data processing, and discloses a method and a system for automatically generating test data. The method comprises the following steps: defining at least one data generation rule for at least one data type in a database; acquiring and analyzing service flow information of a system to be tested to obtain a data type of the service flow; acquiring the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule; and returning the test data to the system to be tested for testing. The method provided by the invention can automatically construct various test data required by the service process of the system to be tested, and the tester can automatically complete data construction by one key without concerning the construction rules of various data, thereby improving the working efficiency and reducing the error rate; and the associated data types can be automatically matched, the data linkage generation is realized, and the data construction is intelligent.

Description

Method and system for automatically generating test data
Technical Field
The invention relates to the technical field of data processing, in particular to an automatic test data generation method and an automatic test data generation system.
Background
As software is updated more and more quickly, the software needs to be tested with a large amount of test data before being released, wherein the test data is the relevant data constructed for the software test. The tester not only needs to consider the service scene, but also needs to design a large amount of test data according to the service scene, and the test data are manually constructed, so that the cost is high and the efficiency is low.
For example, when a business system tests various business processes, different test data needs to be constructed because of different test requirements of different processes. When each kind of test data is constructed, various service information needs to be manually input and filled in to create a test case, and research and development personnel are not clear of specific creation rules and need to manually consult the construction rules, so that the efficiency is low and the error rate is high.
Disclosure of Invention
The invention aims to provide a method and a system for automatically generating test data, which aim to solve the problems that the test data is constructed manually and the efficiency is low.
In order to achieve the above object, a first aspect of the present invention provides a method for automatically generating test data, the method including:
defining at least one data generation rule for at least one data type in a database;
acquiring and analyzing service flow information of a system to be tested to obtain a data type of the service flow;
acquiring the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule;
and returning the test data to the system to be tested for testing.
Further, the data generation rule is a rule set including at least one generation rule.
Further, a rule set matched with the data type is obtained from the database, and test data are automatically generated according to the matched rule set.
Further, the obtaining the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule includes: judging whether the data type is an associated data type, wherein the associated data type has one or more associated data types; if the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule.
Further, the acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process includes: and acquiring and analyzing the information of each business process of the system to be tested to obtain the data type of each business process.
A second aspect of the present invention provides a system for automatically generating test data, the system comprising:
a database for storing data of a plurality of data types;
the rule definition module is used for defining at least one data generation rule for at least one data type in the database;
the engine module is used for acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process;
and the analysis module is used for acquiring the data generation rule matched with the data type from the database, automatically generating test data according to the matched data generation rule, and returning the test data to the system to be tested through the engine module.
Further, the data generation rule is a rule set including at least one generation rule; the analysis module is used for acquiring a rule set matched with the data type from the database and automatically generating test data according to the matched rule set.
Further, the obtaining the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule includes: judging whether the data type is an associated data type, wherein the associated data type has one or more associated data types; if the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule.
Further, the acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process includes: and acquiring and analyzing the information of each business process of the system to be tested to obtain the data type of each business process.
A third aspect of the present invention provides a storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described automatic test data generation method.
The method and the system for automatically generating the test data can automatically construct various test data required by the service process of the system to be tested, and the tester can automatically complete data construction by one key without concerning the construction rules of various data, thereby improving the working efficiency. The automatic test data generation method provided by the invention defines different data generation rules for different data types, generates more accurate test data according to the different rules and reduces the error rate; meanwhile, various rules are allowed to be combined, so that the data structure is more flexible; and the associated data types can be automatically matched, the data linkage generation is realized, and the data construction is intelligent.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the embodiments of the invention without limiting the embodiments of the invention. In the drawings:
FIG. 1 is a flow chart of a method for automatically generating test data according to an embodiment of the present invention;
fig. 2 is a block diagram of an automatic test data generation system according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
Fig. 1 is a flowchart of an automatic test data generation method according to an embodiment of the present invention. As shown in fig. 1, an embodiment of the present invention provides an automatic test data generation method, where the method includes:
s1, defining at least one data generation rule in the database for at least one data type.
The database includes data for enumerated values for each data type (e.g., nationality, marital), as well as various summaries of the generated data. Such as contract information, whose enumerated value data includes nationality, marital, house property, and the like, which are involved in the house property business system. For example, enumerated values corresponding to nationality include: mainland china, hong kong and ao tai, foreign nationality; enumerated values for marital correspondences include: married, not married, bereaved, dissimilarity; enumerated values for the property of the house include: commercial houses, purchased public houses, economically applicable houses, removal and placement houses and house change houses. The database supports direct use of generated data, for example, a plurality of different contract information are constructed for the same seller, and the various information of personnel are mutually related and can be directly used.
Defining at least one data generation rule for at least one data type, wherein personnel information comprises an identity card number, nationality and marital information, the identity card number is defined to be 18 bits long, the 7 th to 10 th identification year and the 17 th identification gender; enumerated values defining nationality and marital are obtained from a database. For example, the house information includes the name of the building, the year of construction and the property of the house, and the name of the building is defined to be randomly acquired from the database; defining numbers between the established year random assignments 2000-2010; the defined house property is obtained from the corresponding enumerated value in the database.
S2, acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process.
The system to be tested, such as an NTS transaction system, a configuration platform system and other internal systems needing to construct test data. For example, contract information of the service flow of the NTS transaction system is acquired, and the contract information is analyzed to obtain the property (data type) of the house.
In this step, information of each service flow of the system to be tested can be obtained and analyzed, and the data type of each service flow is obtained. The data type required by the first process of the system to be tested is obtained through analysis, and then the data type required by the second process is automatically analyzed, so that the data type of each service process is obtained in sequence.
And S3, acquiring the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule.
And S4, returning the test data to the system to be tested for testing.
Optionally, the data generation rule is a rule set including at least one generation rule. And acquiring a rule set matched with the data type from the database, and automatically generating test data according to the matched rule set. For example, the data type is an identification number, and a plurality of generation rules are defined, for example, a first rule: replacing the data of the identification year in the randomly acquired identity card number with a random year in 1950-2000; the second rule is as follows: the data identifying the sex in the randomly acquired identification number is changed to be odd (representing a male) or even (representing a female). And when the test data is automatically generated, matching the first rule with the second rule, and correspondingly replacing and changing the data for identifying the year and the sex in the identification number.
Optionally, before automatically generating the test data, it is determined whether the data type is an associated data type, where the associated data type has one or more associated data types. If the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule. For example, the data type of "buyer property" (data value includes individual and company) in the contract information, when the acquired data value is "individual", the personal information (including buyer name, gender, marital, contact address, nationality, etc.) in the "buyer information" data type (composite data type) is associated, and the personal information is automatically generated; when the acquired data value is 'company', company information (including company name, company registration address, company certificate number, company legal name, company legal nationality, company legal identity number and the like) in the 'buyer information' data type is associated, and the company information is automatically generated.
The automatic test data generation method provided by the embodiment of the invention can automatically construct various test data required by the service process of the system to be tested, and the tester can automatically complete data construction by one key without concerning the construction rules of various data, thereby improving the working efficiency. The method defines different data generation rules for different data types, generates more accurate test data according to the different rules, and reduces the error rate; meanwhile, various rules are allowed to be combined, so that the data structure is more flexible; and the associated data types can be automatically matched, the data linkage generation is realized, and the data construction is intelligent.
Fig. 2 is a block diagram of an automatic test data generation system according to an embodiment of the present invention. As shown in fig. 2, in an embodiment of the present invention, an automatic test data generation system includes: the system comprises a database, a rule definition module, an engine module and a parsing module.
The database is used for storing data of a plurality of data types, including data (such as nationality and marital) of enumerated values corresponding to the data types, and various generated data summaries.
The rule definition module is used for defining at least one data generation rule for at least one data type in a database.
The engine module is used for acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process. The system to be tested, such as an NTS transaction system, a configuration platform system and other internal systems needing to construct test data. For example, contract information of the service flow of the NTS transaction system is acquired, and the contract information is analyzed to obtain the property (data type) of the house. The engine module can communicate with the system to be tested through various protocols (such as http protocol, tcp protocol and dubbo protocol) to acquire related data.
The analysis module is used for acquiring the data generation rule matched with the data type from the database, automatically generating test data according to the matched data generation rule, and returning the test data to the system to be tested through the engine module.
Optionally, the data generation rule defined by the rule definition module is a rule set including at least one generation rule. And the analysis module acquires a rule set matched with the data type from the database and automatically generates test data according to the matched rule set.
Optionally, before automatically generating the test data, the parsing module determines whether the data type is an associated data type, where the associated data type has one or more associated data types. If the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule.
Optionally, the engine module obtains and analyzes information of each service flow of the system to be tested, so as to obtain a data type of each service flow. The data type required by the first process of the system to be tested is obtained through analysis, and then the data type required by the second process is automatically analyzed, so that the data type of each service process is obtained in sequence.
According to the test data automatic generation system provided by the embodiment of the invention, the engine module is used for automatically acquiring the data type of each service flow of the system to be tested, the analysis module is used for constructing accurate test data according to the corresponding data generation rule, and the engine module is used for returning the test data to the system to be tested for testing, so that the interaction between the test data automatic generation system and the system to be tested is realized, and the accurate data construction is realized.
The embodiment of the invention also provides a storage medium, wherein computer program instructions are stored on the storage medium, and when the computer program instructions are executed by a processor, the automatic generation method of the test data is realized.
Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be implemented by a program, which is stored in a storage medium and includes several instructions to enable a single chip, a chip, or a processor (processor) to execute all or part of the steps in the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
While the embodiments of the present invention have been described in detail with reference to the accompanying drawings, the embodiments of the present invention are not limited to the details of the above embodiments, and various simple modifications can be made to the technical solution of the embodiments of the present invention within the technical idea of the embodiments of the present invention, and the simple modifications are within the scope of the embodiments of the present invention. It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. In order to avoid unnecessary repetition, the embodiments of the present invention will not be described separately for the various possible combinations.
In addition, any combination of the various embodiments of the present invention is also possible, and the same should be considered as disclosed in the embodiments of the present invention as long as it does not depart from the spirit of the embodiments of the present invention.

Claims (10)

1. A method for automatically generating test data is characterized by comprising the following steps:
defining at least one data generation rule for at least one data type in a database;
acquiring and analyzing service flow information of a system to be tested to obtain a data type of the service flow;
acquiring the data generation rule matched with the data type from the database, and automatically generating test data according to the matched data generation rule;
and returning the test data to the system to be tested for testing.
2. The method of claim 1, wherein the data generation rule is a rule set comprising at least one generation rule.
3. The method according to claim 2, wherein the obtaining the data generation rule matching the data type from the database, and automatically generating the test data according to the matching data generation rule comprises:
and acquiring a rule set matched with the data type from the database, and automatically generating test data according to the matched rule set.
4. The method according to claim 1, wherein the obtaining the data generation rule matching the data type from the database, and automatically generating the test data according to the matching data generation rule comprises:
judging whether the data type is an associated data type, wherein the associated data type has one or more associated data types;
if the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule.
5. The method according to claim 1, wherein the obtaining and analyzing service flow information of the system under test to obtain the data type of the service flow comprises:
and acquiring and analyzing the information of each business process of the system to be tested to obtain the data type of each business process.
6. An automatic test data generation system, comprising:
a database for storing data of a plurality of data types;
the rule definition module is used for defining at least one data generation rule for at least one data type in the database;
the engine module is used for acquiring and analyzing the service process information of the system to be tested to obtain the data type of the service process;
and the analysis module is used for acquiring the data generation rule matched with the data type from the database, automatically generating test data according to the matched data generation rule, and returning the test data to the system to be tested through the engine module.
7. The automatic test data generation system of claim 6,
the data generation rule is a rule set comprising at least one generation rule;
the analysis module is used for acquiring a rule set matched with the data type from the database and automatically generating test data according to the matched rule set.
8. The automatic test data generation system of claim 6, wherein the obtaining of the data generation rule matching the data type from the database and the automatic generation of test data according to the matching data generation rule comprise:
judging whether the data type is an associated data type, wherein the associated data type has one or more associated data types;
if the data type is the associated data type, automatically generating the test data of the associated data type and the test data of one or more data types associated with the associated data type according to the matched data generation rule.
9. The automatic test data generation system of claim 6, wherein the obtaining and analyzing the service flow information of the system under test to obtain the data type of the service flow comprises:
and acquiring and analyzing the information of each business process of the system to be tested to obtain the data type of each business process.
10. A storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method of automatic generation of test data according to any of claims 1-5.
CN201911231886.XA 2019-12-05 2019-12-05 Method and system for automatically generating test data Pending CN111078545A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911231886.XA CN111078545A (en) 2019-12-05 2019-12-05 Method and system for automatically generating test data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911231886.XA CN111078545A (en) 2019-12-05 2019-12-05 Method and system for automatically generating test data

Publications (1)

Publication Number Publication Date
CN111078545A true CN111078545A (en) 2020-04-28

Family

ID=70312934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911231886.XA Pending CN111078545A (en) 2019-12-05 2019-12-05 Method and system for automatically generating test data

Country Status (1)

Country Link
CN (1) CN111078545A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111611174A (en) * 2020-05-28 2020-09-01 北京字节跳动网络技术有限公司 Test data construction method and device, computer equipment and storage medium
CN112199302A (en) * 2020-12-07 2021-01-08 望海康信(北京)科技股份公司 Test data generation method and system, corresponding equipment and storage medium
CN112834906A (en) * 2020-12-31 2021-05-25 杭州广立微电子股份有限公司 Test method for automatic matching

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140006459A1 (en) * 2012-06-29 2014-01-02 Hewlett-Packard Development Company, L.P. Rule-based automated test data generation
CN106708909A (en) * 2015-11-18 2017-05-24 阿里巴巴集团控股有限公司 Data quality detection method and apparatus
CN107943694A (en) * 2017-11-21 2018-04-20 中国农业银行股份有限公司 A kind of test data generating method and device
CN109240915A (en) * 2018-08-14 2019-01-18 平安普惠企业管理有限公司 System detection method, device, computer equipment and storage medium
CN110008111A (en) * 2019-01-31 2019-07-12 阿里巴巴集团控股有限公司 A kind of service test method and device
CN110262975A (en) * 2019-06-20 2019-09-20 深圳前海微众银行股份有限公司 Test data management method, device, equipment and computer readable storage medium
CN110532180A (en) * 2019-08-15 2019-12-03 中国银行股份有限公司 A kind of generation method and device of test data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140006459A1 (en) * 2012-06-29 2014-01-02 Hewlett-Packard Development Company, L.P. Rule-based automated test data generation
CN106708909A (en) * 2015-11-18 2017-05-24 阿里巴巴集团控股有限公司 Data quality detection method and apparatus
CN107943694A (en) * 2017-11-21 2018-04-20 中国农业银行股份有限公司 A kind of test data generating method and device
CN109240915A (en) * 2018-08-14 2019-01-18 平安普惠企业管理有限公司 System detection method, device, computer equipment and storage medium
CN110008111A (en) * 2019-01-31 2019-07-12 阿里巴巴集团控股有限公司 A kind of service test method and device
CN110262975A (en) * 2019-06-20 2019-09-20 深圳前海微众银行股份有限公司 Test data management method, device, equipment and computer readable storage medium
CN110532180A (en) * 2019-08-15 2019-12-03 中国银行股份有限公司 A kind of generation method and device of test data

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111611174A (en) * 2020-05-28 2020-09-01 北京字节跳动网络技术有限公司 Test data construction method and device, computer equipment and storage medium
CN111611174B (en) * 2020-05-28 2023-08-11 北京火山引擎科技有限公司 Method and device for constructing test data, computer equipment and storage medium
CN112199302A (en) * 2020-12-07 2021-01-08 望海康信(北京)科技股份公司 Test data generation method and system, corresponding equipment and storage medium
CN112834906A (en) * 2020-12-31 2021-05-25 杭州广立微电子股份有限公司 Test method for automatic matching

Similar Documents

Publication Publication Date Title
CN111078545A (en) Method and system for automatically generating test data
CN111191276B (en) Data desensitization method, device, storage medium and computer equipment
WO2010010992A1 (en) Bio information analysis process auto design system and thereof
US20100153918A1 (en) Compound versioning and identification scheme for composite application development
CN110674360B (en) Tracing method and system for data
CN110750433A (en) Interface test method and device
CN109614327B (en) Method and apparatus for outputting information
CN112433936A (en) Test method, test device and storage medium
CN116186286A (en) International logistics information recommendation method, system and medium based on enterprise knowledge graph
CN112001792B (en) Configuration information consistency detection method and device
CN113296785A (en) Document generation method, system, device and readable storage medium
CN112256689A (en) Service data cleaning method and device and electronic equipment
CN112732547A (en) Service testing method and device, storage medium and electronic equipment
CN112363923B (en) Testing method and device based on questionnaire system, computer equipment and medium
CN113379232B (en) Evaluation method, device, medium and equipment of power communication system
CN108920602B (en) Method and apparatus for outputting information
CN116028538A (en) Data checking method and system, electronic device and storage medium
CN115421771A (en) Micro-front-end system gray scale publishing method and device, computer equipment and medium
CN117725270A (en) Financial data processing query method, device, medium and computing equipment
CN115599376A (en) Method and device for determining programming interface, computer equipment and storage medium
CN114610619A (en) Method, device and equipment for testing business process and storage medium
CN113239695A (en) Named entity identification method and device, electronic equipment and storage medium
CN113408893A (en) Risk early warning method and device
CN116360751A (en) Method, device, equipment and medium for generating interface automation code
CN111353779A (en) Method, device, equipment and storage medium for determining abnormal service provider

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