CN114756470A - Test file generation method and device, storage medium and computer equipment - Google Patents

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

Info

Publication number
CN114756470A
CN114756470A CN202210435796.8A CN202210435796A CN114756470A CN 114756470 A CN114756470 A CN 114756470A CN 202210435796 A CN202210435796 A CN 202210435796A CN 114756470 A CN114756470 A CN 114756470A
Authority
CN
China
Prior art keywords
file
test
test file
generated
generation
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
CN202210435796.8A
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.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202210435796.8A priority Critical patent/CN114756470A/en
Publication of CN114756470A publication Critical patent/CN114756470A/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/3688Test management for test execution, e.g. scheduling of test suites
    • 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

Abstract

The invention discloses a test file generation method, a test file generation device, a storage medium and computer equipment, relates to the technical field of information, and mainly aims to improve the efficiency and the precision of test file generation. The method comprises the following steps: receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and generating a test file based on the file generation function and the file generation data. The method and the device are suitable for generating the test file.

Description

Test file generation method and device, storage medium and computer equipment
Technical Field
The present invention relates to the field of information technologies, and in particular, to a test file generation method and apparatus, a storage medium, and a computer device.
Background
After a developer develops a product, the product needs to be tested by using a large amount of test files, and therefore generation of the test files becomes an urgent problem to be solved.
Currently, in the process of generating a test file, a worker needs to be familiar with a file generation function in advance. However, the method for generating the test file requires that the worker writes the file generation function in advance, which reduces the efficiency of generating the test file, and meanwhile, due to the fact that the technical levels of the worker are different, the situation of wrong function writing can occur, so that the test file is generated wrongly, and the generation precision of the test file is reduced.
Disclosure of Invention
The invention provides a test file generation method, a test file generation device, a storage medium and computer equipment, and mainly aims to improve the efficiency and the precision of test file generation.
According to a first aspect of the present invention, there is provided a test file generation method, including:
receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated;
determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type;
acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and generating a test file based on the file generation function and the file generation data.
According to a second aspect of the present invention, there is provided a test file generating apparatus comprising:
the device comprises a receiving unit, a generating unit and a processing unit, wherein the receiving unit is used for receiving a file generating instruction corresponding to a test file to be generated, and the file generating instruction comprises identification information corresponding to the test file to be generated;
the determining unit is used for determining the file type of the test file to be generated based on the identification information and determining a test file template corresponding to the file type;
the acquisition unit is used for acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and the generating unit is used for generating a test file based on the file generating function and the file generating data.
According to a third aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated;
determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type;
acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and generating a test file based on the file generation function and the file generation data.
According to a fourth aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the program:
receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated;
determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type;
acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and generating a test file based on the file generation function and the file generation data.
According to the test file generation method, the test file generation device, the storage medium and the computer equipment, compared with the current mode that a worker needs to write a file generation function in advance to generate a test file, the test file generation method receives a file generation instruction corresponding to the test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; meanwhile, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and finally, generating a test file based on the file generation function and the file generation data, determining a test file template corresponding to the test file to be generated, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 shows a flowchart of a test file generation method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another test file generation method provided by the embodiment of the invention;
fig. 3 is a schematic structural diagram illustrating a test file generating apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another test file generating apparatus according to an embodiment of the present invention;
fig. 5 shows a physical structure diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
At present, the efficiency of generating the test file is reduced by writing the function by the staff, and meanwhile, due to the fact that technical levels of the staff are different, the situation of wrong writing of the function can be caused, and therefore the generating precision of the test file is reduced.
In order to solve the above problem, an embodiment of the present invention provides a test file generating method, as shown in fig. 1, where the method includes:
101. and receiving a file generation instruction corresponding to the test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated.
The identification information may be icon information, ID information, or number information corresponding to a test file to be generated, where the test file includes test data corresponding to the test service.
For the embodiment of the invention, in order to solve the problems of low generation efficiency and low generation precision of the test file in the prior art, the embodiment of the invention improves the generation efficiency of the test file by determining the test file template corresponding to the test file to be generated, acquiring the file generation function and the file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data. The embodiment of the invention is mainly applied to a scene of generating the test file, and the execution main body of the embodiment of the invention is a device or equipment capable of generating the test file, and can be specifically arranged at one side of a client or a server.
Specifically, a test file generation device is downloaded and installed in a company official website, the test file generation device is opened by double-click, a main interface of the test file generation device is displayed, a file generation identifier in a main interface of a test file generation system is clicked, a file generation instruction corresponding to the test file to be generated is generated based on the file generation identifier, the test file generation device receives the file generation instruction corresponding to the test file to be generated, wherein the test file generation instruction comprises identification information corresponding to the test file to be generated, the identification information can be icon information corresponding to the test file to be generated, and the test file to be generated can be uniquely determined only through the identification information. And determining a test file template corresponding to the file type, acquiring a file generation function and file generation data based on the test file template, and finally generating the test file based on the file generation function and the file generation data, so that the test file generation efficiency is improved, and meanwhile, the problem that function compiling is wrong due to uneven technical levels of workers can be avoided, and the test file generation precision is improved.
102. And determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type.
The file types comprise fund reconciliation type files, basic bill type files, merchant bill type files and the like.
For the embodiment of the present invention, after receiving the test file generation instruction corresponding to the test file to be generated and determining the identification information carried in the generation instruction, based on the identification information, it is checked which type of file the test file to be generated belongs to, because different types of files correspond to different test file templates, based on the file type to which the test file to be generated belongs, the test file template corresponding to the file type is determined, that is, the test file template corresponding to the test file to be generated is determined, for example, the test file to be generated can be determined to belong to the life insurance sales procurement class file through the icon identification corresponding to the test file to be generated, and the test file template corresponding to the test file to be generated can be determined by selling the test file template corresponding to the life insurance procurement class file, and based on the test file template, the method comprises the steps of obtaining a file generation function and file generation data corresponding to a test file to be generated, and finally generating the test file based on the file generation function and the file generation data, so that the workload of workers is reduced, and meanwhile, non-professional workers can also generate the test file.
103. And acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template.
The file generation function comprises various service functions such as algorithm functions, time functions, random functions and the like, and the file generation data refers to service data acquired from various industry basic databases such as oracle, mysql, SqlServer, redis, Hbase, Elasticissearch and the like.
For the embodiment of the invention, different test file templates correspond to different file generation function libraries, different test file templates correspond to different file generation databases at the same time, the test file template interface is opened, a pull-down menu for selecting a file generation function exists in the test file template interface, different file generation functions can appear by clicking the pull-down menu identification, a file generation function corresponding to a test file to be generated is selected from the different file generation functions, meanwhile, a pull-down menu for selecting file generation data exists in the test file template interface, different file generation data can appear by clicking the pull-down menu identification, the file generation data corresponding to the test file to be generated is selected from the different file generation data, and finally based on the selected file generation function and the file generation data, the test file is generated, so that the efficiency of generating the test file is improved, meanwhile, the situation that the file generating function is wrongly written due to negligence of workers can be avoided, the wrong test file is generated, and the generation precision of the test file is improved.
104. And generating a test file based on the file generation function and the file generation data.
For the embodiment of the invention, after the file generation function and the file generation data corresponding to the test file to be generated are obtained in the test file template interface, the file generation rule corresponding to the test file to be generated is constructed based on the file generation function and the file generation data, the operations of inserting data, modifying data and the like can be carried out in the test file template based on the file generation rule, after the operations are completed, the generation button in the test file template is clicked, the test file is randomly generated, so that the test file is generated by determining the test file template corresponding to the test file to be generated, obtaining the file generation function and the file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data, the efficiency of test file generation is improved, meanwhile, function writing errors caused by technical level irregularity of workers are avoided, and therefore test files with errors are generated, and the generation precision of the test files is improved.
According to the test file generation method provided by the invention, compared with the current mode that a worker needs to write a file generation function in advance to generate a test file, the test file generation method receives a file generation instruction corresponding to the test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; meanwhile, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and finally, generating a test file based on the file generation function and the file generation data, determining a test file template corresponding to the test file to be generated, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data.
Further, in order to better describe the generation process of the test file, as a refinement and an extension of the foregoing embodiment, an embodiment of the present invention provides another test file generation method, as shown in fig. 2, where the method includes:
201. and receiving a file generation instruction corresponding to the test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated.
Specifically, if the test file is to be generated, the test file generation device needs to be opened first, then a test file generation button in a main interface of the file generation device is clicked, then a test file pull-down menu appears, the test file pull-down menu includes various types of files, a corresponding test file is selected from the pull-down menu and clicked, a test file generation instruction corresponding to the test file to be generated is generated, the test file generation instruction carries identification information corresponding to the test file to be generated, the file type of the test file to be generated is determined according to the identification information, then a test file template corresponding to the file type to be generated is determined based on the file type of the test file to be generated, and a file generation function and file generation data corresponding to the test file to be generated are selected from the test file template, and finally generating the test file based on the file generation function and the file generation data.
202. And determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type.
For the embodiment of the present invention, different types of test files correspond to different test file templates, and in order to determine the test file template corresponding to the test file to be generated, first, a test file template corresponding to a different type of file needs to be constructed, based on which the method includes: constructing test file templates corresponding to different file types; and establishing a mapping relation between different test file templates and different file generation function libraries, and establishing a mapping relation between different test file templates and different file generation databases.
The file generation function library comprises various related algorithm functions for generating big data files, various service data are stored in the file generation database, and more data can be generated by using the file generation function based on the service data selected in the file database, so that the test file is obtained.
Specifically, before determining the file type to which the test file to be generated belongs, a test file template corresponding to different file types needs to be established, each group of function logic codes corresponding to different types of files needs to be packaged first, specifically, each group of function logic codes can be packaged by adopting different languages, which language is convenient to use, i.e., which language can be selected for packaging, in the embodiment of the present invention, the packaging language is not specifically limited, for example, each group of function logic codes corresponding to different types of files can be packaged by adopting languages such as JAVA, C + + or Python, etc., to obtain each group of file generation functions corresponding to different types of files, and then each group of file generation functions are stored in a file generation function library corresponding to different types of test files, respectively, wherein the file generation function library includes a general file generation function and an exclusive file generation function corresponding to the file type, opening various industry basic databases, such as databases of oracle, mysql, sqlServer, redis, Hbase, Elasticissearch and the like, for obtaining real-time information, and at the same time, pre-constructing test file templates corresponding to different types of files, wherein the test file templates corresponding to the different types of files all comprise a process ID title item, a process name title item, the environment title item, a source system title item, a service type title item, a belonging group title item, a time point title item, a frequency title item, a function description title item, a file header title item, a file body title item and the like, and then, in order to enable the different test file templates to correspond to different file generation function libraries, establishing a mapping relation between the different test file templates and different file generation function libraries, so that file generation functions corresponding to the different types of files can be mapped in the test file templates corresponding to the different types of files, meanwhile, in order to enable different test file templates to correspond to different file generation databases, mapping relations between the different test file templates and the different file generation databases need to be established, so that file generation data corresponding to files of the different types can be mapped in the test file templates corresponding to the files of the different types, a worker can be prevented from creating the test file generation templates by himself, the worker can be prevented from selecting required generation functions from a plurality of file generation functions, the time of the worker is saved, the workload of the worker is reduced, and meanwhile, the efficiency of test file generation can be improved.
Further, after the mapping relationship between the different test file templates and the different file generation function libraries and the mapping relationship between the different test file templates and the different file generation data are established, the file type of the test file to be generated needs to be determined based on the identification information carried in the file generation instruction, and the test file template corresponding to the file type is determined in the plurality of test file templates, because the mapping relationship exists between the different test file templates and the file generation function library and the file generation database corresponding to the different test file templates, after the correct test file template is selected, the file generation function library and the file generation database corresponding to the different test file template are also selected immediately, then the file generation function and the file generation data corresponding to the test file to be generated are selected in the test file template, and finally the data are generated based on the file generation function and the file, and generating the test file.
203. Determining a file generation function library corresponding to the test file template based on the mapping relation between different test file templates and different file generation function libraries, and determining a file generation database corresponding to the test file template based on the mapping relation between different test file templates and different file generation databases.
Specifically, after the file type of the test file to be generated is determined, the test file template corresponding to the file type is determined based on the file type, because a mapping relationship exists between different test file templates and different file generation function libraries, all the test file templates corresponding to the test file to be generated are selected, and then the corresponding file generation function libraries appear along with the test file template, and similarly, because a mapping relationship exists between different test file templates and different file generation databases, all the test file templates corresponding to the test file to be generated are selected, and then the corresponding file generation databases appear along with the test file template.
204. And acquiring a file generation function selected by a user for the test file to be generated from the file generation function library and file generation data selected for the test file to be generated from the file generation database.
The file generation function library stores various generation functions corresponding to the file types, and meanwhile, the file generation database stores various generation data corresponding to the file types.
For the embodiment of the present invention, after determining the file generation function library and the file generation database corresponding to the test file template, a file generation function required for generating the file to be tested needs to be selected from the file generation function library, and at the same time, file generation data required for generating the file to be tested needs to be selected from the file generation database, based on which step 204 specifically includes: determining file header information, file header information and file body information corresponding to the test file to be generated in the test file template; acquiring a file generating function selected by a user from the file generating function library based on the file header information, the file header information and the file body information; and acquiring file generation data selected by a user from the file generation database based on the file header information, the file header information and the file body information.
Specifically, the test file template includes test title information, where the test title information includes a process id title item, a process name title item, the environment title item, a source system title item, the large group title item, the small group title item, a creation time title item, a file description title item, and the like, and after a user opens the test file template, corresponding information is filled in for each test title item, for example, writing find 0001 in the process id title item, filling a life risk reimbursement purchase file-test in the process name title item, filling testtable in the environment title item, filling caps and bass-web in the source system title item, filling 01 a basic core group in the large group title item, filling 02 an order core group in the small group title item, filling a fund in the service type title item, filling 8:00 in the creation time title item, filling life insurance file generation and the like in the function description title item, simultaneously, storing file header information and file body information in the file header title item and the file body title item, clicking a pull-down menu of a file generation function in a test file template based on the above information, selecting a file generation function corresponding to a test file to be generated in the pull-down menu, simultaneously clicking a pull-down menu of file generation data in the test file template, selecting file generation data corresponding to the test file to be generated in the pull-down menu, and finally generating the test file based on the file generation function and the file generation data.
205. And generating a test file based on the file generation function and the file generation data.
For the embodiment of the present invention, after completing filling various information in a test file template, and selecting a file generation function and file generation data corresponding to the test function to be generated, clicking a generation type header item in the test file template, where the generation type includes insertion, modification, and the like, and then clicking a generation button in the test file template, finally generating the test file based on the file generation function, the file generation data, and the file generation type, and after generating the test file, in order to facilitate a user to search for the test file, the test file needs to be archived, based on which the method includes: and determining a file repository corresponding to the test file based on the file type corresponding to the test file, and storing the test file to the file repository.
Specifically, the test file generation system further includes repositories corresponding to different types of files, after a test file is generated, a file repository corresponding to the file type is determined based on the file type to which the test file belongs, and then the test file is stored in the file repository, which is convenient for a user to search for the test file, and further, after the test file is stored in the file repository, if client software needs to perform software test by using the test file, the test file needs to be transmitted to the client software, based on which the method includes: determining a file transmission interface corresponding to client software which is tested by using the test file; and transmitting the test file in the file repository to the client software based on the file transmission interface so that the client software can complete the test work based on the test file.
Specifically, firstly, an API interface corresponding to the client software is determined, and then the test file is transmitted to the client software based on the API interface, where the specific transmission method is as follows: acquiring a data stream corresponding to the test file based on the file transmission interface; transmitting a test file in the file repository to the client software based on the data stream.
Specifically, based on the API interface, a data IO stream corresponding to the test file is obtained, based on the data IO stream, the test file in the file repository is input to a pipeline input stream, the test file in the pipeline input stream is input to a pipeline output stream, and finally the test file flowing out of the pipeline output stream is stored in client software, so that a user performs a test operation based on the test file in the client software.
According to another test file generation method provided by the invention, compared with the current mode that a worker needs to write a file generation function in advance to generate a test file, the method receives a file generation instruction corresponding to the test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; meanwhile, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and finally, generating a test file based on the file generation function and the file generation data, determining a test file template corresponding to the test file to be generated, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides a test file generating apparatus, as shown in fig. 3, where the apparatus includes: a receiving unit 31, a determining unit 32, an acquiring unit 33, and a generating unit 34.
The receiving unit 31 may be configured to receive a file generation instruction corresponding to a test file to be generated, where the file generation instruction includes identification information corresponding to the test file to be generated.
The determining unit 32 may be configured to determine, based on the identification information, a file type to which the test file to be generated belongs, and determine a test file template corresponding to the file type.
The obtaining unit 33 may be configured to obtain a file generation function and file generation data corresponding to the test file to be generated based on the test file template.
The generating unit 34 may be configured to generate a test file based on the file generating function and the file generating data.
In a specific application scenario, in order to obtain a file generation function and file generation data corresponding to the test file to be generated, as shown in fig. 4, the obtaining unit 33 includes a determining module 331 and a first obtaining module 332.
The determining module 331 may be configured to determine a file generation function library corresponding to the test file template based on a mapping relationship between different test file templates and different file generation function libraries.
The first obtaining module 332 may be configured to obtain a file generating function selected by a user from the file generating function library for the test file to be generated.
The determining module 331 may be further configured to determine a file generation database corresponding to the test file template based on a mapping relationship between different test file templates and different file generation databases.
The first obtaining module 332 may be further configured to obtain file generation data, which is selected by a user from the file generation database for the test file to be generated.
In a specific application scenario, in order to obtain a file generation function and file generation data selected by a user from the file generation function library for the test file to be generated, the first obtaining module 332 includes a determining sub-module and an obtaining sub-module.
The determining submodule may be configured to determine file header information, and file body information corresponding to the test file to be generated in the test file template.
The obtaining sub-module may be configured to obtain a file generating function selected by a user from the file generating function library based on the file header information, and the file body information.
The obtaining sub-module may be further configured to obtain file generation data selected by a user from the file generation database based on the file header information, and the file body information.
In a specific application scenario, in order to archive and store the generated test file, the apparatus further includes a storage unit 35.
The storage unit 35 may be configured to determine a file repository corresponding to the test file based on the file type corresponding to the test file, and store the test file in the file repository.
In a specific application scenario, in order to transmit the test file in the file repository to the client software for testing, the apparatus further includes: a transmission unit 36.
The determining unit 32 may be further configured to determine a file transfer interface corresponding to the client software that performs the test using the test file.
The transmission unit 36 may be configured to transmit the test file in the file repository to the client software based on the file transmission interface, so that the client software completes the test work based on the test file.
In a specific application scenario, in order to transmit the test file in the file repository to the client software based on the file transmission interface, the transmission unit 36 includes a second obtaining module 361 and a transmission module 362.
The second obtaining module 361 may be configured to obtain a data stream corresponding to the test file based on the file transmission interface.
The transmission module 362 may be configured to transmit the test file in the file repository to the client software based on the data stream.
In a specific application scenario, the apparatus further includes a constructing unit 37 for constructing test file templates corresponding to different file types and for establishing mapping relationships between different test file templates and different file generation function libraries and different file generation databases.
The constructing unit 37 may be configured to construct test file templates corresponding to different file types.
The building unit 37 may be specifically configured to build mapping relationships between different test file templates and different file generation function libraries, and to build mapping relationships between different test file templates and different file generation databases.
It should be noted that other corresponding descriptions of the functional modules related to the test file generating apparatus provided in the embodiment of the present invention may refer to the corresponding description of the method shown in fig. 1, and are not described herein again.
Based on the method shown in fig. 1, correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the following steps: receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and generating a test file based on the file generation function and the file generation data.
Based on the above embodiments of the method shown in fig. 1 and the apparatus shown in fig. 3, an embodiment of the present invention further provides an entity structure diagram of a computer device, as shown in fig. 5, where the computer device includes: a processor 41, a memory 42, and a computer program stored on the memory 42 and executable on the processor, wherein the memory 42 and the processor 41 are both arranged on a bus 43 such that when the processor 41 executes the program, the following steps are performed: receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and generating a test file based on the file generation function and the file generation data.
According to the technical scheme, the file generation instruction corresponding to the test file to be generated is received, and the file generation instruction comprises the identification information corresponding to the test file to be generated; determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type; meanwhile, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template; and finally, generating a test file based on the file generation function and the file generation data, determining a test file template corresponding to the test file to be generated, acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template, and finally generating the test file based on the file generation function and the file generation data.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A test file generation method is characterized by comprising the following steps:
receiving a file generation instruction corresponding to a test file to be generated, wherein the file generation instruction comprises identification information corresponding to the test file to be generated;
determining the file type of the test file to be generated based on the identification information, and determining a test file template corresponding to the file type;
acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and generating a test file based on the file generation function and the file generation data.
2. The method according to claim 1, wherein obtaining a file generation function corresponding to the test file to be generated based on the test file template comprises:
determining a file generation function library corresponding to the test file template based on the mapping relation between different test file templates and different file generation function libraries;
acquiring a file generating function selected by a user from the file generating function library for the test file to be generated;
acquiring file generation data corresponding to the test file to be generated based on the test file template, wherein the file generation data comprises file generation data;
determining a file generation database corresponding to the test file template based on the mapping relation between different test file templates and different file generation databases;
and acquiring file generation data selected by the user from the file generation database aiming at the test file to be generated.
3. The method according to claim 2, wherein the obtaining of the file generation function selected by the user from the file generation function library for the test file to be generated comprises:
determining file header information, file header information and file body information corresponding to the test file to be generated in the test file template;
acquiring a file generating function selected by a user from the file generating function library based on the file header information, the file header information and the file body information;
the acquiring file generation data selected by the user from the file generation database for the test file to be generated includes:
and acquiring file generation data selected by a user from the file generation database based on the file header information, the file header information and the file body information.
4. The method of claim 1, wherein after generating a test file based on the file generation function and the file generation data, the method further comprises:
and determining a file repository corresponding to the test file based on the file type corresponding to the test file, and storing the test file to the file repository.
5. The method of claim 4, wherein after said storing the test file to the file repository, the method further comprises:
determining a file transmission interface corresponding to client software which is tested by using the test file;
and transmitting the test file in the file repository to the client software based on the file transmission interface so that the client software can complete the test work based on the test file.
6. The method of claim 5, wherein the transmitting the test file in the file repository to the client software based on the file transmission interface comprises:
acquiring a data stream corresponding to the test file based on the file transmission interface;
transmitting a test file in the file repository to the client software based on the data stream.
7. The method of claim 1, wherein prior to said determining a test file template corresponding to said file type, said method further comprises:
constructing test file templates corresponding to different file types;
and establishing a mapping relation between different test file templates and different file generation function libraries, and establishing a mapping relation between different test file templates and different file generation databases.
8. A test file generating apparatus, comprising:
the device comprises a receiving unit, a generating unit and a processing unit, wherein the receiving unit is used for receiving a file generating instruction corresponding to a test file to be generated, and the file generating instruction comprises identification information corresponding to the test file to be generated;
the determining unit is used for determining the file type of the test file to be generated based on the identification information and determining a test file template corresponding to the file type;
the acquisition unit is used for acquiring a file generation function and file generation data corresponding to the test file to be generated based on the test file template;
and the generating unit is used for generating a test file based on the file generating function and the file generating data.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
10. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 7 when executed by the processor.
CN202210435796.8A 2022-04-24 2022-04-24 Test file generation method and device, storage medium and computer equipment Pending CN114756470A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210435796.8A CN114756470A (en) 2022-04-24 2022-04-24 Test file generation method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210435796.8A CN114756470A (en) 2022-04-24 2022-04-24 Test file generation method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114756470A true CN114756470A (en) 2022-07-15

