CN111679975A - Document generation method and device, electronic equipment and medium - Google Patents

Document generation method and device, electronic equipment and medium Download PDF

Info

Publication number
CN111679975A
CN111679975A CN202010470729.0A CN202010470729A CN111679975A CN 111679975 A CN111679975 A CN 111679975A CN 202010470729 A CN202010470729 A CN 202010470729A CN 111679975 A CN111679975 A CN 111679975A
Authority
CN
China
Prior art keywords
document
tested
target
template
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010470729.0A
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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202010470729.0A priority Critical patent/CN111679975A/en
Publication of CN111679975A publication Critical patent/CN111679975A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to big data and provides a document generation method, a document generation device, electronic equipment and a medium. The method can determine a system to be tested and a function point to be tested when a test request is received, generate a target template according to the function point to be tested, extract a parameter name of the target template, acquire a parameter value corresponding to the parameter name, determine a filling position of the parameter name on the target template, fill the parameter value to the filling position, generate an initial document, check the initial document, determine the initial document passing the check as a target document, and ensure that the generated document meets the test requirement of the function point to be tested by checking the initial document. The invention also relates to blockchain techniques, the target document being stored in a blockchain.

Description

Document generation method and device, electronic equipment and medium
Technical Field
The invention relates to the technical field of data processing of big data, in particular to a document generation method and device, electronic equipment and a medium.
Background
After the new-version document service system is developed, the document service system needs to be tested in order to ensure the stability and accuracy of the document service system. When the document business system is tested, the designed document is used as a test case to test the document business system. However, in the conventional method, the to-be-tested function points of the document service system are manually analyzed, and then documents are designed based on the analysis result, so that the method is low in efficiency, the accuracy of the designed documents depends on the familiarity of testers with the documents, and the quality of the finally-online new-version document service system is poor.
Disclosure of Invention
In view of the above, it is desirable to provide a document generation method, an apparatus, an electronic device, and a medium, which can generate a document required by a test for a function to be tested by analyzing the function to be tested of a system to be tested without relying on a tester, thereby improving the generation efficiency of the document.
A method of document generation, the method comprising:
when a test request is received, determining a system to be tested from the test request;
determining a function point to be tested of the system to be tested;
generating a target template according to the functional points to be detected;
extracting a parameter name of the target template, and acquiring a parameter value corresponding to the parameter name from a preset system;
determining the filling position of the parameter name on the target template;
filling the parameter values to the filling positions to generate an initial document;
and checking the initial document, and determining the initial document passing the checking as a target document.
According to a preferred embodiment of the present invention, the determining the function point to be tested of the system to be tested includes:
acquiring a current code and a historical code of the system to be tested;
generating a first abstract syntax tree of the system to be tested according to the current code, and generating a second abstract syntax tree of the system to be tested according to the historical code;
comparing the first abstract syntax tree with the second abstract syntax tree to obtain a difference code of the system to be tested;
and determining a function point corresponding to the difference code from a first list stored in advance as the function point to be tested.
According to a preferred embodiment of the present invention, the generating a first abstract syntax tree of the system under test according to the current code comprises:
converting the format of the current code into a preset format to obtain a target code with the preset format;
performing lexical analysis on the target code;
carrying out grammar analysis on the target code after lexical analysis to obtain a preprocessing code;
and constructing the first abstract syntax tree according to the preprocessing codes.
According to a preferred embodiment of the present invention, the generating a target template according to the to-be-detected function point includes:
when detecting that no template corresponding to the function point to be detected exists in a template library, determining a target parameter corresponding to the function point to be detected from a pre-stored second list, and generating the target template according to the target parameter based on a rich text editor; or
When detecting that a template corresponding to the function point to be tested exists in a template library, determining a document template according to the function point to be tested, acquiring the generation time of the document template and the request time of the test request, differentiating the request time and the generation time to obtain a time difference, and selecting the document template with the shortest time difference as the target template.
According to the preferred embodiment of the present invention, the extracting the parameter name of the target template includes:
determining a template number corresponding to the target template;
determining a document parameter list according to the template number;
and acquiring the parameter name from the document parameter list.
According to a preferred embodiment of the present invention, after the filling-in position is filled with the parameter values and an initial document is generated, the method further comprises:
acquiring a signature picture corresponding to the parameter value, and determining a signature rule of the target template;
identifying a signature track corresponding to the signature picture based on an optical character identification technology;
and signing the signature track on the initial document according to the signature rule.
According to a preferred embodiment of the present invention, said verifying said initial document comprises:
splitting the attribute of the initial document to extract a case parameter corresponding to the test request;
determining a logic to be tested corresponding to the functional point to be tested;
detecting whether the use case parameters are matched with the logic to be detected;
when at least one use case parameter in the initial document is matched with the logic to be tested, determining that the initial document is matched with the logic to be tested;
detecting whether the format of the use case parameters in the initial document is the preset format or not;
and when the format of the use case parameters in the initial document is not the preset format, converting the format of the use case parameters in the initial document into the preset format to obtain the target document, and storing the target document in a block chain.
An apparatus for document generation, the apparatus comprising:
the system comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a system to be tested from a test request when the test request is received;
the determining unit is further configured to determine a function point to be tested of the system to be tested;
the generating unit is used for generating a target template according to the functional point to be detected;
the extraction unit is used for extracting the parameter name of the target template and acquiring a parameter value corresponding to the parameter name from a preset system;
the determining unit is further configured to determine a filling position of the parameter name on the target template;
the filling unit is used for filling the parameter values to the filling positions to generate initial documents;
and the verification unit is used for verifying the initial document and determining the verified initial document as a target document.
According to a preferred embodiment of the present invention, the determining unit determining the function point to be tested of the system to be tested includes:
acquiring a current code and a historical code of the system to be tested;
generating a first abstract syntax tree of the system to be tested according to the current code, and generating a second abstract syntax tree of the system to be tested according to the historical code;
comparing the first abstract syntax tree with the second abstract syntax tree to obtain a difference code of the system to be tested;
and determining a function point corresponding to the difference code from a first list stored in advance as the function point to be tested.
According to a preferred embodiment of the present invention, the determining unit generating the first abstract syntax tree of the system to be tested according to the current code includes:
converting the format of the current code into a preset format to obtain a target code with the preset format;
performing lexical analysis on the target code;
carrying out grammar analysis on the target code after lexical analysis to obtain a preprocessing code;
and constructing the first abstract syntax tree according to the preprocessing codes.
According to a preferred embodiment of the present invention, the generating unit is specifically configured to:
when detecting that no template corresponding to the function point to be detected exists in a template library, determining a target parameter corresponding to the function point to be detected from a pre-stored second list, and generating the target template according to the target parameter based on a rich text editor; or
When detecting that a template corresponding to the function point to be tested exists in a template library, determining a document template according to the function point to be tested, acquiring the generation time of the document template and the request time of the test request, differentiating the request time and the generation time to obtain a time difference, and selecting the document template with the shortest time difference as the target template.
According to a preferred embodiment of the present invention, the extraction unit is specifically configured to:
determining a template number corresponding to the target template;
determining a document parameter list according to the template number;
and acquiring the parameter name from the document parameter list.
According to a preferred embodiment of the invention, the apparatus further comprises:
the acquisition unit is used for acquiring a signature picture corresponding to the parameter value after the parameter value is filled to the filling position and an initial document is generated, and determining a signature rule of the target template;
the recognition unit is used for recognizing a signature track corresponding to the signature picture based on an optical character recognition technology;
and the signing unit is used for signing the signature track on the initial document according to the signature rule.
According to a preferred embodiment of the present invention, the verification unit is specifically configured to:
splitting the attribute of the initial document to extract a case parameter corresponding to the test request;
determining a logic to be tested corresponding to the functional point to be tested;
detecting whether the use case parameters are matched with the logic to be detected;
when at least one use case parameter in the initial document is matched with the logic to be tested, determining that the initial document is matched with the logic to be tested;
detecting whether the format of the use case parameters in the initial document is the preset format or not;
and when the format of the use case parameters in the initial document is not the preset format, converting the format of the use case parameters in the initial document into the preset format to obtain the target document, and storing the target document in a block chain.
An electronic device, the electronic device comprising:
a memory storing at least one instruction; and
and the processor acquires the instructions stored in the memory to realize the document generation method.
A computer-readable storage medium having stored therein at least one instruction, the at least one instruction being executable by a processor in an electronic device to implement the document generation method.
According to the technical scheme, the functional point to be tested is determined by analyzing the system code, the parameters required by the system to be tested during testing can be determined without depending on testing personnel, the target template required by the functional point to be tested is generated without acquiring redundant data during testing, the generation efficiency of the document can be improved, and the generated document can be ensured to meet the testing requirement of the functional point to be tested by checking the initial document.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the document generation method of the present invention.
FIG. 2 is a functional block diagram of a preferred embodiment of the document creation apparatus of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device implementing the document generation method according to the preferred embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a document generation method according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The document generation method is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware of the electronic devices includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a cloud computing (cloud computing) based cloud consisting of a large number of hosts or network servers.
The Network where the electronic device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, when receiving the test request, determining the system to be tested from the test request.
In at least one embodiment of the present invention, the information carried by the test request includes, but is not limited to: the system to be tested.
In at least one embodiment of the invention, the system under test may be a document business system.
In at least one embodiment of the invention, the electronic device determining the system to be tested from the test request comprises:
the electronic equipment analyzes the method body in the test request to obtain all information carried by the test request, further, the electronic equipment obtains a preset label, and further, the electronic equipment extracts information corresponding to the preset label from all the information to be used as the system to be tested.
All the information can be quickly obtained by analyzing the method body of the test request, and the system to be tested can be accurately determined according to the mapping relation between the preset label and the system.
And S11, determining the function point to be tested of the system to be tested.
In at least one embodiment of the present invention, in the development process of the system to be tested, when a new function is developed, the system to be tested needs to be tested before the new function is put into use, and the function point to be tested refers to a new function point currently developed.
In at least one embodiment of the present invention, the electronic device determining the function point to be tested of the system to be tested comprises:
the electronic equipment obtains a current code and a historical code of the system to be tested, further, the electronic equipment generates a first abstract syntax tree of the system to be tested according to the current code, further, the electronic equipment generates a second abstract syntax tree of the system to be tested according to the historical code, further, the electronic equipment compares the first abstract syntax tree with the second abstract syntax tree to obtain a difference code of the system to be tested, and further, the electronic equipment determines a function point corresponding to the difference code from a first list stored in advance to serve as the function point to be tested.
An Abstract Syntax Tree (AST) is a tree representation of an abstract syntax structure of source code. Each node on the tree represents a structure in the source code and each node has its own number in a predetermined order, for example, in the order of the syntactic structure or the order in which the program runs.
By comparing the first abstract syntax tree with the second abstract syntax tree, the difference code can be quickly determined, and the function point to be tested can be quickly determined.
In at least one embodiment of the present invention, the generating, by the electronic device, a first abstract syntax tree of the system under test according to the current code includes:
the electronic equipment converts the format of the current code into a preset format to obtain a target code with the preset format, further, the electronic equipment performs lexical analysis on the target code, further, the electronic equipment performs syntactic analysis on the target code after the lexical analysis to obtain a preprocessed code, and further, the electronic equipment constructs the first abstract syntax tree according to the preprocessed code.
The preset format is a format capable of generating the first abstract syntax tree, and the current code is not limited to the format of the current code because the current code can be converted into a uniform preset format, and the current code may be in a C language format or a JAVA language format. By formatting the current code, a uniform preset format can be obtained, so that the current code in any format can be converted into the uniform preset format after being formatted.
Further, the lexical analysis is to cut the target code into multiple tokens and assign a number to each token. The current code is actually cut into multiple tokens and each token is assigned a number in sequence.
Furthermore, the grammar parsing is to combine the words into a sentence with a certain grammar, such as "program", "expression", and the like, based on the lexical parsing.
In at least one embodiment of the present invention, a generation manner of the second abstract syntax tree is the same as a generation manner of the first abstract syntax tree, and details of the present invention are not repeated herein.
And S12, generating a target template according to the functional point to be detected.
In at least one embodiment of the present invention, the target template refers to a template corresponding to the function point to be tested, and the function point to be tested can be tested according to a parameter value corresponding to a primary key on the target template.
In at least one embodiment of the present invention, the generating, by the electronic device, a target template according to the functional point to be tested includes:
(1) and when detecting that the template corresponding to the function point to be detected does not exist in the template library, the electronic equipment determines a target parameter corresponding to the function point to be detected from a pre-stored second list, and further, the electronic equipment generates the target template according to the target parameter based on a rich text editor.
And parameters corresponding to the plurality of functional points are stored in the pre-stored second list.
Through the embodiment, the target template corresponding to the functional point to be detected can be generated when the target template does not exist in the template library.
(2) When detecting that a template corresponding to the function point to be tested exists in the template library, further, the electronic device determines a document template according to the function point to be tested, further, the electronic device obtains the generation time of the document template and obtains the request time of the test request, further, the electronic device makes a difference between the request time and the generation time to obtain a time difference, and further, the electronic device selects the document template with the shortest time difference as the target template.
Through the implementation mode, the template before version upgrading can be prevented from being determined as the target template when a plurality of templates corresponding to the function points to be detected exist in the template library, and therefore the generated documents are prevented from being inaccurate due to the target template.
And S13, extracting the parameter name of the target template, and acquiring the parameter value corresponding to the parameter name from a preset system.
In other embodiments, the parameter names may be stored in a document parameter list, and the electronic device may obtain the parameter names by obtaining template numbers on the target template, and further, determining, by the electronic device, a corresponding document parameter list according to the template numbers.
In at least one embodiment of the present invention, the preset system stores history data of a plurality of users; further, the electronic device may obtain a parameter value corresponding to the parameter name from the preset system. For example, the parameter name is: the loan amount is as follows: 5000 Yuan ren Ming Bin.
In at least one embodiment of the present invention, the electronic device extracting the parameter name of the target template includes:
the electronic equipment determines a template number corresponding to the target template, further determines a document parameter list according to the template number, and further acquires the parameter name from the document parameter list.
And S14, determining the filling position of the parameter name on the target template.
In at least one embodiment of the present invention, the filling position refers to a position in the target template where a filling parameter value is required.
In at least one embodiment of the present invention, the electronic device determining the filling position of the parameter name on the target template includes:
and the electronic equipment determines the coordinate value of the parameter name on the target template, and further determines the position corresponding to the coordinate value as the filling position.
Through the above embodiment, the filling position can be quickly determined.
And S15, filling the parameter values to the filling positions to generate an initial document.
In at least one embodiment of the invention, the format of the initial document is the same as the format of the target template, for example: the target template is in html format, and the format of the generated initial document is also in html format.
In at least one embodiment of the present invention, after the initial document is generated, an identification code is used to identify the document, and the identification codes corresponding to different documents are also different.
In at least one embodiment of the invention, after the filling of the parameter values onto the filling positions, the method further comprises:
the electronic device obtains a signature picture corresponding to the parameter value, the electronic device determines a signature rule of the target template, and further, the electronic device identifies a signature track corresponding to the signature picture based on an Optical Character Recognition (OCR) technology, and further, the electronic device signs the signature track on the document according to the signature rule.
Wherein the signature rule refers to at which keyword of the target template the signature is.
Specifically, the OCR technology means that the electronic device determines the shape of the signature picture by detecting dark and light patterns on the signature picture, and then translates the shape into the signature track by using a character recognition method.
And S16, verifying the initial document, and determining the verified initial document as the target document.
In at least one embodiment of the present invention, the target document refers to an initial document that passes the verification.
In at least one embodiment of the present invention, the electronic device verifying the initial document includes:
the electronic device splits the attribute of the initial document to extract the case parameters corresponding to the test request, further, the electronic device determines the logic to be tested corresponding to the function point to be tested, further, the electronic device detects whether the case parameters are matched with the logic to be tested, when at least one case parameter in the initial document is matched with the logic to be tested, the electronic device determines that the initial document is matched with the logic to be tested, further, the electronic device detects whether the format of the case parameters in the initial document is the preset format, when the format of the case parameters in the initial document is not the preset format, the electronic device converts the format of the case parameters in the initial document into the preset format to obtain the target document, further, the target document is stored in a blockchain.
By detecting whether the use case parameters are matched with the logic to be tested, the use case parameters in the generated target document can be ensured to meet the requirement of the function point to be tested, and by detecting whether the format of the use case parameters is the preset format, the generated target document can be ensured to meet the requirement of testing the data format of the function point to be tested.
In at least one embodiment of the invention, the method further comprises:
and the electronic equipment determines the required quantity from the test request, calculates the generation quantity of the target documents, and stops the generation of the documents when detecting that the generation quantity reaches the required quantity.
It is emphasized that the target document may also be stored in a node of a blockchain in order to further ensure the privacy and security of the target document.
By detecting whether the generated quantity reaches the required quantity, the generation of the target documents meeting the required quantity can be ensured.
In at least one embodiment of the present invention, when all use case parameters of the initial document are not matched with the logic to be tested, the electronic device determines that the initial document is not matched with the logic to be tested, and when the initial document is not matched with the logic to be tested, the electronic device obtains an identification code of the initial document and generates a prompt message according to the identification code.
According to the technical scheme, the functional point to be tested is determined by analyzing the system code, the parameters required by the system to be tested during testing can be determined without depending on testing personnel, the target template required by the functional point to be tested is generated without acquiring redundant data during testing, the generation efficiency of the document can be improved, and the generated document can be ensured to meet the testing requirement of the functional point to be tested by checking the initial document.
FIG. 2 is a functional block diagram of a document generation apparatus according to a preferred embodiment of the present invention. The document generation apparatus 11 includes a determination unit 110, a generation unit 111, an extraction unit 112, a filling unit 113, a verification unit 114, an acquisition unit 115, an identification unit 116, a signing unit 117, and a transmission unit 118. The module/unit referred to in the present invention refers to a series of computer program segments that can be fetched by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
When a test request is received, the determining unit 110 determines a system to be tested from the test request.
In at least one embodiment of the present invention, the information carried by the test request includes, but is not limited to: the system to be tested.
In at least one embodiment of the invention, the system under test may be a document business system.
In at least one embodiment of the present invention, the determining unit 110 determines the system to be tested from the test request includes:
the determining unit 110 analyzes the method body in the test request to obtain all information carried in the test request, further, the determining unit 110 obtains a preset tag, and the determining unit 110 extracts information corresponding to the preset tag from all the information to be used as the system to be tested.
All the information can be quickly obtained by analyzing the method body of the test request, and the system to be tested can be accurately determined according to the mapping relation between the preset label and the system.
The determination unit 110 determines a function point to be tested of the system to be tested.
In at least one embodiment of the present invention, in the development process of the system to be tested, when a new function is developed, the system to be tested needs to be tested before the new function is put into use, and the function point to be tested refers to a new function point currently developed.
In at least one embodiment of the present invention, the determining unit 110 determines the function point to be tested of the system to be tested includes:
the determining unit 110 obtains a current code and a history code of the system to be tested, further, the determining unit 110 generates a first abstract syntax tree of the system to be tested according to the current code, the determining unit 110 generates a second abstract syntax tree of the system to be tested according to the history code, further, the determining unit 110 compares the first abstract syntax tree with the second abstract syntax tree to obtain a difference code of the system to be tested, and further, the determining unit 110 determines a function point corresponding to the difference code from a pre-stored first list as the function point to be tested.
An Abstract Syntax Tree (AST) is a tree representation of an abstract syntax structure of source code. Each node on the tree represents a structure in the source code and each node has its own number in a predetermined order, for example, in the order of the syntactic structure or the order in which the program runs.
By comparing the first abstract syntax tree with the second abstract syntax tree, the difference code can be quickly determined, and the function point to be tested can be quickly determined.
In at least one embodiment of the present invention, the determining unit 110 generating the first abstract syntax tree of the system to be tested according to the current code comprises:
the determining unit 110 converts the format of the current code into a preset format to obtain a target code with the preset format, further, the determining unit 110 performs lexical analysis on the target code, further, the determining unit 110 performs syntax analysis on the target code after the lexical analysis to obtain a preprocessed code, and the determining unit 110 constructs the first abstract syntax tree according to the preprocessed code.
The preset format is a format capable of generating the first abstract syntax tree, and the current code is not limited to the format of the current code because the current code can be converted into a uniform preset format, and the current code may be in a C language format or a JAVA language format. By formatting the current code, a uniform preset format can be obtained, so that the current code in any format can be converted into the uniform preset format after being formatted.
Further, the lexical analysis is to cut the target code into multiple tokens and assign a number to each token. The current code is actually cut into multiple tokens and each token is assigned a number in sequence.
Furthermore, the grammar parsing is to combine the words into a sentence with a certain grammar, such as "program", "expression", and the like, based on the lexical parsing.
In at least one embodiment of the present invention, a generation manner of the second abstract syntax tree is the same as a generation manner of the first abstract syntax tree, and details of the present invention are not repeated herein.
The generating unit 111 generates a target template according to the functional point to be detected.
In at least one embodiment of the present invention, the target template refers to a template corresponding to the function point to be tested, and the function point to be tested can be tested according to a parameter value corresponding to a primary key on the target template.
In at least one embodiment of the present invention, the generating unit 111 generates the target template according to the functional point to be tested, including:
(1) when it is detected that there is no template corresponding to the function point to be detected in the template library, the generating unit 111 determines a target parameter corresponding to the function point to be detected from a pre-stored second list, and further, the generating unit 111 generates the target template according to the target parameter based on a rich text editor.
And parameters corresponding to the plurality of functional points are stored in the pre-stored second list.
Through the embodiment, the target template corresponding to the functional point to be detected can be generated when the target template does not exist in the template library.
(2) When detecting that a template corresponding to the function point to be tested exists in the template library, the generating unit 111 determines a document template according to the function point to be tested, further, the generating unit 111 obtains a generating time of the document template and a request time for obtaining the test request, further, the generating unit 111 makes a difference between the request time and the generating time to obtain a time difference, and further, the generating unit 111 selects the document template with the shortest time difference as the target template.
Through the implementation mode, the template before version upgrading can be prevented from being determined as the target template when a plurality of templates corresponding to the function points to be detected exist in the template library, and therefore the generated documents are prevented from being inaccurate due to the target template.
The extracting unit 112 extracts the parameter name of the target template, and obtains a parameter value corresponding to the parameter name from a preset system.
In other embodiments, the parameter names may be stored in a document parameter list, and the extracting unit 112 may obtain the parameter names by obtaining template numbers on the target templates, and further, the extracting unit 112 determines the corresponding document parameter list according to the template numbers.
In at least one embodiment of the present invention, the preset system stores history data of a plurality of users; further, the extracting unit 112 may obtain a parameter value corresponding to the parameter name from the preset system. For example, the parameter name is: the loan amount is as follows: 5000 Yuan ren Ming Bin.
In at least one embodiment of the present invention, the extracting unit 112 extracts the parameter name of the target template including:
the extracting unit 112 determines a template number corresponding to the target template, the extracting unit 112 determines a document parameter list according to the template number, and the extracting unit 112 obtains the parameter name from the document parameter list.
The determination unit 110 determines a filling position of the parameter name on the target template.
In at least one embodiment of the present invention, the filling position refers to a position in the target template where a filling parameter value is required.
In at least one embodiment of the present invention, the determining unit 110 determines the filling position of the parameter name on the target template, including:
the determining unit 110 determines coordinate values of the parameter name on the target template, and further, the determining unit 110 determines a position corresponding to the coordinate values as the filling position.
Through the above embodiment, the filling position can be quickly determined.
The filling unit 113 fills the parameter values to the filling positions, and generates an initial document.
In at least one embodiment of the invention, the format of the initial document is the same as the format of the target template, for example: the target template is in html format, and the format of the generated initial document is also in html format.
In at least one embodiment of the present invention, after the initial document is generated, an identification code is used to identify the document, and the identification codes corresponding to different documents are also different.
In at least one embodiment of the present invention, after the parameter value is filled in the filling position to generate the document, the obtaining unit 115 obtains a signature picture corresponding to the parameter value and determines a signature rule of the target template, further, the identifying unit 116 identifies a signature track corresponding to the signature picture based on an Optical Character Recognition (OCR) technique, and further, the signing unit 117 signs the signature track on the document according to the signature rule.
Wherein the signature rule refers to at which keyword of the target template the signature is.
Specifically, the OCR technology means that the electronic device determines the shape of the signature picture by detecting dark and light patterns on the signature picture, and then translates the shape into the signature track by using a character recognition method.
The verification unit 114 verifies the initial document and determines the verified initial document as a target document.
In at least one embodiment of the present invention, the target document refers to an initial document that passes the verification.
In at least one embodiment of the present invention, the verifying unit 114 verifies the initial document including:
the verification unit 114 splits the attribute of the initial document to extract the use case parameters corresponding to the test request, the verification unit 114 determines the logic to be tested corresponding to the functional point to be tested, the verification unit 114 detects whether the use case parameters are matched with the logic to be tested, when at least one use case parameter in the initial document is matched with the logic to be tested, the verification unit 114 determines that the initial document is matched with the logic to be tested, the verification unit 114 detects whether the format of the use case parameter in the initial document is the preset format, when the format of the use case parameter in the initial document is not the preset format, the verification unit 114 converts the format of the use case parameter in the initial document into the preset format to obtain the target document, and the target document is stored in the block chain.
By detecting whether the use case parameters are matched with the logic to be tested, the use case parameters in the generated target document can be ensured to meet the requirement of the function point to be tested, and by detecting whether the format of the use case parameters is the preset format, the generated target document can be ensured to meet the requirement of testing the data format of the function point to be tested.
In at least one embodiment of the present invention, the determination unit 110 determines a required number from the test request, and calculates a generation number of the target document, and the generation unit 111 stops generation of the document when it is detected that the generation number reaches the required number.
It is emphasized that the target document may also be stored in a node of a blockchain in order to further ensure the privacy and security of the target document.
By detecting whether the generated quantity reaches the required quantity, the generation of the target documents meeting the required quantity can be ensured.
In at least one embodiment of the present invention, when all use case parameters of the initial document are not matched with the logic to be tested, the determining unit 110 determines that the initial document is not matched with the logic to be tested, when the initial document is not matched with the logic to be tested, the obtaining unit 115 obtains an identification code of the initial document and generates a prompt message according to the identification code, the determining unit 110 determines a prompt mode of the prompt message according to a level of the test request, and the sending unit 118 sends the prompt message in the prompt mode.
According to the technical scheme, the functional point to be tested is determined by analyzing the system code, the parameters required by the system to be tested during testing can be determined without depending on testing personnel, the target template required by the functional point to be tested is generated without acquiring redundant data during testing, the generation efficiency of the document can be improved, and the generated document can be ensured to meet the testing requirement of the functional point to be tested by checking the initial document.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing a document generation method.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and a computer program, such as a document generation program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by using various interfaces and lines, and acquires an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 obtains an operating system of the electronic device 1 and various installed application programs. The processor 13 obtains the application program to implement the steps in the above-described embodiments of the document generation method, such as the steps shown in fig. 1.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 12 and retrieved by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the acquisition process of the computer program in the electronic device 1. For example, the computer program may be divided into a determination unit 110, a generation unit 111, an extraction unit 112, a padding unit 113, a verification unit 114, an acquisition unit 115, an identification unit 116, a signing unit 117, and a transmission unit 118.
The memory 12 can be used for storing the computer programs and/or modules, and the processor 13 can implement various functions of the electronic device 1 by running or acquiring the computer programs and/or modules stored in the memory 12 and calling data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 12 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow in the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium and used for instructing related hardware to implement the steps of the above-described embodiments of the method when the computer program is acquired by a processor.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an available file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
With reference to fig. 1, the memory 12 of the electronic device 1 stores a plurality of instructions to implement a document generation method, and the processor 13 may retrieve the plurality of instructions to implement: when a test request is received, determining a system to be tested from the test request; determining a function point to be tested of the system to be tested; generating a target template according to the functional points to be detected; extracting a parameter name of the target template, and acquiring a parameter value corresponding to the parameter name from a preset system; determining the filling position of the parameter name on the target template; filling the parameter values to the filling positions to generate an initial document; and checking the initial document, and determining the initial document passing the checking as a target document.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the instruction, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A document generation method, comprising:
when a test request is received, determining a system to be tested from the test request;
determining a function point to be tested of the system to be tested;
generating a target template according to the functional points to be detected;
extracting a parameter name of the target template, and acquiring a parameter value corresponding to the parameter name from a preset system;
determining the filling position of the parameter name on the target template;
filling the parameter values to the filling positions to generate an initial document;
and checking the initial document, and determining the initial document passing the checking as a target document.
2. The document generation method of claim 1, wherein the determining the functional points to be tested of the system to be tested comprises:
acquiring a current code and a historical code of the system to be tested;
generating a first abstract syntax tree of the system to be tested according to the current code, and generating a second abstract syntax tree of the system to be tested according to the historical code;
comparing the first abstract syntax tree with the second abstract syntax tree to obtain a difference code of the system to be tested;
and determining a function point corresponding to the difference code from a first list stored in advance as the function point to be tested.
3. The document generation method of claim 2, wherein the generating a first abstract syntax tree for the system under test from the current code comprises:
converting the format of the current code into a preset format to obtain a target code with the preset format;
performing lexical analysis on the target code;
carrying out grammar analysis on the target code after lexical analysis to obtain a preprocessing code;
and constructing the first abstract syntax tree according to the preprocessing codes.
4. The document generation method according to claim 1, wherein the generating a target template according to the function point to be tested includes:
when detecting that no template corresponding to the function point to be detected exists in a template library, determining a target parameter corresponding to the function point to be detected from a pre-stored second list, and generating the target template according to the target parameter based on a rich text editor; or
When detecting that a template corresponding to the function point to be tested exists in a template library, determining a document template according to the function point to be tested, acquiring the generation time of the document template and the request time of the test request, differentiating the request time and the generation time to obtain a time difference, and selecting the document template with the shortest time difference as the target template.
5. The document generation method of claim 1, wherein the extracting the parameter name of the target template comprises:
determining a template number corresponding to the target template;
determining a document parameter list according to the template number;
and acquiring the parameter name from the document parameter list.
6. The document generation method as claimed in claim 1, wherein after generating an initial document by filling the parameter value onto the filling position, the document generation method further comprises:
acquiring a signature picture corresponding to the parameter value, and determining a signature rule of the target template;
identifying a signature track corresponding to the signature picture based on an optical character identification technology;
and signing the signature track on the initial document according to the signature rule.
7. The document generation method of claim 1, wherein the verifying the initial document comprises:
splitting the attribute of the initial document to extract a case parameter corresponding to the test request;
determining a logic to be tested corresponding to the functional point to be tested;
detecting whether the use case parameters are matched with the logic to be detected;
when at least one use case parameter in the initial document is matched with the logic to be tested, determining that the initial document is matched with the logic to be tested;
detecting whether the format of the use case parameters in the initial document is the preset format or not;
and when the format of the use case parameters in the initial document is not the preset format, converting the format of the use case parameters in the initial document into the preset format to obtain the target document, and storing the target document in a block chain.
8. A document generation apparatus, characterized by comprising:
the system comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a system to be tested from a test request when the test request is received;
the determining unit is further configured to determine a function point to be tested of the system to be tested;
the generating unit is used for generating a target template according to the functional point to be detected;
the extraction unit is used for extracting the parameter name of the target template and acquiring a parameter value corresponding to the parameter name from a preset system;
the determining unit is further configured to determine a filling position of the parameter name on the target template;
the filling unit is used for filling the parameter values to the filling positions to generate initial documents;
and the verification unit is used for verifying the initial document and determining the verified initial document as a target document.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing at least one instruction; and
a processor that retrieves instructions stored in the memory to implement the document generation method of any of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein at least one instruction that is retrieved by a processor in an electronic device to implement the document generation method of any of claims 1 to 7.
CN202010470729.0A 2020-05-28 2020-05-28 Document generation method and device, electronic equipment and medium Pending CN111679975A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010470729.0A CN111679975A (en) 2020-05-28 2020-05-28 Document generation method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010470729.0A CN111679975A (en) 2020-05-28 2020-05-28 Document generation method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN111679975A true CN111679975A (en) 2020-09-18

