CN114721967A - Test file generation method, device, equipment, storage medium and program product - Google Patents

Test file generation method, device, equipment, storage medium and program product Download PDF

Info

Publication number
CN114721967A
CN114721967A CN202210546574.3A CN202210546574A CN114721967A CN 114721967 A CN114721967 A CN 114721967A CN 202210546574 A CN202210546574 A CN 202210546574A CN 114721967 A CN114721967 A CN 114721967A
Authority
CN
China
Prior art keywords
information
data
file
test
determining
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
CN202210546574.3A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210546574.3A priority Critical patent/CN114721967A/en
Publication of CN114721967A publication Critical patent/CN114721967A/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

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 disclosure provides a test file generation method, which can be applied to the financial field. The method comprises the following steps: acquiring file interface information and historical file data; determining data characteristic information according to the file interface information and the historical file data; determining condition information according to the test requirement information; and generating a test file according to the condition information and the data characteristic information. The present disclosure also provides a test file generation apparatus, a device, a storage medium, and a program product.

Description

Test file generation method, device, equipment, storage medium and program product
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of software testing, and more particularly, to a method, an apparatus, a device, a storage medium, and a program product for generating a test file.
Background
In the testing process with each client and system, the file is a common data transmission mode, and the opposite end is often required to generate and send the file meeting the requirement to the local side for processing and verification in the aspects of flow optimization, routine verification and the like. At present, the acquisition ways of the test files mainly include two types: firstly, batch files are uniformly acquired by a centralized platform; and secondly, contacting an upstream opposite end, and transmitting through a related link or providing by direct mails. Both of the two approaches for acquiring the test file have certain problems, namely the long acquisition time of the test file affects the test progress, for example, the batch date interval time is long, and the file generation cycle span is large. In the latter, because the communication between the two environments in the test environment is slow, or the data provided by the file at the opposite end is unavailable, the test progress is easily influenced by the opposite end, and the test efficiency is low.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
In view of the above, the present disclosure provides a test file generation method, apparatus, device, medium, and program product.
According to a first aspect of the present disclosure, there is provided a test file generation method, including:
acquiring file interface information and historical file data, wherein the file interface information comprises field attribute information of a test file to be generated, and the historical file data comprises structural data of the test file to be generated;
determining data characteristic information according to the file interface information and the historical file data, wherein the data characteristic information is used for representing field attributes of the test file to be generated and a test file synthesis splicing mode;
determining condition information according to the test requirement information, wherein the condition information is used for representing a data range for generating the test file; and
and generating a test file according to the condition information and the data characteristic information.
According to an embodiment of the present disclosure, the determining data characteristic information according to the file interface information and the historical file data includes:
determining data structure information and first field attribute information according to the file interface information;
determining second field attribute information according to the first field attribute information and the historical file data; and
and determining the data characteristic information according to the data structure information and the second field attribute information.
According to an embodiment of the present disclosure, the test requirement information includes normal file synthesis requirement information and abnormal point requirement information, and the determining condition information according to the test requirement information includes:
acquiring normal file synthesis demand information and abnormal point demand information;
determining first condition information according to the normal file synthesis demand information; and
and determining second condition information according to the abnormal point demand information.
According to an embodiment of the present disclosure, the test files include a normal test file and an abnormal test file, and the generating the test files according to the condition information and the data feature information includes:
determining a data basic range according to the data characteristic information;
determining target data to be synthesized according to the first condition information and the data basic range;
generating a normal test file according to the target data to be synthesized and the data structure information; and
and generating an abnormal test file according to the second condition information, the target data to be synthesized and the data structure information.
According to an embodiment of the present disclosure, the generating an exception test file according to the second condition information, the target data to be synthesized, and the data structure information includes:
determining at least one abnormal point information according to the second condition information;
adjusting the target data to be synthesized according to the at least one abnormal point information to generate at least one group of second target data to be synthesized; and
and generating at least one abnormal test file according to the at least one group of second target data to be synthesized and the data structure information.
According to an embodiment of the present disclosure, the abnormal point information includes core data missing, character length error, and data serialization.
According to an embodiment of the present disclosure, the data feature information includes field attribute features, character features, and padding logic.
A second aspect of the present disclosure provides a test file generating apparatus, including: the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring file interface information and historical file data, the file interface information comprises field attribute information of a test file to be generated, and the historical file data comprises structural data of the test file to be generated;
the data characteristic determining module is used for determining data characteristic information according to the file interface information and the historical file data, wherein the data characteristic information is used for representing the field attribute of the test file to be generated and the synthesis and splicing mode of the test file;
the test requirement determining module is used for determining condition information according to the test requirement information, wherein the condition information is used for representing a data range for generating the test file; and
and the test file generation module is used for generating a test file according to the condition information and the data characteristic information.
According to an embodiment of the present disclosure, the data feature determination module includes:
the first determining submodule is used for determining data structure information and first field attribute information according to the file interface information;
the second determining submodule is used for determining second field attribute information according to the first field attribute information and the historical file data; and
and the third determining submodule is used for determining the data characteristic information according to the data structure information and the second field attribute information.
According to an embodiment of the present disclosure, a test requirement determining module includes:
the acquisition submodule is used for acquiring the synthesis demand information of the normal file and the demand information of the abnormal point;
the fourth determining submodule is used for determining first condition information according to the normal file synthesis demand information; and
and the fifth determining submodule is used for determining second condition information according to the abnormal point demand information.
According to an embodiment of the present disclosure, the test file generation module includes:
a sixth determining submodule, configured to determine a data basis range according to the data feature information;
a seventh determining submodule, configured to determine target data to be synthesized according to the first condition information and the data base range;
the first generation submodule is used for generating a normal test file according to the target data to be synthesized and the data structure information; and
and the second generation submodule is used for generating an abnormal test file according to the second condition information, the target data to be synthesized and the data structure information.
According to an embodiment of the present disclosure, the second generation submodule includes:
a first determining unit, configured to determine at least one abnormal point information according to the second condition information;
the first generating unit is used for adjusting the target data to be synthesized according to the at least one abnormal point information so as to generate at least one group of second target data to be synthesized; and
and the second generating unit is used for generating at least one abnormal test file according to the at least one group of second target data to be synthesized and the data structure information.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the test file generation method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described test file generation method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the test file generation method described above.
According to the test file generation method provided by the embodiment of the disclosure, the data characteristic information is determined according to the file interface information and the historical file data, and the test file is generated according to the received test requirement information and the data characteristic information, so that the weak dependence on the opposite end environment of the file test is realized, and the file test verification coverage and the test efficiency are improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a test file generation method, apparatus, device, medium and program product according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a test file generation method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow chart of a data characteristic information generation method according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart for determining condition information from test requirement information according to an embodiment of the disclosure;
FIG. 5a schematically illustrates one of the flow charts for generating a test file from condition information and data characteristic information according to an embodiment of the present disclosure;
FIG. 5b schematically shows a second flowchart for generating a test file according to the condition information and the data characteristic information according to the embodiment of the disclosure;
fig. 6 schematically shows a block diagram of the structure of a test file generating apparatus according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a block diagram of a data feature determination module according to an embodiment of the disclosure;
FIG. 8 schematically illustrates a block diagram of a test requirements determination module according to an embodiment of the present disclosure;
FIG. 9 schematically shows a block diagram of a test file generation module according to an embodiment of the present disclosure; and
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a test file generation method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Currently there are two main types of test files: firstly, batch files are uniformly acquired by a centralized platform; and the other is to contact the upstream opposite end and transmit the file provided by the related link or direct mail. This method of obtaining a test file often has the following problems:
firstly, the file acquisition time is long, and the test progress is influenced: if the batch date interval time is long, the file generation cycle span is large; the link communication with the opposite end environment is not smooth, the opposite end system version does not correspond, and the system fails.
Secondly, the data availability is poor, which affects the subsequent processing: for example, an account in a payment file has a difference in data bases between the two parties, and the provided account is invalid, so that payment processing cannot be performed.
Thirdly, the simulation of abnormal scenes in special scenes is inefficient: when abnormal scenes such as key field missing, field overlong, dislocation and data errors (errors corresponding to the summary and the detail) need to be simulated; special scenes such as empty files, special values (amount size), boundary values, special characters. The files need to be manually modified, when the number of the related fields of the files is too large, the number of the related fields of the files is increased, manual adjustment is prone to errors, and verification of related abnormal points is affected.
Based on the foregoing technical problem, an embodiment of the present disclosure provides a test file generation method, including: acquiring file interface information and historical file data; determining data characteristic information according to the file interface information and the historical file data; determining condition information according to the test requirement information; and generating a test file according to the condition information and the data characteristic information.
Fig. 1 schematically illustrates an application scenario diagram of a test file generation method, apparatus, device, medium, and program product according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a test file generation scenario. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, such as a test file generation server (for example only) that provides support for test requirement information uploaded by users using the terminal devices 101, 102, 103. The test file generation server can analyze and process the received data such as the user request and feed back the generated test file to the terminal equipment.
It should be noted that the test file generation method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the test file generation apparatus provided by the embodiment of the present disclosure may be generally disposed in the server 105. The test file generation method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the test file generating apparatus provided in the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that the test file generation method and apparatus determined in the embodiment of the present disclosure may be applied to the software testing field in the financial field, and may also be applied to any field other than the financial field.
The test file generation method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 6 based on the scenario described in fig. 1.
Fig. 2 schematically shows a flow chart of a test file generation method according to an embodiment of the present disclosure. As shown in fig. 2, the test file generation method of this embodiment includes operations S210 to S240, and the method may be executed by a server or other computing device.
In operation S210, file interface information and history file data are acquired.
According to the embodiment of the disclosure, the file interface information includes field attribute information of the test file to be generated, and the history file data includes structure data of the test file to be generated.
In operation S220, data characteristic information is determined according to the file interface information and the history file data.
According to the embodiment of the disclosure, the data characteristic information is used for representing the field attribute of the test file to be generated and the synthesis and splicing mode of the test file.
According to an embodiment of the present disclosure, the data characteristic information includes field attribute characteristics, character characteristics, and bit padding logic.
In one example, in order to get rid of the dependence on the upstream peer test file in the joint test process, the test file may be generated by the method provided in the embodiment of the present disclosure. First, file interface information and historical file data are obtained from a database, wherein the file interface information can be interface document information containing file interface parameters, and the historical file data can be historical test file data. Determining data characteristic information of a file to be tested according to file structure information and historical file data, wherein the data characteristic information comprises field attribute characteristics, character characteristics and bit complement logic of the file to be tested, the field types can be further determined according to the field attribute characteristics and the character characteristics, the field types comprise numbers, codes, numerical values (integer, floating point and precision), texts, dates, time and big texts, for example, the current field is determined to belong to the number, the current field is determined to be the code, the current field is determined to be the floating point numerical value, and the current field is determined to be the date; and simultaneously determining other attributes of the field, such as whether the field can be empty, whether the field can be repeated and a field splicing mode, and determining whether the bit complementing mode of the field is left complementing or right complementing and whether conversion is needed according to the bit complementing logic. The specific determination process of the data characteristic information can be seen in operations S221 to S223 shown in fig. 3.
In operation S230, condition information is determined according to the test requirement information.
According to an embodiment of the present disclosure, the condition information is used to characterize a data range in which the test file is generated.
According to the embodiment of the disclosure, the test requirement information includes normal file synthesis requirement information and abnormal point requirement information.
In one example, the test requirement information is a test requirement uploaded by a tester, and includes normal file synthesis requirement information and abnormal point requirement information, the normal file synthesis requirement information is a data requirement for synthesizing the test file, and specifically includes data volume, valid data, to-be-verified data and error data, and the abnormal point requirement information includes a test special value, field missing, field misplacement, special characters, and the like. And determining condition information according to the test requirement information, and determining a specific test data range according to the condition information. The determination method of the condition information may be referred to as operations S231 to S233 shown in fig. 4.
In operation S240, a test file is generated according to the condition information and the data characteristic information.
According to an embodiment of the present disclosure, the test files include a normal test file and an abnormal test file.
In one example, the test file is synthesized according to the data characteristic information determined in operation S220 and the condition information determined in operation S230, and the test file includes a normal test file and an abnormal test file, and the abnormal test file is a special scenario test file generated by simulating an abnormal scenario and used for testing the performance of the system or the service in the special scenario. The process of generating the normal test file can be referred to as operations S241 to S244 shown in fig. 5a, and the process of generating the abnormal test file can be referred to as operations S2441 to S2443 shown in fig. 5 b.
According to the test file generation method provided by the embodiment of the disclosure, the data characteristic information is determined according to the file interface information and the historical file data, and the test file is generated according to the received test requirement information and the data characteristic information, so that the weak dependence on the opposite end environment of the file test is realized, and the file test verification coverage and the test efficiency are improved.
The method for generating the test file in the embodiment of the present disclosure will be further explained with reference to fig. 3 to 5b by taking the payment file as an example.
Fig. 3 schematically shows a flow chart of a data characteristic information generation method according to an embodiment of the present disclosure. As shown in fig. 3, operation S220 includes operations S221 through S223.
In operation S221, data structure information and first field attribute information are determined according to the file interface information.
In operation S222, second field attribute information is determined according to the first field attribute information and the history file data.
In operation S223, the data feature information is determined according to the data structure information and the second field attribute information.
In one example, acquiring the document information of a payment interface to be met, analyzing the document and the file, analyzing the file type and structure (a compressed format zip, the interior of which consists of a data file txt and an instruction file txt; a compressed packet is named as chk), and acquiring required fields and field attribute characteristics, namely first field attribute information; and performing further identification analysis on the field attribute in the first field attribute information according to the historical file data, and determining second field attribute information, wherein the second field attribute information comprises field categories, field lengths, whether the field categories are available or not, whether the field categories are repeatable or not, character characteristics, bit-filling logic and the like.
The second field attribute information is exemplified as follows:
serial number (length 15, text (number), non-empty, unique),
Annuity plan information:
name (Length 15, text (number), non-empty, unique)
Code (length 30, text (number), not blank)
Enterprise information:
name (Length 100, text, not blank)
Code (length 20, text (number), available empty)
Staff information:
name (length 50, text, non-empty, unique)
Certificate number (length 20, text (ID card), non-empty, unique)
Beneficiary information:
name (length 50, text, non-empty, unique)
Account number (Length 40, text (Bank Account number), not blank)
Family name (Length 100, text, not empty)
Line of account opening (length 60, text, not empty)
Row number (length 12, row number, available space)
Row pin (length 3, text, not blank)
Payable amount (length 17, numerical floating point precision 0.01, not null)
Total amount paid (Length 17, numerical floating point precision 0.01, not empty)
Tax payable (Length 17, numerical floating point precision 0.01, not null)
Payable date (length 8, date (YYYMMDD), not empty)
Abstract (Length 100, text, not empty)
And (4) bit-filling logic (text type: right filling, bit-filling character is blank, numerical type: left filling, bit-filling character is 0), and field sequence (interface field sequence).
The data characteristic information of the test file can be determined by combining the data with the data structure information, and the data characteristic information is used for determining the basic data of the test file.
FIG. 4 schematically illustrates a flow chart for determining condition information from test requirement information according to an embodiment of the disclosure. As shown in fig. 4, operation S230 includes operations S231 through S233.
In operation S231, normal file synthesis demand information and abnormal point demand information are acquired.
In operation S232, first condition information is determined according to the normal file synthesis requirement information.
In operation S233, second condition information is determined according to the abnormal point demand information.
In one example, the test requirement information includes normal file synthesis requirement information and abnormal point requirement information, and may be, for example:
1. normal file processing is verified, and no error is reported; 2. the verification sum is 5w, and the upper and lower amounts are differentiated; 3. verifying that the abstract has special characters; 4. verifying error prompt conditions corresponding to the totals and the details; 5. verifying whether the abnormal prompt is correct or not if the non-empty key field is processed if the account is empty; 6. the data in the file are serialized, and the loading condition is verified; 7. the efficiency of receiving and processing over 10w of data is verified.
In the test requirement information, the first piece is normal file synthesis requirement information, and the rest are abnormal point requirement information. And determining first condition information according to the normal file synthesis demand information and determining second condition information according to the abnormal point demand information, wherein the first condition information and the second condition information are used for determining a data range for generating the test file.
Abstracting the test requirement information into quantitative condition information, and setting the data volume in a file, such as small data verification, and small data which can be normally paid and processed by 20 pens; such as large data volume authentication. And demarcating available data ranges, such as: 1. normal payment data: account information; 2. special data: data with the sum of 5w or less; 3. the abstract contains data of special characters.
Fig. 5a schematically shows one of the flowcharts for generating the test file according to the condition information and the data characteristic information according to the embodiment of the disclosure, and fig. 5b schematically shows the second flowchart for generating the test file according to the condition information and the data characteristic information according to the embodiment of the disclosure. As shown in fig. 5a, operation S240 includes operations S241 to S244.
In operation S241, a data base range is determined according to the data characteristic information.
In operation S242, target data to be synthesized is determined according to the first condition information and the data base range.
In operation S243, a normal test file is generated according to the target data to be synthesized and the data structure information.
In one example, a data base range of the test file is determined according to the data characteristic information, data information is retrieved according to the first condition information and the data base range information, a corresponding data result is obtained to serve as target data to be synthesized, and the target data to be synthesized are subjected to file synthesis according to a specific data structure to generate a normal test file. Specifically, based on the analysis result, the data of each field is retrieved and integrated, including value adjustment, format conversion of the data (value to text, complement), and the synthesis of the normal file is completed according to the field sequence and the splicing logic (without separators).
In operation S244, an exception test file is generated according to the second condition information, the target data to be synthesized, and the data structure information.
In the prior art, when an abnormal scene needs to be simulated, such as key field missing, field overlong, dislocation, and data error (corresponding error between total and detail); special scenes such as empty files, special values (amount size), boundary values, special characters. The files need to be manually modified, when the number of the related fields of the files is too large, the number of the related fields of the files is increased, manual adjustment is prone to errors, and verification of related abnormal points is affected. In order to improve the generation efficiency of the abnormal file, a plurality of abnormal files can be automatically generated through operations S2441 to S2443.
As shown in fig. 5b, operation S244 includes operations S2441 to S2443.
In operation S2441, at least one abnormal point information is determined according to the second condition information.
In operation S2442, the target data to be synthesized is adjusted according to the at least one outlier information to generate at least one set of second target data to be synthesized.
In operation S2443, at least one exception test file is generated according to the at least one set of second target data to be synthesized and the data structure information.
According to the embodiment of the present disclosure, the abnormal point information includes core data missing, character length error, and data serialization.
In one example, the abnormal point information may be, for example, core data missing, full half angle of a character, field character length error, data serial, and the like, at least one abnormal point information is determined according to the second condition information, and in a test application scenario, there are usually multiple abnormal point information, for example, (1, the total count corresponds to an error in detail data calculation result; 2, the non-empty key field is empty; and 3, the data serial (misplaced, empty), unlike the process of generating a normal test file, after retrieving and integrating data of each field, it is necessary to set and adjust data content, arrangement format, and the like according to the abnormal point information to determine second target data to be synthesized, and then complete the simulated generation of the abnormal file.
Based on the test file generation method, the disclosure also provides a test file generation device. The apparatus will be described in detail below with reference to fig. 6 to 9.
Fig. 6 schematically shows a block diagram of the structure of a test file generation apparatus according to an embodiment of the present disclosure. FIG. 7 schematically illustrates a block diagram of a data feature determination module according to an embodiment of the disclosure; FIG. 8 schematically illustrates a block diagram of a test requirements determination module, according to an embodiment of the disclosure; fig. 9 schematically shows a block diagram of a structure of a test file generation module according to an embodiment of the present disclosure.
As shown in fig. 6, the test file generation apparatus 800 of this embodiment includes an acquisition module 810, a data characteristic determination module 820, a test requirement determination module 830, and a test file generation module 840.
The obtaining module 810 is configured to obtain file interface information and history file data, where the file interface information includes field attribute information of a test file to be generated, and the history file data includes structure data of the test file to be generated. In an embodiment, the obtaining module 810 may be configured to perform the operation S210 described above, which is not described herein again.
The data characteristic determining module 820 is configured to determine data characteristic information according to the file interface information and the historical file data, where the data characteristic information is used to characterize a field attribute of a test file to be generated and a test file synthesis and splicing manner. In an embodiment, the data characteristic determining module 820 may be configured to perform the operation S220 described above, which is not described herein again.
The test requirement determining module 830 is configured to determine condition information according to the test requirement information, where the condition information is used to characterize a data range of the generated test file. In an embodiment, the test requirement determining module 830 may be configured to perform the operation S230 described above, which is not described herein again.
The test file generating module 840 is configured to generate a test file according to the condition information and the data feature information. In an embodiment, the test file generating module 840 may be configured to perform the operation S240 described above, which is not described herein again.
As shown in fig. 7, the data characteristic determination module 820 includes: a first determination submodule 821, a second determination submodule 822 and a third determination submodule 823.
The first determining sub-module 821 is used for determining data structure information and first field attribute information according to the file interface information. In an embodiment, the first determining sub-module 821 may be configured to perform the operation S221 described above, and will not be described herein again.
The second determining submodule 822 is configured to determine second field attribute information according to the first field attribute information and the history file data. In an embodiment, the second determining submodule 822 may be configured to perform the operation S222 described above, and will not be described herein again.
The third determining sub-module 823 is configured to determine the data feature information according to the data structure information and the second field attribute information. In an embodiment, the third determining sub-module 823 may be configured to perform the operation S223 described above, and is not described herein again.
According to an embodiment of the present disclosure, the test requirement determining module 830 includes: an acquisition sub-module 831, a fourth determination sub-module 832 and a fifth determination sub-module 833.
The obtaining sub-module 831 is configured to obtain normal file synthesis demand information and abnormal point demand information. In an embodiment, the obtaining sub-module 831 may be configured to perform the operation S231 described above, and is not described herein again.
The fourth determining submodule 832 is configured to determine the first condition information according to the normal file synthesizing requirement information. In an embodiment, the fourth determining submodule 832 may be configured to perform the operation S232 described above, and will not be described herein again.
The fifth determining sub-module 833 is configured to determine second condition information according to the abnormal point demand information. In an embodiment, the fifth determining sub-module 833 may be configured to perform the operation S233 described above, and is not described herein again.
According to an embodiment of the present disclosure, the test file generation module 840 includes a sixth determination sub-module 841, a seventh determination sub-module 842, a first generation sub-module 843, and a second generation sub-module 844.
The sixth determining sub-module 841 is configured to determine a data base range according to the data characteristic information. In an embodiment, the sixth determining sub-module 841 may be configured to perform the operation S241 described above, and will not be described herein again.
The seventh determining submodule 842 is configured to determine target data to be synthesized according to the first condition information and the data base range. In an embodiment, the seventh determining sub-module 842 may be configured to perform the operation S242 described above, and is not described herein again.
The first generating submodule 843 is configured to generate a normal test file according to the target data to be synthesized and the data structure information. In an embodiment, the first generating sub-module 843 may be configured to perform the operation S243 described above, which is not described herein again.
The second generating sub-module 844 is configured to generate an exception test file according to the second condition information, the target data to be synthesized, and the data structure information. In an embodiment, the second generating sub-module 844 may be configured to perform the operation S244 described above, and will not be described herein again.
According to an embodiment of the present disclosure, the second generation submodule 844 includes a first determination unit 8441, a first generation unit 8442, and a second generation unit 8443.
The first determining unit 8441 is configured to determine at least one abnormal point information according to the second condition information. In an embodiment, the first determining unit 8441 may be configured to perform the operation S2441 described above, and is not described herein again.
The first generating unit 8442 is configured to adjust the target data to be synthesized according to the at least one outlier information to generate at least one set of second target data to be synthesized. In an embodiment, the first generating unit 8442 may be configured to perform the operation S2442 described above, which is not described herein again.
The second generating unit 8443 is configured to generate at least one exception test file according to the at least one set of second target data to be synthesized and the data structure information. In an embodiment, the second generating unit 8443 may be configured to perform the operation S2443 described above, which is not described herein again.
According to the embodiment of the present disclosure, any multiple modules of the obtaining module 810, the data characteristic determining module 820, the test requirement determining module 830 and the test file generating module 840 may be combined and implemented in one module, or any one of the modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the obtaining module 810, the data characteristic determining module 820, the test requirement determining module 830 and the test file generating module 840 may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware and firmware, or implemented by a suitable combination of any of them. Alternatively, at least one of the obtaining module 810, the data characteristic determining module 820, the test requirement determining module 830 and the test file generating module 840 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a test file generation method according to an embodiment of the present disclosure.
As shown in fig. 10, an electronic apparatus 900 according to an embodiment of the present disclosure includes a processor 901 which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. Processor 901 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 901 may also include on-board memory for caching purposes. The processor 901 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are stored. The processor 901, ROM 902, and RAM 903 are connected to each other by a bus 904. The processor 901 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the programs may also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 900 may also include input/output (I/O) interface 905, input/output (I/O) interface 905 also connected to bus 904, according to an embodiment of the present disclosure. The electronic device 900 may also include one or more of the following components connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. A drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement a test file generation method according to an embodiment of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 902 and/or the RAM 903 described above and/or one or more memories other than the ROM 902 and the RAM 903.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated by the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the test file generation method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 901. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, and downloaded and installed through the communication section 909 and/or installed from the removable medium 911. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program, when executed by the processor 901, performs the above-described functions defined in the system of the embodiment of the present disclosure. The above described systems, devices, apparatuses, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A test file generation method is characterized by comprising the following steps:
acquiring file interface information and historical file data, wherein the file interface information comprises field attribute information of a test file to be generated, and the historical file data comprises structural data of the test file to be generated;
determining data characteristic information according to the file interface information and the historical file data, wherein the data characteristic information is used for representing field attributes of the test file to be generated and a test file synthesis splicing mode;
determining condition information according to the test requirement information, wherein the condition information is used for representing a data range for generating a test file; and
and generating a test file according to the condition information and the data characteristic information.
2. The method of claim 1, wherein determining data characteristic information from the file interface information and the historical file data comprises:
determining data structure information and first field attribute information according to the file interface information;
determining second field attribute information according to the first field attribute information and the historical file data; and
and determining the data characteristic information according to the data structure information and the second field attribute information.
3. The method according to claim 2, wherein the test requirement information includes normal file synthesis requirement information and abnormal point requirement information, and the determining condition information according to the test requirement information includes:
acquiring normal file synthesis demand information and abnormal point demand information;
determining first condition information according to the normal file synthesis demand information; and
and determining second condition information according to the abnormal point demand information.
4. The method of claim 3, wherein the test files include a normal test file and an abnormal test file, and wherein generating the test files according to the condition information and the data characteristic information includes:
determining a data basic range according to the data characteristic information;
determining target data to be synthesized according to the first condition information and the data basic range;
generating a normal test file according to the target data to be synthesized and the data structure information; and
and generating an abnormal test file according to the second condition information, the target data to be synthesized and the data structure information.
5. The method according to claim 4, wherein the generating an exception test file according to the second condition information, the target data to be synthesized, and the data structure information comprises:
determining at least one abnormal point information according to the second condition information;
adjusting the target data to be synthesized according to the at least one abnormal point information to generate at least one group of second target data to be synthesized; and
and generating at least one abnormal test file according to the at least one group of second target data to be synthesized and the data structure information.
6. The method of claim 5, wherein the outlier information comprises core data missing, character length error, and data serialization.
7. The method of any of claims 1 to 6, wherein the data characteristic information comprises field attribute characteristics, character characteristics, and padding logic.
8. A test file generating apparatus comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring file interface information and historical file data, the file interface information comprises field attribute information of a test file to be generated, and the historical file data comprises structural data of the test file to be generated;
the data characteristic determining module is used for determining data characteristic information according to the file interface information and the historical file data, wherein the data characteristic information is used for representing the field attribute of the test file to be generated and the synthesis and splicing mode of the test file;
the test requirement determining module is used for determining condition information according to the test requirement information, wherein the condition information is used for representing a data range for generating the test file; and
and the test file generation module is used for generating a test file according to the condition information and the data characteristic information.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 7.
CN202210546574.3A 2022-05-18 2022-05-18 Test file generation method, device, equipment, storage medium and program product Pending CN114721967A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210546574.3A CN114721967A (en) 2022-05-18 2022-05-18 Test file generation method, device, equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210546574.3A CN114721967A (en) 2022-05-18 2022-05-18 Test file generation method, device, equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN114721967A true CN114721967A (en) 2022-07-08

Family

ID=82231267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210546574.3A Pending CN114721967A (en) 2022-05-18 2022-05-18 Test file generation method, device, equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN114721967A (en)

Similar Documents

Publication Publication Date Title
WO2023207146A1 (en) Service simulation method and apparatus for esop system, and device and storage medium
CN112187558A (en) Data verification method and device and electronic equipment
CN114022031A (en) Data processing method, data processing apparatus, electronic device, medium, and computer program product
CN112445866A (en) Data processing method and device, computer readable medium and electronic equipment
CN111581431B (en) Data exploration method and device based on dynamic evaluation
CN116662302A (en) Data processing method, device, electronic equipment and storage medium
CN114721967A (en) Test file generation method, device, equipment, storage medium and program product
CN111865726B (en) Service message testing method, device, computer system and storage medium
CN113918525A (en) Data exchange scheduling method, system, electronic device, medium, and program product
CN112783903B (en) Method and device for generating update log
CN113515510A (en) Data processing method, data processing system, electronic device and readable storage medium
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN111625455A (en) Program testing method, device, equipment and medium
CN112084114A (en) Method and apparatus for testing an interface
CN114969059B (en) Method and device for generating order information, electronic equipment and storage medium
CN113568838A (en) Test data generation method, device, equipment, storage medium and program product
CN116166558A (en) Transaction testing method, device, equipment and storage medium
CN113360417A (en) Test method, session modifier, electronic device, and medium
CN114817314A (en) Data processing method and device, electronic equipment and storage medium
CN115629983A (en) Test case set generation method, device, equipment and medium
CN116414600A (en) Data automatic checking method, device, equipment and storage medium
CN114692970A (en) User intention prediction model training method, user intention prediction method and device
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
CN116610674A (en) Information processing method, device, equipment and storage medium
CN114218254A (en) Report generation method, device, equipment and storage medium

Legal Events

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