Family

ID=82333529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210435796.8A Pending CN114756470A (en) 2022-04-24 2022-04-24 Test file generation method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114756470A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116303098A (en) * 2023-05-17 2023-06-23 北京翼辉信息技术有限公司 Application testing method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116303098A (en) * 2023-05-17 2023-06-23 北京翼辉信息技术有限公司 Application testing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US8151248B1 (en) Method and system for software defect management
US9021440B1 (en) System and method for automated test script generation
US7512954B2 (en) Method and mechanism for debugging a series of related events within a computer system
US8726236B2 (en) Determining context specific content
EP2778929B1 (en) Test script generation system
CN110750654A (en) Knowledge graph acquisition method, device, equipment and medium
WO2005031503A2 (en) Sytem and method for generating data validation rules
US20110307875A1 (en) Tracking variable information in optimized code
CN111353754B (en) Method and device for generating flow template, electronic equipment and readable storage medium
CN107016047A (en) Document query, document storing method and device
CN108460068B (en) Method, device, storage medium and terminal for importing and exporting report
CN109710810A (en) Change management method, apparatus, equipment and storage medium
CN109165209B (en) Data verification method, device, equipment and medium for object types in database
CN110413507B (en) System test method, device, computer equipment and storage medium
CN105518669A (en) Data model change management
CN111694561A (en) Interface management method, device, equipment and storage medium
CN114253939A (en) Data model construction method and device, electronic equipment and storage medium
CN114756470A (en) Test file generation method and device, storage medium and computer equipment
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN111159040A (en) Test data generation method, device, equipment and storage medium
CN111090591B (en) Test method and device, electronic equipment and computer readable storage medium
CN116560629A (en) Serialization method, device, medium and equipment for data transmission object
CN110795259A (en) Method and device for analyzing application collapse
CN109597819B (en) Method and apparatus for updating a database
JP2023507688A (en) edge table representation of the process

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