Family

ID=72453724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010470729.0A Pending CN111679975A (en) 2020-05-28 2020-05-28 Document generation method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN111679975A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112183458A (en) * 2020-10-19 2021-01-05 万汇链智能科技(苏州)有限公司 Data processing system of electronic document based on artificial intelligence technology
CN112269706A (en) * 2020-11-16 2021-01-26 北京百度网讯科技有限公司 Interface parameter checking method and device, electronic equipment and computer readable medium
CN112784566A (en) * 2021-01-22 2021-05-11 平安普惠企业管理有限公司 Document generation method, device, equipment and storage medium
CN114004211A (en) * 2021-12-30 2022-02-01 太平金融科技服务(上海)有限公司深圳分公司 Document template generation method, processing method, device, computer equipment and medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112183458A (en) * 2020-10-19 2021-01-05 万汇链智能科技(苏州)有限公司 Data processing system of electronic document based on artificial intelligence technology
CN112183458B (en) * 2020-10-19 2023-07-28 万汇链智能科技(苏州)有限公司 Data processing system of electronic document based on artificial intelligence technology
CN112269706A (en) * 2020-11-16 2021-01-26 北京百度网讯科技有限公司 Interface parameter checking method and device, electronic equipment and computer readable medium
CN112269706B (en) * 2020-11-16 2024-04-05 北京百度网讯科技有限公司 Interface parameter verification method, device, electronic equipment and computer readable medium
CN112784566A (en) * 2021-01-22 2021-05-11 平安普惠企业管理有限公司 Document generation method, device, equipment and storage medium
CN114004211A (en) * 2021-12-30 2022-02-01 太平金融科技服务(上海)有限公司深圳分公司 Document template generation method, processing method, device, computer equipment and medium

