CN111488731A - File generation method and device, computer equipment and storage medium - Google Patents

File generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111488731A
CN111488731A CN202010294733.6A CN202010294733A CN111488731A CN 111488731 A CN111488731 A CN 111488731A CN 202010294733 A CN202010294733 A CN 202010294733A CN 111488731 A CN111488731 A CN 111488731A
Authority
CN
China
Prior art keywords
file
target
name
script
preset
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.)
Granted
Application number
CN202010294733.6A
Other languages
Chinese (zh)
Other versions
CN111488731B (en
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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN202010294733.6A priority Critical patent/CN111488731B/en
Publication of CN111488731A publication Critical patent/CN111488731A/en
Application granted granted Critical
Publication of CN111488731B publication Critical patent/CN111488731B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Abstract

The embodiment of the invention discloses a file generation method, a file generation device, computer equipment and a storage medium, wherein the method comprises the following steps: generating a preset template file according to the file module selected by the user and the style of the file module; based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file. The invention optimizes the file generation process, automatically generates the target report file by setting the template file, and can save a large amount of manpower and improve the file generation efficiency.

Description

File generation method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a file generation method and apparatus, a computer device, and a storage medium.
Background
In the prior art, test files or report files are generally generated by writing in a manual mode or by a complicated generation process through a conventional file generation tool (e.g., sonarqube), the obtained files do not have a complete and uniform file format, and when the number of the generated files reaches one order of magnitude, the purpose of efficient processing cannot be achieved through a manual or conventional generation mode, and a large amount of manpower and material resources are generally spent.
Disclosure of Invention
In view of this, embodiments of the present invention provide a file generation method and apparatus, a computer device, and a storage medium, where a template file is set to automatically generate a target report file, so that a lot of manpower can be saved and file generation efficiency can be improved.
In one aspect, an embodiment of the present invention provides a file generation method, where the method includes:
generating a preset template file according to the file module selected by the user and the style of the file module;
based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file.
In another aspect, an embodiment of the present invention provides a file generating apparatus, where the apparatus includes:
the first generating unit is used for generating a preset template file according to the file module selected by the user and the style of the file module;
the extraction and filling unit is used for extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name and filling the extracted target file data into the preset template file;
the calling conversion unit is used for calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and the calling generation unit is used for calling Jenkins, creating a target task with the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In yet another aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the file generation method as described above is implemented.
In still another aspect, the present invention also provides a computer-readable storage medium, which stores one or more computer programs that can be executed by one or more processors to implement the file generation method as described above.
The embodiment of the invention provides a file generation method, a file generation device, computer equipment and a storage medium, wherein the method comprises the following steps: generating a preset template file according to the file module selected by the user and the style of the file module; based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file. The invention optimizes the file generation process, automatically generates the target report file by setting the template file, and can save a large amount of manpower and improve the file generation efficiency.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a file generation method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a file generation method according to an embodiment of the present invention;
FIG. 3 is another schematic flow chart of a file generation method according to an embodiment of the present invention;
FIG. 4 is another schematic flow chart of a file generation method according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a file generation apparatus provided by an embodiment of the present invention;
FIG. 6 is another schematic block diagram of a file generation apparatus provided by an embodiment of the present invention;
FIG. 7 is another schematic block diagram of a file generation apparatus provided by an embodiment of the present invention;
FIG. 8 is a schematic block diagram of a first generating unit of a file generating apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of an extraction and filling unit of a document generation apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic block diagram of a call conversion unit of a file generation apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic block diagram of a call generation unit of a file generation apparatus according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a file generation method according to an embodiment of the present invention, and fig. 2 is a schematic view of a flow of the file generation method according to the embodiment of the present invention. The file generation method is applied to a client or a server. As an application, as shown in fig. 1, the file generation method is applied to a server 10, where the server 10 is responsible for generating a preset template file according to a selection of a user, obtaining an object script file according to the template file, and finally executing the object script file to generate an object report file and sending the object report file to a client 20, where the client is a terminal device used by the user, such as a desktop computer, a notebook, or a smart phone.
Referring to fig. 2, fig. 2 is a schematic flowchart of a file generation method according to an embodiment of the present invention. As shown in fig. 2, the method includes the following steps S101 to S104.
And S101, generating a preset template file according to the file module selected by the user and the style of the file module.
In the embodiment of the invention, the file module is a component of the preset template file, and the file module comprises a head part, a bottom part, a main body, a banner of the file and the like; the style of the file module can comprise the position, height and width of the file module, and various styles such as the text content, the text font and the text color of the file module. Specifically, the user can obtain the file module and the style of each file module through the file module selected on the front-end interface of the server and the style of each file module output on the front-end interface, and send the selected file module and the style of each file module to the rear end of the server for processing to generate the preset template file.
In one embodiment, as shown in FIG. 3, the step S101 includes steps S201 to S202:
s201, acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module.
In the embodiment of the invention, a user can select a required file module on a preset front-end interface provided by a server, specify a style corresponding to the file module aiming at the selected file module, and send the style to the back end of the server for processing through the preset front-end interface provided by the server.
S202, extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In the embodiment of the invention, after the rear end of the server receives the file module and the style of the file module sent by the front end interface, the data information of the file module and the style is extracted, and the preset template file is generated according to the extracted data information of the file module, so that the generated preset template file comprises the file module and the style corresponding to the file module.
S102, based on the name of the target file, extracting the target file data corresponding to the name of the target file from a preset database by using a Python script, and filling the extracted target file data into the preset template file.
In the embodiment of the present invention, target file data corresponding to a target file name may be read from a preset database, such as Hbase (hadoop database), and target file data corresponding to the target file name may be extracted from the preset database, in this embodiment, the preset database may be an Hbase database, which may also be another database, and the HbaseHbase database is a distributed storage database with high reliability, high performance, column-oriented, and scalability, where the target file data refers to each piece of file data generated by a user of a preset APP during downloading, editing, and the like, for example, each piece of file data generated by a user of a word during editing, downloading, and the like may be recorded in the Hbase database.
In one embodiment, as shown in FIG. 4, the step S102 includes steps S301-S303:
s301, detecting whether the target file name contains a file suffix name.
In the embodiment of the present invention, the file suffix name refers to a suffix name in the file name attribute, and the types of the file suffix name include a document file, a compressed file, a graphic file, a sound file, an animation file, a system file, an executable file, a system file, and the like. In this embodiment, the detection may be real-time, periodic, or triggered, for example, each time the target file name is received, the detection is triggered. And extracting the file name according to the suffix name.
S302, if the target file name is detected to contain a file suffix name, whether the target file suffix name matched with the file suffix name exists in the preset database or not is judged.
In the embodiment of the present invention, if it is detected that a file suffix name is included, it is determined whether a target file suffix name matching the file suffix name exists in the preset database according to the file suffix name, specifically, if a target file suffix name matching the file suffix name exists in the preset database, target file data corresponding to the target file name exists in the preset database, and a Python script is used to extract the corresponding target file data; and if the target file suffix name matched with the file suffix name does not exist in the preset database, the target file data corresponding to the target file name does not exist in the preset database.
And S303, if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
In the embodiment of the invention, the target file data is filled INTO the preset template file by using an insertion statement of a Python script, and the used insertion statement can be in the following format of INSERT INTO preset module file name VA L UES (inserted target file data name 1, inserted target file data name 2,. and inserted target file data name n).
And S103, calling a script file conversion tool to convert the filled preset template file to obtain a target script file.
In the embodiment of the invention, the script file conversion tool is called to convert the filled preset template file, and the filled preset template file is subjected to content analysis and content conversion, so that the target script file which can be executed by other/appointed test platforms is obtained. In practical application, because the test platforms are developed based on no framework, script files generated by different framework platforms cannot be shared, and therefore a script file conversion tool needs to be called to convert a preset template file to obtain a target script file. It can be understood that, in the process of calling the script file conversion tool to convert the preset template file to obtain the target script file, the script file conversion tool is not called to tamper the execution content in the preset template file, but another target script file is generated according to the file content of the preset template file, and the target script file can be executed on other test platforms.
In one embodiment, as shown in FIG. 5, the step S103 includes steps S401 to S404:
s401, extracting a template file primitive from the filled preset template file.
In the embodiment of the present invention, the primitive of the template file is a statement for controlling the testing process of the application during the process of executing the preset template file by the test file platform, and is used for reflecting the control action during the testing process of the application.
In practical applications, the template file primitive extracted from the preset template file may include a plurality of bars, and each template file primitive corresponds to at least one control instruction.
S402, generating an ordered control instruction queue according to the primitive of the template file.
In the embodiment of the invention, an ordered control instruction queue is generated according to the primitive of the template file, corresponding coding and decoding can be searched in a preset coding and decoding list according to the primitive of the template file, the ordered control instruction queue is obtained by carrying out coding conversion on the primitive of the template file, and the target script statement is obtained by carrying out block packaging on the ordered control instruction queue.
And S403, converting the control instruction queue to obtain a target script statement.
It should be noted that before converting the primitive of the template file, corresponding codecs need to be configured for different primitives of the template file, and a corresponding relationship between the primitive of the template file and the corresponding codec is established, that is, each test file platform corresponds to a corresponding relationship between the primitive of the template file and the corresponding codec; when the preset template file runs in the current test file platform, the encoding and decoding for encoding the template file primitives in the preset template file are determined according to the corresponding relation between the template file primitives corresponding to the current test file platform and the encoding and decoding, so that an ordered control instruction queue obtained by encoding the template file primitives in the preset template file is more consistent with the current test file platform, and the preset template file can be tested by using the current test file platform more accurately by running the ordered control instruction queue.
It can be understood that, when the script file conversion tool is called to convert the preset template file, the corresponding template file primitive may be obtained by performing static analysis on the filled preset template file, where the static analysis on the preset template file refers to performing a scanning operation on the content of the preset template file without executing the preset template file.
S404, configuring the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue to obtain the target script file.
In the embodiment of the invention, the script frame is configured in advance according to different test file platforms, and the target script statement is configured in the preset script frame according to the time sequence consistent with the control instruction queue, so that the target script file is obtained.
S104, calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file.
In the embodiment of the present invention, a user may create a target task through a Jenkins interface, specifically, after the Jenkins interface is passed and a Jenkins web management interface is opened, a newstem icon is selected, a build task name is generated by the newstem icon, the target file name may be selected as the build task name, after the build task name, the user may select a task template, the specifically selected template is not limited in this embodiment, the creation of the task is completed after the user selects the task template, and since the user selects the target file name as the build task name, the user also constructs the target task using the target file name as a parameter. After the target task is created, the user may load the target script file in the created target task, specifically, the user may load the target script file by loading a path address of the target script file through the target task, and finally generate the target report file by executing the generation instruction.
In one embodiment, as shown in FIG. 6, the step S104 includes steps S501-S502:
s501, calling Jenkins and creating a target task with the target file name as a parameter.
In the embodiment of the invention, after a Jenkins interface is opened, a Newltem icon is selected, a built task name is generated by the Newltem icon, the target file name can be selected as the built task name, after the built task name, a user can select a task template, the selected template is not limited in the embodiment, the creation of a task is completed after the user selects the task template, and the user selects the target file name as the built task name, so that the user constructs a target task with the target file name as a parameter.
S502, inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
In the embodiment of the present invention, after the target task is created, the user may load the target script file in the created target task, specifically, the user may load the target script file by loading a path address of the target script file through the target task, and finally generate the instruction by executing, invoking a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using the target task to generate the target report file.
As can be seen from the above, in the embodiment of the present invention, the preset template file is generated according to the file module selected by the user and the style of the file module; based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file. The invention optimizes the file generation process, automatically generates the target report file by setting the template file, and can save a large amount of manpower and improve the file generation efficiency.
Referring to fig. 7, in response to the above-mentioned file generating method, an embodiment of the present invention further provides a file generating apparatus, where the apparatus 100 includes: a first generation unit 101, an extraction and filling unit 102, a call conversion unit 103, and a call generation unit 104.
The first generating unit 101 is configured to generate a preset template file according to a file module selected by a user and a style of the file module; the extracting and filling unit 102 is configured to extract, based on a target file name, target file data corresponding to the target file name from a preset database by using a Python script, and fill the extracted target file data into the preset template file; a calling conversion unit 103, configured to call a script file conversion tool to convert the filled preset template file to obtain a target script file; and the call generation unit 104 is used for calling Jenkins, creating a target task with the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, referring to fig. 8, the first generating unit 101 includes:
the acquiring unit 101a is configured to acquire a file module selected by a user on a preset front-end interface and a style corresponding to the file module; the first generating subunit 101b is configured to extract a file module selected by the user and data information of a corresponding style, and generate a preset template file according to the extracted data information.
In one embodiment, referring to fig. 9, the fetch fill unit 102 includes:
a detecting unit 102a, configured to detect whether a file suffix name is included in the target file name; the judging unit 102b is configured to, if it is detected that the target file name includes a file suffix name, judge whether a target file suffix name matching the file suffix name exists in the preset database; and the extracting and filling subunit 102c is configured to, if a target file suffix name matching the file suffix name exists in the preset database, extract corresponding target file data from the preset database according to the target file suffix name using a Python script, and fill the extracted target file data into the preset template file.
In one embodiment, referring to fig. 10, the call conversion unit 103 includes:
an extracting unit 103a, configured to extract a template file primitive from the filled preset template file; the second generating unit 103b is configured to generate an ordered control instruction queue according to the template file primitive; a conversion unit 103c, configured to convert the control instruction queue to obtain a target script statement; and the configuration unit 103d is configured to configure the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue, so as to obtain the target script file.
In one embodiment, referring to fig. 11, the call generation unit 104 includes:
the calling and creating unit 104a is used for calling Jenkins and creating a target task with the target file name as a parameter; and the calling generation subunit 104b is configured to insert the target script file into the Jenkins platform, call a preset configuration compiling tool in the Jenkins platform, and execute the target script file by using a target task to generate a target report file.
As can be seen from the above, in the embodiment of the present invention, the preset template file is generated according to the file module selected by the user and the style of the file module; based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file; calling a script file conversion tool to convert the filled preset template file to obtain a target script file; and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file. The invention optimizes the file generation process, automatically generates the target report file by setting the template file, and can save a large amount of manpower and improve the file generation efficiency.
The file generation device and the file generation method correspond to each other one to one, and the specific principle and process thereof are the same as those of the method described in the above embodiment, and are not described again.
The above-described file generating apparatus may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 12.
FIG. 12 is a schematic diagram of a computer device according to the present invention. The device can be a terminal or a server, wherein the terminal can be an electronic device such as a notebook computer, a desktop computer and the like. The server may be an independent server or a server cluster composed of a plurality of servers. Referring to fig. 12, the computer apparatus 500 includes a processor 502, a nonvolatile storage medium 503, an internal memory 504, and a network interface 505, which are connected by a system bus 501. The non-volatile storage medium 503 of the computer device 500 may store, among other things, an operating system 5031 and a computer program 5032, which, when executed, may cause the processor 502 to perform a file generation method. The processor 502 of the computer device 500 is used to provide computing and control capabilities that support the overall operation of the computer device 500. The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, which when executed by the processor causes the processor 502 to perform a file generation method. The network interface 505 of the computer device 500 is used for network communication. Those skilled in the art will appreciate that the illustration in fig. 12 is merely a block diagram of a portion of the structure associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 implements the following operations when executing the computer program:
generating a preset template file according to the file module selected by the user and the style of the file module;
based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, generating the preset template file according to the file module selected by the user and the style of the file module includes:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In an embodiment, the extracting, based on the target file name, target file data corresponding to the target file name from a preset database using a Python script, and filling the extracted target file data into the preset template file includes:
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether a target file suffix name matched with the file suffix name exists in the preset database or not;
and if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
In an embodiment, the invoking a script file conversion tool converts the filled preset template file to obtain an object script file, including:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the primitive of the template file;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue to obtain the target script file.
In one embodiment, the invoking Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file includes:
calling Jenkins and creating a target task with the target file name as a parameter;
inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 12 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device only includes a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are the same as those of the embodiment shown in fig. 12, and are not described herein again.
The present invention provides a computer readable storage medium storing one or more computer programs, the one or more computer programs being executable by one or more processors to perform the steps of:
generating a preset template file according to the file module selected by the user and the style of the file module;
based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file.
In one embodiment, generating the preset template file according to the file module selected by the user and the style of the file module includes:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
In an embodiment, the extracting, based on the target file name, target file data corresponding to the target file name from a preset database using a Python script, and filling the extracted target file data into the preset template file includes:
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether a target file suffix name matched with the file suffix name exists in the preset database or not;
and if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
In an embodiment, the invoking a script file conversion tool converts the filled preset template file to obtain an object script file, including:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the primitive of the template file;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue to obtain the target script file.
In one embodiment, the invoking Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file includes:
calling Jenkins and creating a target task with the target file name as a parameter;
inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
The foregoing storage medium of the present invention includes: various media that can store program codes, such as a magnetic disk, an optical disk, and a Read-Only Memory (ROM).
The elements of all embodiments of the present invention may be implemented by a general purpose integrated circuit, such as a CPU (central processing Unit), or by an ASIC (Application Specific integrated circuit).
The steps in the file generation method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The units in the file generation device of the embodiment of the invention can be merged, divided and deleted according to actual needs.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of file generation, the method comprising:
generating a preset template file according to the file module selected by the user and the style of the file module;
based on the target file name, extracting target file data corresponding to the target file name from a preset database by using a Python script, and filling the extracted target file data into the preset template file;
calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file.
2. The method of claim 1, wherein the generating of the preset template file according to the file module selected by the user and the style of the file module comprises:
acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
and extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
3. The method of claim 1, wherein the extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name and filling the extracted target file data into the preset template file comprises:
detecting whether the target file name contains a file suffix name or not;
if the target file name is detected to contain a file suffix name, judging whether a target file suffix name matched with the file suffix name exists in the preset database or not;
and if the target file suffix name matched with the file suffix name exists in the preset database, extracting corresponding target file data from the preset database by using a Python script according to the target file suffix name, and filling the extracted target file data into the preset template file.
4. The method of claim 1, wherein the invoking a script file transformation tool to transform the populated default template file to obtain an object script file comprises:
extracting template file primitives from the filled preset template file;
generating an ordered control instruction queue according to the primitive of the template file;
converting the control instruction queue to obtain a target script statement;
and configuring the target script statement into a preset script frame according to a time sequence consistent with the control instruction queue to obtain the target script file.
5. The method of claim 1, wherein the calling Jenkins and creating a target task with the target file name as a parameter, and executing the target script file according to the target task to generate a target report file, comprises:
calling Jenkins and creating a target task with the target file name as a parameter;
inserting the target script file into the Jenkins platform, calling a preset configuration compiling tool in the Jenkins platform, and executing the target script file by using a target task to generate a target report file.
6. A file generation apparatus, characterized in that the apparatus comprises:
the first generating unit is used for generating a preset template file according to the file module selected by the user and the style of the file module;
the extraction and filling unit is used for extracting target file data corresponding to the target file name from a preset database by using a Python script based on the target file name and filling the extracted target file data into the preset template file;
the calling conversion unit is used for calling a script file conversion tool to convert the filled preset template file to obtain a target script file;
and the calling generation unit is used for calling Jenkins, creating a target task with the name of the target file as a parameter, and executing the target script file according to the target task to generate a target report file.
7. The apparatus of claim 6, wherein the first generating unit comprises:
the acquisition unit is used for acquiring a file module selected by a user on a preset front-end interface and a style corresponding to the file module;
the first generation subunit is used for extracting the file module selected by the user and the data information of the corresponding style, and generating a preset template file according to the extracted data information.
8. The apparatus of claim 6, wherein the extraction padding unit comprises:
the detection unit is used for detecting whether the target file name contains a file suffix name or not;
the judging unit is used for judging whether a target file suffix name matched with the file suffix name exists in the preset database or not if the target file name is detected to contain the file suffix name;
and the extraction and filling subunit is used for extracting corresponding target file data from a preset database according to the target file suffix name by using a Python script if the target file suffix name matched with the file suffix name exists in the preset database, and filling the extracted target file data into the preset template file.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the file generation method according to any of claims 1-5 when executing the computer program.
10. A computer-readable storage medium, storing one or more computer programs, the one or more computer programs being executable by one or more processors to implement the file generation method of any one of claims 1-5.
CN202010294733.6A 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium Active CN111488731B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010294733.6A CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010294733.6A CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111488731A true CN111488731A (en) 2020-08-04
CN111488731B CN111488731B (en) 2023-09-29

Family

ID=71810913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010294733.6A Active CN111488731B (en) 2020-04-15 2020-04-15 File generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111488731B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112800741A (en) * 2021-01-29 2021-05-14 远光软件股份有限公司 Task execution method, electronic device and storage medium
CN113779953A (en) * 2021-11-10 2021-12-10 航天宏图信息技术股份有限公司 Automatic document generation method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN110109877A (en) * 2018-01-10 2019-08-09 武汉斗鱼网络科技有限公司 A kind of automatic document classifying method, storage medium, equipment and system
CN110401581A (en) * 2019-07-22 2019-11-01 杭州电子科技大学 Industry control agreement fuzz testing case generation method based on flow retrospect
CN110633081A (en) * 2019-08-23 2019-12-31 北京浪潮数据技术有限公司 Page generation method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109877A (en) * 2018-01-10 2019-08-09 武汉斗鱼网络科技有限公司 A kind of automatic document classifying method, storage medium, equipment and system
CN108415826A (en) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 Test method, terminal device and the computer readable storage medium of application
CN110401581A (en) * 2019-07-22 2019-11-01 杭州电子科技大学 Industry control agreement fuzz testing case generation method based on flow retrospect
CN110633081A (en) * 2019-08-23 2019-12-31 北京浪潮数据技术有限公司 Page generation method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112800741A (en) * 2021-01-29 2021-05-14 远光软件股份有限公司 Task execution method, electronic device and storage medium
CN113779953A (en) * 2021-11-10 2021-12-10 航天宏图信息技术股份有限公司 Automatic document generation method and system

Also Published As

Publication number Publication date
CN111488731B (en) 2023-09-29

Similar Documents

Publication Publication Date Title
CN108108162B (en) Application programming interface generation method and device
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN109101228B (en) Application program execution method and device
CN111563220A (en) Business website project construction method and device, computer equipment and storage medium
CN111488731A (en) File generation method and device, computer equipment and storage medium
WO2023082654A1 (en) Method, apparatus and device for generating service interaction diagram, and storage medium
CN111290951A (en) Test method, terminal, server, system and storage medium
CN114465937B (en) Network card testing method, device, server and medium
CN111694733A (en) API (application programming interface) testing method and device for software development kit SDK (software development kit)
CN114416547A (en) Test case based test method
CN113836014A (en) Interface testing method and device, electronic equipment and storage medium
CN111078529B (en) Client writing module testing method and device and electronic equipment
CN116911588A (en) Business process execution method, device, equipment and storage medium
CN115543324B (en) Method, device, equipment and medium for generating interactive interface
CN111506305A (en) Tool kit generation method and device, computer equipment and readable storage medium
CN110865943A (en) Interface testing method and device, computer equipment and storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN110599581A (en) Image model data processing method and device and electronic equipment
CN113590564B (en) Data storage method, device, electronic equipment and storage medium
CN110618881B (en) Method and system for simulating message queue
CN110780983A (en) Task exception handling method and device, computer equipment and storage medium
CN114679491A (en) Micro front-end service application method and device, storage medium and electronic equipment
CN112612531A (en) Application program starting method and device, electronic equipment and storage medium
CN111143186A (en) Method and apparatus for application program interface API testing

Legal Events

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