CN108388515B - Test data generation method, device, equipment and computer readable storage medium - Google Patents
Test data generation method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN108388515B CN108388515B CN201810184287.6A CN201810184287A CN108388515B CN 108388515 B CN108388515 B CN 108388515B CN 201810184287 A CN201810184287 A CN 201810184287A CN 108388515 B CN108388515 B CN 108388515B
- Authority
- CN
- China
- Prior art keywords
- data
- html page
- preset
- input
- excel worksheet
- 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
Images
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)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a test data generation method, a test data generation device, test data generation equipment and a computer readable storage medium, wherein the method comprises the steps of generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data; creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values; importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page; generating a corresponding number making script in the output text box according to the table parameters in the HTML page; and calling and running the manufacture script to generate corresponding test data. The invention can generate more concise manufacture scripts and quickly and accurately generate corresponding test data, thereby improving the test efficiency in the project test process.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for generating test data.
Background
Hadoop is a software framework that enables distributed processing of large amounts of data. In the test process of the Hadoop project, a tester uses the Hive database to make data so as to provide test data for various test scenes, namely Job in Hadoop for data calculation and processing. In a specific test process, because the existing number-making script for generating test data is complex, testers can have the problems of difficulty in making the test data, long time consumption, inaccuracy of the made test data and the like, and the Hadoop project test process is directly influenced.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device and a computer-readable storage medium for generating test data, which can improve the speed and accuracy of generating test data, thereby improving the test efficiency in a project test process.
In one aspect, an embodiment of the present invention provides a test data generation method, where the method includes:
if an operation instruction for generating an HTML (HyperText Markup Language) page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data;
creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values;
importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page;
if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page;
and calling and running the manufacture script to generate corresponding test data.
On the other hand, an embodiment of the present invention further provides a test data generating apparatus, where the apparatus includes:
the generating unit is used for generating a corresponding HTML page if an operation instruction for generating the HTML page is received, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data;
the creating unit is used for creating an Excel worksheet matched with the HTML page, and the Excel worksheet comprises a plurality of preset data values;
the importing unit is used for importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page;
the processing unit is used for generating a corresponding number making script in the output text box according to the table parameters in the HTML page if a data analysis instruction is received;
and the running unit is used for calling and running the manufacture script to generate corresponding test data.
In another aspect, an embodiment of the present invention further provides a test data generating device, including:
a memory for storing a program for implementing test data generation; and
a processor for executing a program stored in the memory for implementing test data generation to perform the method as described above.
In yet another aspect, the present invention provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the method described above.
If an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data; creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values; importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page; if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page; calling and running the manufacture script to generate corresponding test data; the method and the device can generate a simpler and more complete number making script and can quickly and accurately generate corresponding test data through the number making script, thereby improving the test efficiency in the project test process.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram of a test data generation method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart diagram of a test data generation method according to another embodiment of the present invention;
FIG. 3 is a schematic flow chart diagram of a test data generation method according to another embodiment of the present invention;
FIG. 4 is a schematic flow chart diagram of a test data generation method according to another embodiment of the present invention;
FIG. 5 is a schematic block diagram of a test data generating apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic block diagram of a test data generating apparatus according to another embodiment of the present invention;
FIG. 7 is a schematic block diagram of a test data generating apparatus according to another embodiment of the present invention;
fig. 8 is a schematic block diagram of a test data generating apparatus according to another embodiment of the present invention;
fig. 9 is a schematic structural diagram of a test data generating device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
Referring to fig. 1, fig. 1 is a schematic flow chart of a test data generating method according to an embodiment of the present invention. The method can be operated in terminals such as smart phones (such as Android phones, IOS phones and the like), tablet computers, notebook computers, smart devices and the like. As shown in fig. 1, the method includes the following steps S101 to S105.
S101, if an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data.
In the embodiment of the present invention, when an operation instruction for generating an HTML page is received, an HTML page matched with the operation instruction is generated, specifically, a corresponding HTML file may be generated according to the operation instruction, and the HTML file is opened and displayed in a browser by starting the browser, so as to obtain the HTML page matched with the operation instruction. The HTML page may include a plurality of input boxes, where different form parameters are input in different input boxes, specifically, what is input in one input box is content corresponding to the same form parameter.
The table data is data values which should be input in the HTML page, and all the data values can be located in the input boxes corresponding to the table data. For example, when the table parameter includes table data, that is, the table data is one of the table parameters, the content input in the input box corresponding to the table data at this time is the corresponding data value, and the data value may be set accordingly.
S102, creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values.
In the embodiment of the present invention, in order to enable the input of the corresponding data value in the input box corresponding to the table data in the HTML page, an Excel worksheet matched with the HTML page needs to be created, and meanwhile, the Excel worksheet includes a plurality of preset data values, and the preset data values can be set correspondingly according to the requirements of the user, that is, the characteristics of all the preset data values all conform to the characteristics of the table data in the HTML page, so that all the preset data values are conveniently imported into the input box corresponding to the table data in the HTML page.
S103, importing the preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page.
In the embodiment of the present invention, the Excel worksheet is matched with the HTML page, so that the characteristics of the data values in the Excel worksheet are consistent with the characteristics of the data values to be input in the input box corresponding to the table data in the HTML page, and at this time, the data values preset in the Excel worksheet may be imported into the input box corresponding to the table data in the HTML page.
And S104, if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page.
In the embodiment of the present invention, when a data analysis instruction is received, a corresponding number script may be obtained according to a table parameter in the HTML page, for example, according to a data value input in an input box corresponding to table data in the HTML page, and the number script may be output in an output text box. Of course, in the embodiment of the present invention, the table parameter includes not only the table data, but also the table name, the table description information, and other parameters, and if the table parameter includes the above parameters, the generated corresponding manufacture script also includes the information related to the characteristics of the table name and the table description information, so as to generate more accurate test data quickly.
And S105, calling and running the manufacture script to generate corresponding test data.
In the embodiment of the invention, after the number making script is called, the number making script needs to be operated, and at the moment, the test data meeting the corresponding conditions can be generated according to the information included in the number making script.
As a further embodiment, the step S105 further comprises, before:
and S105, 105a, acquiring the manufacture number script to store correspondingly. In order to facilitate more reasonable application of the generated number script, the generated number script may be obtained and stored in a preset location. When the calling is needed, the calling can be carried out by finding the preset position, and then the corresponding test data can be obtained by running the called number making script.
In summary, the embodiment of the invention can generate a more concise and perfect-performance number making script, and meanwhile, the number making script can quickly and accurately generate corresponding test data, thereby improving the test efficiency in the project test process.
Referring to fig. 2, fig. 2 is a schematic flow chart of a test data generating method according to another embodiment of the invention. The method can be operated in terminals such as smart phones (such as Android phones, IOS phones and the like), tablet computers, notebook computers, smart devices and the like. As shown in fig. 2, the steps of the method include S201 to S205.
S201, if an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data.
S201a, the table parameters further include a table name, table description information, a table type, and a data operation type, and the preset table name, the preset table description information, the preset table type, and the preset data operation type are correspondingly input into the input boxes respectively corresponding to the table name, the table description information, the table type, and the data operation type.
The table names are known table names in the Hive database, so that test data generated by a subsequent test data generation tool after being called can meet the requirements of the Hive database in testing. The table description information may include field names, field types, and whether there are partitions, etc. The table type may include types of a table, a view and the like, the user may make a corresponding selection according to the needs of the user, and the data operation type may include an input operation or an overlay operation and the like.
In order to make the HTML page have more contents related to the test data, it is necessary to set a table parameter corresponding to each input box, for example, a preset indication may be correspondingly input in the input box corresponding to the table name, preset table description information may be correspondingly input in the input box corresponding to the table description information, a preset table type may be correspondingly input in the input box corresponding to the table type, and a preset data operation type may be correspondingly input in the input box corresponding to the data operation type.
S202, creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values.
S203, importing the preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page.
Further, as shown in fig. 3, the table description information of the Excel worksheet is matched with the table description information of the HTML page, the table description information includes a field name, a field type, and whether or not there is a partition, and the field name, the field type, and whether or not there is a partition are all located in the input box corresponding to the table description information.
In order to enable the information in the HTML page to be more matched with the information in the Excel worksheet, so as to generate a more accurate build script, at this time, the sheet description information of the Excel worksheet needs to be matched with the sheet description information of the HTML page. That is, the field name of the Excel worksheet is matched with the field name in the HTML page, the field type of the Excel worksheet is matched with the field type in the HTML page, whether the Excel worksheet has a partition or not is also matched with the field type in the HTML page, and the like.
The field name refers to the name of each column in a data table in the database, and each column in the data table is called a field. The field types mainly comprise character types, text types, numerical types, logic types, date types and the like, and different field types are used for storing different types of data. In addition, the partition is to divide a table data into a plurality of subsets, namely, to divide a data file into a plurality of data files, however, the storage of the files can depend on a file group or a plurality of file groups, because a plurality of file groups can improve the access concurrency of the database, different partitions can be configured into different disks for storage and processed by a plurality of CPUs, thereby improving the efficiency; after partitioning, the table is still an integral table, but the table data is stored in a plurality of positions in a hashed manner, so that whether partitioning exists can be judged according to the number of data values input into the input box corresponding to the table data, for example, when the number of data values input into the input box corresponding to the table data is greater than a preset value, corresponding partitioning can be performed according to a preset rule, and when the number of data values input into the input box corresponding to the table data is less than or equal to the preset value, partitioning is not performed.
In one embodiment, the step S203 may include the following steps S301 to S303.
S301, copying the Excel worksheet to obtain preset data values under all field names in the Excel worksheet, and determining whether the field types of the preset data values and the partitions are matched with the field types in the input box corresponding to the table description information in the HTML page and whether the partitions are matched with the field types in the input box corresponding to the table description information in the HTML page.
In the embodiment of the present invention, in order to enable the data values in the Excel worksheet to be accurately imported into the input boxes corresponding to the sheet data in the HTML page, each field name in the Excel worksheet corresponds to a column of data values, so that the Excel worksheet needs to be copied to obtain the preset data values under all field names in the Excel worksheet. Meanwhile, the field type of the preset data value and whether the partition is matched with the field type in the input box corresponding to the table description information in the HTML page, so that the data value imported into the HTML page can further accord with the set table description information in the HTML page, and the generated number making script for making the test data is faster and more accurate.
S302, all field names in the HTML page are set in an input box corresponding to the table data.
In the embodiment of the present invention, in order to accurately import the data value under each field name in the Excel worksheet into the corresponding input box, all the field names in the Excel worksheet need to be set in the input box corresponding to the sheet data in the HTML page.
And S303, correspondingly importing the preset data values under all the field names in the obtained Excel worksheet into the input box corresponding to the sheet data according to all the field names set in the input box corresponding to the sheet data in the HTML page.
In the embodiment of the invention, the input box corresponding to the table data in the HTML page is provided with the same field name as that in the Excel worksheet, that is, the data value under each field name is imported to the corresponding field name in the input box corresponding to the table data, so that all the data values set in the Excel worksheet are imported to the input box corresponding to the table data in the HTML page.
And S204, if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page.
In the embodiment of the invention, if a data analysis instruction is received, an HQL statement can be generated, that is, a corresponding number script is generated, where the number script may include test data for generating a condition that satisfies a limitation set in the number script, and the limitation may include a table name, table description information, table data, a table type, a data operation type, and the like, so that the test data satisfies a requirement in a Hive database test process, and the number script also performs corresponding output and saving through an output text box in an HTML page, so as to be called and run when needed subsequently.
Further, as shown in fig. 4, the step S204 specifically includes: steps S401 to S402.
S401, if a data analysis instruction is received, information in an input box corresponding to the form parameters in the HTML page is obtained.
In the embodiment of the present invention, when a data analysis instruction is received, information in an input box corresponding to indication, table description information, table data, a table type, a data operation type, and the like in the HTML page may be acquired.
S402, generating a corresponding number making script according to the information in the input box corresponding to the acquired form parameters in the HTML page.
In the embodiment of the present invention, the table name in the HTML page may be analyzed, so that when the generated number script is called to run, the table name of the generated data value may be consistent with the table name in the HTML page. Similarly, the table description information is analyzed, so that the characteristics of the generated data value, such as the field name, the field type, whether the partition is available and the like, can be consistent with the table description information in the HTML page when the generated number script is called to run. In addition, the table data is analyzed, namely the data content copied to the input box corresponding to the table data is analyzed, so that the generated data value can have the same characteristics and rules as the data content when the generated number script is called to run, and the requirement that a great amount of test data is needed by the Hive database is met.
Correspondingly, the table type and the data operation type in the HTML page may also be analyzed respectively, so that the table type and the data operation type of the generated data value are correspondingly consistent with the table type and the data operation type in the HTML page when the generated number script is called to run. Therefore, through the analysis and the processing, the test data generated by the manufactured script after being called completely accords with the characteristics required by the Hive database, and has better accuracy.
And S205a, acquiring the manufacture number script to be stored correspondingly.
And S205, calling and running the manufacture script to generate corresponding test data.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
Referring to fig. 5, in response to the above-mentioned test data generating method, an embodiment of the invention further provides a test data generating apparatus, where the apparatus 100 includes: a generating unit 101, a creating unit 102, an importing unit 103, a processing unit 104, and an executing unit 105.
The generating unit 101 is configured to generate a corresponding HTML page if an operation instruction for generating the HTML page is received, where the HTML page includes a plurality of input boxes and an output text box, where different input boxes are used to correspondingly input different form parameters, and the form parameters at least include form data.
In the embodiment of the invention, when an operation instruction for generating the HTML page is received, the HTML page matched with the operation instruction is generated. The HTML page may include a plurality of input boxes, where different form parameters are input in different input boxes, specifically, what is input in one input box is content corresponding to the same form parameter.
The table data is data values which should be input in the HTML page, and all the data values can be located in the input boxes corresponding to the table data. For example, when the table parameter includes table data, that is, the table data is one of the table parameters, the content input in the input box corresponding to the table data at this time is the corresponding data value, and the data value may be set accordingly.
The creating unit 102 is configured to create an Excel worksheet matched with the HTML page, where the Excel worksheet includes a plurality of preset data values.
In the embodiment of the present invention, in order to enable the input of the corresponding data value in the input box corresponding to the table data in the HTML page, an Excel worksheet matched with the HTML page needs to be created, and meanwhile, the Excel worksheet includes a plurality of preset data values, and the preset data values can be set correspondingly according to the requirements of the user, that is, the characteristics of all the preset data values all conform to the characteristics of the table data in the HTML page, so that all the preset data values are conveniently imported into the input box corresponding to the table data in the HTML page.
The importing unit 103 is configured to import a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page.
In the embodiment of the present invention, the Excel worksheet is matched with the HTML page, so that the characteristics of the data values in the Excel worksheet are consistent with the characteristics of the data values to be input in the input box corresponding to the table data in the HTML page, and at this time, the data values preset in the Excel worksheet may be imported into the input box corresponding to the table data in the HTML page.
The processing unit 104 is configured to generate a corresponding number script in the output text box according to the table parameter in the HTML page if the data analysis instruction is received.
In the embodiment of the present invention, when a data analysis instruction is received, a corresponding number script may be obtained according to a table parameter in the HTML page, for example, according to a data value input in an input box corresponding to table data in the HTML page, and the number script may be output in an output text box. Of course, in the embodiment of the present invention, the table parameter includes not only the table data, but also the table name, the table description information, and other parameters, and if the table parameter includes the above parameters, the generated corresponding manufacture script also includes the information related to the characteristics of the table name and the table description information, so as to generate more accurate test data quickly.
The running unit 105 is configured to invoke and run the manufacture script to generate corresponding test data.
In the embodiment of the invention, after the number making script is called, the number making script needs to be operated, and at the moment, the test data meeting the corresponding conditions can be generated according to the information included in the number making script.
As a further embodiment, the apparatus 100 further comprises:
the storage unit 105a is used for acquiring the manufacture script to perform corresponding storage. In order to facilitate more reasonable application of the generated number script, the generated number script may be obtained and stored in a preset location. When the calling is needed, the calling can be carried out by finding the preset position, and then the corresponding test data can be obtained by running the called number making script.
In summary, the embodiment of the invention can generate a more concise and perfect-performance number making script, and meanwhile, the number making script can quickly and accurately generate corresponding test data, thereby improving the test efficiency in the project test process.
As can be seen from the above, in terms of hardware implementation, the above generating unit 101, creating unit 102, importing unit 103, processing unit 104, and running unit 105 may be embedded in a hardware form or in a device independent of test data generation, or may be stored in a memory of the test data generation device in a software form, so that a processor calls and executes operations corresponding to the above units. The processor can be a Central Processing Unit (CPU), a microprocessor, a singlechip and the like.
Referring to fig. 6, in response to the above-mentioned test data generating method, another embodiment of the present invention further provides a test data generating apparatus, where the apparatus 200 includes: a generation unit 201, an input unit 201a, a creation unit 202, an import unit 203, a processing unit 204, and an execution unit 205.
The generating unit 201 is configured to generate a corresponding HTML page if an operation instruction for generating the HTML page is received, where the HTML page includes a plurality of input boxes and an output text box, where different input boxes are used to correspondingly input different form parameters, and the form parameters at least include form data.
An input unit 201a, configured to correspondingly input a preset table name, preset table description information, a preset table type, and a preset data operation type into input boxes respectively corresponding to the table name, the table description information, the table type, and the data operation type.
The table names are known table names in the Hive database, so that test data generated by a subsequent test data generation tool after being called can meet the requirements of the Hive database in testing. The table description information may include field names, field types, and whether there are partitions, etc. The table type may include types of a table, a view and the like, the user may make a corresponding selection according to the needs of the user, and the data operation type may include an input operation or an overlay operation and the like.
In order to make the HTML page have more contents related to the test data, it is necessary to set a table parameter corresponding to each input box, for example, a preset indication may be correspondingly input in the input box corresponding to the table name, preset table description information may be correspondingly input in the input box corresponding to the table description information, a preset table type may be correspondingly input in the input box corresponding to the table type, and a preset data operation type may be correspondingly input in the input box corresponding to the data operation type.
The creating unit 202 is configured to create an Excel worksheet matched with the HTML page, where the Excel worksheet includes a plurality of preset data values.
The importing unit 203 is configured to import the preset data value in the Excel worksheet into the input box corresponding to the sheet data in the HTML page.
Further, as shown in fig. 7, the table description information of the Excel worksheet is matched with the table description information of the HTML page, the table description information includes a field name, a field type, and whether or not there is a partition, and the field name, the field type, and whether or not there is a partition are all located in the input box corresponding to the table description information.
In order to enable the information in the HTML page to be more matched with the information in the Excel worksheet, so as to generate a more accurate build script, at this time, the sheet description information of the Excel worksheet needs to be matched with the sheet description information of the HTML page. That is, the field name of the Excel worksheet is matched with the field name in the HTML page, the field type of the Excel worksheet is matched with the field type in the HTML page, whether the Excel worksheet has a partition or not is also matched with the field type in the HTML page, and the like.
The field name refers to the name of each column in a data table in the database, and each column in the data table is called a field. The field types mainly comprise character types, text types, numerical types, logic types, date types and the like, and different field types are used for storing different types of data. In addition, the partition is to divide a table data into a plurality of subsets, namely, to divide a data file into a plurality of data files, however, the storage of the files can depend on a file group or a plurality of file groups, because a plurality of file groups can improve the access concurrency of the database, different partitions can be configured into different disks for storage and processed by a plurality of CPUs, thereby improving the efficiency; after partitioning, the table is still an integral table, but the table data is stored in a plurality of positions in a hashed manner, so that whether partitioning exists can be judged according to the number of data values input into the input box corresponding to the table data, for example, when the number of data values input into the input box corresponding to the table data is greater than a preset value, corresponding partitioning can be performed according to a preset rule, and when the number of data values input into the input box corresponding to the table data is less than or equal to the preset value, partitioning is not performed.
Specifically, the importing unit 203 specifically includes: an acquisition unit 301, a setting unit 302, and an adjustment unit 303.
The obtaining unit 301 is configured to copy the Excel worksheet to obtain preset data values under all field names in the Excel worksheet, where a field type and whether a partition of the preset data values matches a field type and whether a partition of an input box corresponding to the table description information in the HTML page.
In the embodiment of the present invention, in order to enable the data values in the Excel worksheet to be accurately imported into the input boxes corresponding to the sheet data in the HTML page, each field name in the Excel worksheet corresponds to a column of data values, so that the Excel worksheet needs to be copied to obtain the preset data values under all field names in the Excel worksheet. Meanwhile, the field type of the preset data value and whether the partition is matched with the field type in the input box corresponding to the table description information in the HTML page, so that the data value imported into the HTML page can further accord with the set table description information in the HTML page, and the generated number making script for making the test data is faster and more accurate.
The setting unit 302 is configured to set all field names in the HTML page in an input box corresponding to the table data.
In the embodiment of the present invention, in order to accurately import the data value under each field name in the Excel worksheet into the corresponding input box, all the field names in the Excel worksheet need to be set in the input box corresponding to the sheet data in the HTML page.
The adjusting unit 303 is configured to correspondingly import the preset data values under all the field names in the obtained Excel worksheet into the input box corresponding to the table data according to all the field names set in the input box corresponding to the table data in the HTML page.
In the embodiment of the invention, the input box corresponding to the table data in the HTML page is provided with the same field name as that in the Excel worksheet, that is, the data value under each field name is imported to the corresponding field name in the input box corresponding to the table data, so that all the data values set in the Excel worksheet are imported to the input box corresponding to the table data in the HTML page.
The processing unit 204 is configured to generate a corresponding number script in the output text box according to the table parameter in the HTML page if the data analysis instruction is received.
Further, as shown in fig. 8, the processing unit 204 specifically includes: a receiving unit 401 and a determining unit 402.
The receiving unit 401 is configured to, if a data analysis instruction is received, obtain information in an input box corresponding to a form parameter in the HTML page.
In the embodiment of the present invention, when a data analysis instruction is received, information in an input box corresponding to indication, table description information, table data, a table type, a data operation type, and the like in the HTML page may be acquired.
The determining unit 402 is configured to generate a corresponding manufacture script according to the information in the input box corresponding to the table parameter in the obtained HTML page.
In the embodiment of the present invention, the table name in the HTML page may be analyzed, so that when the generated number script is called to run, the table name of the generated data value may be consistent with the table name in the HTML page. Similarly, the table description information is analyzed, so that the characteristics of the generated data value, such as the field name, the field type, whether the partition is available and the like, can be consistent with the table description information in the HTML page when the generated number script is called to run. In addition, the table data is analyzed, namely the data content copied to the input box corresponding to the table data is analyzed, so that the generated data value can have the same characteristics and rules as the data content when the generated number script is called to run, and the requirement that a great amount of test data is needed by the Hive database is met.
Correspondingly, the table type and the data operation type in the HTML page may also be analyzed respectively, so that the table type and the data operation type of the generated data value are correspondingly consistent with the table type and the data operation type in the HTML page when the generated number script is called to run. Therefore, through the analysis and the processing, the test data generated by the manufactured script after being called completely accords with the characteristics required by the Hive database, and has better accuracy.
The execution unit 205 is configured to invoke and execute the manufacture script to generate corresponding test data.
As a further embodiment, the apparatus 200 further comprises:
the storage unit 205a is configured to obtain the manufacture script for corresponding storage.
The above-described test data generation apparatus may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 9.
Fig. 9 is a schematic structural diagram of a test data generating apparatus according to the present invention. The device can be a terminal or a server, wherein the terminal can be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device. The server may be an independent server or a server cluster composed of a plurality of servers. Referring to fig. 9, the computer apparatus 500 includes a processor 502, a nonvolatile storage medium 503, an internal memory 504, and a network interface 505, which are connected by a system bus 501. The non-volatile storage medium 503 of the computer device 500 may store, among other things, an operating system 5031 and a computer program 5032, which, when executed, may cause the processor 502 to perform a test data generation method. The processor 502 of the computer device 500 is used to provide computing and control capabilities that support the overall operation of the computer device 500. The internal memory 504 provides an environment for running a computer program in a non-volatile storage medium, which when executed by the processor, causes the processor 502 to perform a method of test data generation. The network interface 505 of the computer device 500 is used for network communication such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 performs the following operations: if an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data; creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values; importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page; if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page; and calling and running the manufacture script to generate corresponding test data.
The processor 502 also performs the following operations: and correspondingly inputting the preset table name, the preset table description information, the preset table type and the preset data operation type into input frames respectively corresponding to the table name, the table description information, the table type and the data operation type.
When the processor 502 executes the step of importing the preset data value in the Excel worksheet into the input box corresponding to the sheet data in the HTML page, the following operations are specifically executed: copying the Excel worksheet to obtain preset data values under all field names in the Excel worksheet; setting all field names in the HTML page in an input box corresponding to the table data; and correspondingly importing the preset data values under all the field names in the obtained Excel worksheet into the input box corresponding to the table data according to all the field names set in the input box corresponding to the table data in the HTML page.
When the processor 502 executes the step of generating the corresponding number script in the output text box according to the table parameter in the HTML page if the data analysis instruction is received, the following operations are specifically executed: if a data analysis instruction is received, acquiring information in an input box corresponding to form parameters in the HTML page; and generating a corresponding number making script according to the information in the input box corresponding to the acquired form parameters in the HTML page.
The processor 502 also performs the following operations: and acquiring the manufacture number script to carry out corresponding storage.
Those skilled in the art will appreciate that the embodiment of the test data generation apparatus shown in fig. 9 does not constitute a limitation on the specific construction of the test data generation apparatus, and in other embodiments the test data generation apparatus may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the test data generating device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 9, and are not described herein again.
The present invention provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of:
if an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data; creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values; importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page; if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page; and calling and running the manufacture script to generate corresponding test data.
The processor further implements the steps of: and correspondingly inputting the preset table name, the preset table description information, the preset table type and the preset data operation type into input frames respectively corresponding to the table name, the table description information, the table type and the data operation type.
The processor further implements the steps of: copying the Excel worksheet to obtain preset data values under all field names in the Excel worksheet; setting all field names in the HTML page in an input box corresponding to the table data; and correspondingly importing the preset data values under all the field names in the obtained Excel worksheet into the input box corresponding to the table data according to all the field names set in the input box corresponding to the table data in the HTML page.
The processor further implements the steps of: if a data analysis instruction is received, acquiring information in an input box corresponding to form parameters in the HTML page; and generating a corresponding number making script according to the information in the input box corresponding to the acquired form parameters in the HTML page.
The processor further implements the steps of: and acquiring the manufacture number script to carry out corresponding storage.
The foregoing storage medium of the present invention includes: various media that can store program codes, such as a magnetic disk, an optical disk, and a Read-Only Memory (ROM).
The elements of all embodiments of the present invention may be implemented by a general purpose integrated circuit, such as a CPU (central processing Unit), or by an ASIC (Application Specific integrated circuit).
The steps in the test data generation method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The units in the test data generation terminal of the embodiment of the invention can be merged, divided and deleted according to actual needs.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A method of test data generation, the method comprising:
if an operation instruction for generating an HTML page is received, generating a corresponding HTML page, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data;
creating an Excel worksheet matched with the HTML page, wherein the Excel worksheet comprises a plurality of preset data values;
importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page;
if a data analysis instruction is received, generating a corresponding number making script in the output text box according to the table parameters in the HTML page;
and calling and running the manufacture script to generate corresponding test data.
2. The method of claim 1, wherein the form parameters further include a form name, form description information, form type, and data manipulation type, and wherein creating an Excel worksheet matching the HTML page further comprises:
and correspondingly inputting the preset table name, the preset table description information, the preset table type and the preset data operation type into input frames respectively corresponding to the table name, the table description information, the table type and the data operation type.
3. The method according to claim 2, wherein the table description information of the Excel worksheet is matched with the table description information of the HTML page, the table description information includes a field name, a field type and whether or not there is a partition, and the field name, the field type and whether or not there is a partition are all located in the input box corresponding to the table description information, and the importing the preset data value in the Excel worksheet into the input box corresponding to the table data in the HTML page includes:
copying the Excel worksheet to obtain preset data values under all field names in the Excel worksheet, and judging whether the field types of the preset data values and the partitions are matched with the field types in the input box corresponding to the table description information in the HTML page or not;
setting all field names in the HTML page in an input box corresponding to the table data;
and correspondingly importing the preset data values under all the field names in the obtained Excel worksheet into the input box corresponding to the table data according to all the field names set in the input box corresponding to the table data in the HTML page.
4. The method of claim 2, wherein the generating a corresponding number script in the output text box according to the form parameters in the HTML page if the data analysis command is received comprises:
if a data analysis instruction is received, acquiring information in an input box corresponding to form parameters in the HTML page;
and generating a corresponding number making script in the output text box according to the information in the input box corresponding to the table parameters in the HTML page.
5. The method of claim 1, wherein after generating the corresponding number script in the output text box according to the form parameters in the HTML page, further comprising:
and acquiring the manufacture number script to carry out corresponding storage.
6. A test data generation apparatus, characterized in that the apparatus comprises:
the generating unit is used for generating a corresponding HTML page if an operation instruction for generating the HTML page is received, wherein the HTML page comprises a plurality of input boxes and an output text box, different input boxes are used for correspondingly inputting different form parameters, and the form parameters at least comprise form data;
the creating unit is used for creating an Excel worksheet matched with the HTML page, and the Excel worksheet comprises a plurality of preset data values;
the importing unit is used for importing a preset data value in the Excel worksheet into an input box corresponding to the sheet data in the HTML page;
the processing unit is used for generating a corresponding number making script in the output text box according to the table parameters in the HTML page if a data analysis instruction is received;
and the running unit is used for calling and running the manufacture script to generate corresponding test data.
7. The apparatus of claim 6, wherein the table parameters further include a table name, table description information, a table type, and a data operation type, the apparatus further comprising:
and the input unit is used for correspondingly inputting the preset table name, the preset table description information, the preset table type and the preset data operation type into the input frames respectively corresponding to the table name, the table description information, the table type and the data operation type.
8. The apparatus according to claim 7, wherein the table description information of the Excel worksheet is matched with the table description information of the HTML page, the table description information includes a field name, a field type and whether or not there is a partition, and the field name, the field type and whether or not there is a partition are all located in the input box corresponding to the table description information, and the importing unit includes:
the acquisition unit is used for copying the Excel worksheet to acquire preset data values under all field names in the Excel worksheet, and whether the field types of the preset data values and the partitions are matched with the field types in the input frame corresponding to the table description information in the HTML page or not;
the setting unit is used for setting all field names in the HTML page in an input box corresponding to the table data;
and the adjusting unit is used for correspondingly importing the acquired preset data values under all the field names in the Excel worksheet into the input box corresponding to the sheet data according to all the field names set in the input box corresponding to the sheet data in the HTML page.
9. A test data generation device, characterized by comprising:
a memory for storing a program for implementing test data generation; and
a processor for executing a program stored in the memory for implementing test data generation to perform the method of any one of claims 1-5.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, the one or more programs being executable by one or more processors to implement the method of any one of claims 1-5.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810184287.6A CN108388515B (en) | 2018-03-06 | 2018-03-06 | Test data generation method, device, equipment and computer readable storage medium |
PCT/CN2018/085264 WO2019169725A1 (en) | 2018-03-06 | 2018-05-02 | Test data generation method, device, and apparatus, and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810184287.6A CN108388515B (en) | 2018-03-06 | 2018-03-06 | Test data generation method, device, equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108388515A CN108388515A (en) | 2018-08-10 |
CN108388515B true CN108388515B (en) | 2020-09-29 |
Family
ID=63066588
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810184287.6A Active CN108388515B (en) | 2018-03-06 | 2018-03-06 | Test data generation method, device, equipment and computer readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108388515B (en) |
WO (1) | WO2019169725A1 (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109189675A (en) * | 2018-08-20 | 2019-01-11 | 中国平安人寿保险股份有限公司 | Big data Framework Software test method, device, computer equipment and storage medium |
CN109828900A (en) * | 2018-12-14 | 2019-05-31 | 深圳壹账通智能科技有限公司 | Test script automatic generation method, device, electronic equipment and storage medium |
CN110134928A (en) * | 2019-03-08 | 2019-08-16 | 北京车和家信息技术有限公司 | Form processing method and electronic equipment based on signal creation Signal Builder |
CN110119353B (en) * | 2019-04-18 | 2023-10-10 | 上海蔚来汽车有限公司 | Test data generation method and device, controller and medium |
CN110221967A (en) * | 2019-05-20 | 2019-09-10 | 深圳壹账通智能科技有限公司 | Test data building method, device, computer equipment and storage medium |
CN110362479B (en) * | 2019-06-19 | 2023-07-14 | 平安科技(深圳)有限公司 | System upgrade test method and system |
CN110457300B (en) * | 2019-07-15 | 2024-02-02 | 中国平安人寿保险股份有限公司 | Method and device for cleaning public test library and electronic equipment |
CN110727576B (en) * | 2019-08-22 | 2024-04-26 | 中国平安财产保险股份有限公司 | Web page testing method, device, equipment and storage medium |
CN110968514A (en) * | 2019-12-02 | 2020-04-07 | 北京明略软件***有限公司 | Test method, test device, electronic equipment and storage medium |
CN112835803B (en) * | 2021-02-23 | 2024-02-23 | 北京联创信安科技股份有限公司 | Tool generation method, test data construction method, device, equipment and medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6620204B1 (en) * | 1997-11-25 | 2003-09-16 | International Business Machines Corporation | Automated HTML test page and test data generation for javascript objects |
CN103324731A (en) * | 2013-06-28 | 2013-09-25 | 中国农业银行股份有限公司 | Method and device for converting spreadsheet file into web format file |
US20160283353A1 (en) * | 2015-03-23 | 2016-09-29 | Tryon Solutions, Inc. | Automated software testing |
CN107341109B (en) * | 2017-07-07 | 2021-07-16 | 中国银行股份有限公司 | Test data generation method and system |
CN107704393B (en) * | 2017-09-29 | 2018-08-21 | 武汉斗鱼网络科技有限公司 | Data test method, apparatus and electronic equipment |
-
2018
- 2018-03-06 CN CN201810184287.6A patent/CN108388515B/en active Active
- 2018-05-02 WO PCT/CN2018/085264 patent/WO2019169725A1/en active Application Filing
Non-Patent Citations (1)
Title |
---|
QTP在国家科技计划预算管理***测试中的应用;符瑞秋;《信息安全与技术》;20150410;第4节,图3 * |
Also Published As
Publication number | Publication date |
---|---|
WO2019169725A1 (en) | 2019-09-12 |
CN108388515A (en) | 2018-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108388515B (en) | Test data generation method, device, equipment and computer readable storage medium | |
CN108304498B (en) | Webpage data acquisition method and device, computer equipment and storage medium | |
CN108459964B (en) | Test case selection method, device, equipment and computer readable storage medium | |
CN108536745B (en) | Shell-based data table extraction method, terminal, equipment and storage medium | |
KR102133906B1 (en) | Data analysis and processing methods, devices, computer devices and storage media | |
CN108415998B (en) | Application dependency relationship updating method, terminal, device and storage medium | |
CN110580189A (en) | method and device for generating front-end page, computer equipment and storage medium | |
CN110955409B (en) | Method and device for creating resources on cloud platform | |
CN108776587B (en) | Data acquisition method and device, computer equipment and storage medium | |
CN109657177A (en) | The generation method of the page, device, storage medium and computer equipment after upgrading | |
CN110727429B (en) | Front-end page generation method, device and equipment | |
CN109614325B (en) | Method and device for determining control attribute, electronic equipment and storage medium | |
CN110941427A (en) | Code generation method and code generator | |
CN111797026A (en) | Test case generation method and device, computer equipment and storage medium | |
CN112988298A (en) | Visual interface configuration method and device, computer equipment and storage medium | |
CN115599359A (en) | Code generation method, device, equipment and medium | |
CN110362630B (en) | Data management method, device, equipment and computer readable storage medium | |
CN113626468B (en) | SQL sentence generation method, device and equipment based on artificial intelligence and storage medium | |
CN113296752A (en) | Method, system, device and storage medium for generating API document | |
EP3425510B1 (en) | Automated testing method for application program user interface, electronic device, system, and storage medium | |
CN115033436A (en) | Page testing method and device, electronic equipment and storage medium | |
CN113010550B (en) | Batch object generation and batch processing method and device for structured data | |
WO2022099913A1 (en) | Interface configuration method and apparatus, and device and medium | |
CN114356330A (en) | Page configuration method and device, electronic equipment and storage medium | |
CN109783134B (en) | Front-end page configuration method and device and electronic equipment |
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 |