Similar Documents

Publication Publication Date Title
CN111679975A (en) Document generation method and device, electronic equipment and medium
CN112686036B (en) Risk text recognition method and device, computer equipment and storage medium
US11836069B2 (en) Methods and systems for assessing functional validation of software components comparing source code and feature documentation
CN113656547B (en) Text matching method, device, equipment and storage medium
CN111814441A (en) Report generation method and device, electronic equipment and storage medium
CN112925898B (en) Question-answering method and device based on artificial intelligence, server and storage medium
CN110175851A (en) A kind of cheating detection method and device
CN111259262A (en) Information retrieval method, device, equipment and medium
CN113408268A (en) Slot filling method, device, equipment and storage medium
CN113408278A (en) Intention recognition method, device, equipment and storage medium
CN113536770B (en) Text analysis method, device and equipment based on artificial intelligence and storage medium
CN113918467A (en) Financial system testing method, device, equipment and storage medium
CN114138243A (en) Function calling method, device, equipment and storage medium based on development platform
CN113900955A (en) Automatic testing method, device, equipment and storage medium
CN111651363A (en) Test data acquisition method, test data acquisition device, electronic device and medium
CN112181485A (en) Script execution method and device, electronic equipment and storage medium
CN112181482A (en) Version verification method and device, electronic equipment and storage medium
CN111639903A (en) Review processing method for architecture change and related equipment
CN114528851B (en) Reply sentence determination method, reply sentence determination device, electronic equipment and storage medium
CN113326365B (en) Reply sentence generation method, device, equipment and storage medium
CN113627186B (en) Entity relation detection method based on artificial intelligence and related equipment
CN113177543B (en) Certificate identification method, device, equipment and storage medium
CN113886263A (en) System testing method, device, equipment and storage medium
CN114942749A (en) Development method, device and equipment of approval system and storage medium
CN113420143A (en) Document abstract generation method, device, equipment and storage medium

Legal Events

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