CN113342644A - Test script automatic generation method and device based on syntax analysis technology - Google Patents

Test script automatic generation method and device based on syntax analysis technology Download PDF

Info

Publication number
CN113342644A
CN113342644A CN202110599792.9A CN202110599792A CN113342644A CN 113342644 A CN113342644 A CN 113342644A CN 202110599792 A CN202110599792 A CN 202110599792A CN 113342644 A CN113342644 A CN 113342644A
Authority
CN
China
Prior art keywords
test script
program
communication area
test
extracting
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
CN202110599792.9A
Other languages
Chinese (zh)
Other versions
CN113342644B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110599792.9A priority Critical patent/CN113342644B/en
Publication of CN113342644A publication Critical patent/CN113342644A/en
Application granted granted Critical
Publication of CN113342644B publication Critical patent/CN113342644B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis

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)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method and a device for automatically generating a test script based on a grammar analysis technology, which can be applied to the field of finance, and the method comprises the following steps: acquiring a test script source code from a test script program library; extracting a communication area of a test script program from a test script source code by a syntax analysis technology; and generating a test script case according to the communication area of the test script program and the acquired system log file. The method provided by the application is based on the logs of the existing production or test environment, a large amount of test automation scripts are rapidly generated, the scripts and data are continuously updated according to the logs, the purpose of freshness preservation is achieved, and after the version of technical transformation is updated, the problems are rapidly found through rapid playback in the specified environment. Therefore, the production and maintenance efficiency of the automatic test script can be greatly improved, and the feasibility of the whole automatic test scheme is improved.

Description

Test script automatic generation method and device based on syntax analysis technology
Technical Field
The present application belongs to the field of test technologies, and in particular, to a method and an apparatus for automatically generating a test script based on a syntax analysis technique.
Background
At present, automatic testing is widely applied to tests of regression testing, performance testing and technical transformation type projects, and has obvious and considerable benefits, but the manual compiling cost and the maintenance cost of an automatic script (including the maintenance of data and the maintenance of the script after a page or an interface is changed) are high, so that many testers prefer the manual testing and do not use the automatic testing, how to improve the compiling speed of the automatic script and reduce the maintenance cost of data and the script is the key for popularizing the automatic testing and enabling the automatic testing to play a role.
Disclosure of Invention
The application provides a method and a device for automatically generating a test script based on a syntax analysis technology, which are used for at least solving the problems of high manual compiling cost and high maintenance cost of the current automatic script.
According to a first aspect of the present application, there is provided a method for automatically generating a test script based on a parsing technique, including:
acquiring a test script source code from a test script program library;
extracting a communication area of a test script program from a test script source code by a syntax analysis technology;
and generating a test script case according to the communication area of the test script program and the acquired system log file.
In one embodiment, the extracting the communication area of the test script program from the test script source code by the syntax analysis technique includes:
judging the type of script source codes;
performing syntax analysis by adopting a syntax analysis technology according to the type of the script source code to obtain an analysis result;
and extracting the communication area of the test script program from the analysis result.
In one embodiment, generating a test script case according to a communication area of a test script program and an acquired system log file includes:
acquiring input and output information of a test script from a system log file;
and generating a test script case according to the communication area and the input and output information.
In one embodiment, obtaining input and output information of a test script from a system log file includes:
extracting program names and return values from system log files by using a syntax analysis technology, and filtering to obtain effective log information;
and extracting input and output information of the test script from the effective log information through a syntax analysis technology.
According to the second aspect of the present application, there is also provided an apparatus for automatically generating a test script based on a parsing technique, including:
the source code acquisition unit is used for acquiring a test script source code from a test script library;
the communication area extracting unit is used for extracting the communication area of the test script program from the test script source code through a syntax analysis technology;
and the test script generating unit is used for generating a test script case according to the communication area of the test script program and the acquired system log file.
In one embodiment, the cell extraction unit includes:
the type judging module is used for judging the type of the script source code;
the grammar analysis module is used for carrying out grammar analysis by adopting a grammar analysis technology according to the type of the script source code to obtain an analysis result;
and the communication area extracting module is used for extracting the communication area of the test script program from the analysis result by the communication area.
In one embodiment, the test script generating unit includes:
the information acquisition module is used for acquiring input and output information of the test script from the system log file;
and the script generating module is used for generating a test script case according to the communication area and the input and output information.
In one embodiment, the information acquisition module includes:
the effective log obtaining module is used for extracting a program name and a return value from the system log file through a syntax analysis technology and filtering to obtain effective log information;
and the extraction module is used for extracting the input and output information of the test script from the effective log information through a syntax analysis technology.
According to a third aspect of the present application, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for automatically generating a test script based on a parsing technique when executing the program.
According to a fourth aspect of the present application, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of a method for automatic generation of a test script based on a parsing technique.
According to the technical scheme, the application provides a method and a device for automatically generating a test script based on a syntax analysis technology, and the method comprises the following steps: acquiring a test script source code from a test script program library; extracting a communication area of a test script program from a test script source code by a syntax analysis technology; and generating a test script case according to the communication area of the test script program and the acquired system log file. According to the method and the device, the automatic generation system for the deployment test cases can be realized without changing and influencing the existing system through a syntax analysis technology, convenience and rapidness are realized, the universality is high, the method and the device are effective for various programs and scenes, the implementation can be realized only by mastering the structural characteristics of the programs and recording logs according to a set format during program operation, and in addition, the technical effects of improving the test efficiency and saving the test resources by automatically generating case scripts are also realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an automatic test script generation method based on a parsing technique according to the present application.
Fig. 2 is a flowchart of extracting a communication area of a test script program according to an embodiment of the present application.
FIG. 3 is a flowchart illustrating the generation of a test script case according to an embodiment of the present application.
Fig. 4 is a flowchart of acquiring input/output information of a test script in the embodiment of the present application.
Fig. 5 is a schematic diagram of an automatic test script generation system provided in an embodiment of the present application.
Fig. 6 is a block diagram of an apparatus for automatically generating a test script based on a parsing technique according to the present application.
Fig. 7 is a block diagram of a communication area extracting unit according to an embodiment of the present application.
Fig. 8 is a block diagram of a test script generation unit in the embodiment of the present application.
Fig. 9 is a block diagram of an information acquisition module in the embodiment of the present application.
Fig. 10 is a specific implementation of an electronic device in an embodiment of the present application.
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 only a part of the embodiments of the present invention, and not all of the embodiments. 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 should be noted that the method and apparatus for automatically generating a test script based on a parsing technique disclosed in the present application may be applied to the financial field, and may also be applied to other fields except the financial field.
At present, automatic testing is widely applied to tests of regression testing, performance testing and technical transformation type projects, and has obvious and considerable benefits, but the manual compiling cost and the maintenance cost of an automatic script (including the maintenance of data and the maintenance of the script after a page or an interface is changed) are high, so that many testers prefer the manual testing and do not use the automatic testing, how to improve the compiling speed of the automatic script and reduce the maintenance cost of data and the script is the key for popularizing the automatic testing and enabling the automatic testing to play a role.
Based on the above, the present application provides a test script automatic generation method based on a syntax analysis technology, a test script automatic generation device based on a syntax analysis technology, an electronic device, and a computer readable storage medium, respectively, through the syntax analysis technology, the present application can implement deployment of a test case automatic generation system without changing and affecting the existing system, which is convenient and fast, and has strong versatility, and is effective for various programs and scenes, and can be implemented only by grasping the structural characteristics of the program and recording logs according to a predetermined format during program operation, and in addition, the technical effects of automatically generating the case script, improving the test efficiency, and saving test resources are also achieved.
Based on the above, the present application further provides an automatic test script generation apparatus based on a parsing technique, which is used for implementing the automatic test script generation method based on a parsing technique provided in one or more embodiments of the present application, and the apparatus may be in communication connection with a client device by itself or through a third-party server, and returns an execution result to a client.
It is understood that the client devices may include smart phones, tablet electronic devices, network set-top boxes, portable computers, desktop computers, Personal Digital Assistants (PDAs), in-vehicle devices, smart wearable devices, and the like. Wherein, intelligence wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In another practical application scenario, the aforementioned monitoring apparatus based on the K8S event mechanism performs part of the monitoring based on the K8S event mechanism in the server as described above, or all operations are performed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. If all operations are performed in the client device, the client device may further include a processor for performing specific processing based on monitoring of the K8S event mechanism.
The client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
The server and the client device may communicate using any suitable network protocol, including network protocols not yet developed at the filing date of this application. The network protocol may include, for example, a TCP/IP protocol, a UDP/IP protocol, an HTTP protocol, an HTTPS protocol, or the like. Of course, the network Protocol may also include, for example, an RPC Protocol (Remote Procedure Call Protocol), a REST Protocol (Representational State Transfer Protocol), and the like used above the above Protocol.
The following embodiments and application examples are specifically and individually described in detail.
In order to solve the problems existing in the prior art, the present application provides an automatic test script generation method based on a syntax analysis technology, as shown in fig. 1, including:
s101: and acquiring the test script source code from the test script program library.
S102: and extracting the communication area of the test script program from the test script source code by a syntax analysis technology.
S103: and generating a test script case according to the communication area of the test script program and the acquired system log file.
In one embodiment, the extracting the communication area of the test script program from the test script source code by the parsing technique, as shown in fig. 2, includes:
s201: and judging the type of script source code.
S202: and carrying out syntactic analysis by adopting a syntactic analysis technology according to the type of the script source code to obtain an analysis result.
S203: and extracting the communication area of the test script program from the analysis result.
In an embodiment, generating a test script case according to a communication area of a test script program and an acquired system log file, as shown in fig. 3, includes:
s301: and acquiring input and output information of the test script from the system log file.
S302: and generating a test script case according to the communication area and the input and output information.
In an embodiment, the obtaining the input and output information of the test script from the system log file, as shown in fig. 4, includes:
s401: and extracting the program name and the return value from the system log file by a syntax analysis technology, and filtering to obtain effective log information.
S402: and extracting input and output information of the test script from the effective log information through a syntax analysis technology.
In an embodiment, as shown in fig. 5, the system is a set of test script automatic generation system, and the system automatically generates test cases for scenarios such as regression testing and performance testing. The work flow of the system comprises the following steps:
s1: first, based on the program library, the source code is obtained.
S2: and carrying out syntactic analysis according to the program type, and extracting the communication area of the program.
S3: and filtering the log file of the existing system through a program name, a return code and the like to obtain an effective log.
S4: output information is extracted from the valid log.
S5: and integrating information based on the program communication area and the program input and output information to generate an automatic test case of the program.
S6: the generated automatic test case can support the automatic test of the program in turn, for example, for regression test, performance test and other scenarios.
The method provided by the application is based on the logs of the existing production or test environment, a large amount of test automation scripts are rapidly generated, the scripts and data are continuously updated according to the logs, the purpose of freshness preservation is achieved, and after the version of technical transformation is updated, the problems are rapidly found through rapid playback in the specified environment. Therefore, the production and maintenance efficiency of the automatic test script can be greatly improved, and the feasibility of the whole automatic test scheme is improved.
Based on the same inventive concept, the embodiment of the present application further provides an automatic test script generation apparatus based on a syntax analysis technique, which can be used to implement the method described in the above embodiments, as described in the following embodiments. The automatic test script generating device based on the grammar analysis technology solves the problems by a similar principle to the automatic test script generating method based on the grammar analysis technology. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. While the system described in the embodiments below is preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
According to the second aspect of the present application, there is also provided an apparatus for automatically generating a test script based on a parsing technique, as shown in fig. 6, including:
a source code obtaining unit 601, configured to obtain a test script source code from a test script library;
a communication area extracting unit 602, configured to extract a communication area of the test script program from the test script source code through a syntax analysis technique;
the test script generating unit 603 is configured to generate a test script case according to the communication area of the test script program and the obtained system log file.
In one embodiment, as shown in fig. 7, the communication area extracting unit 602 includes:
a type determining module 701, configured to determine a type of the script source code;
a syntax analysis module 702, configured to perform syntax analysis by using a syntax analysis technique according to the type of the script source code to obtain an analysis result;
and a communication area extracting module 703, configured to extract, by the communication area, the communication area of the test script program from the analysis result.
In one embodiment, as shown in fig. 8, the test script generating unit 603 includes:
an information obtaining module 801, configured to obtain input and output information of a test script from a system log file;
and the script generating module 802 is configured to generate a test script case according to the communication area and the input/output information.
In one embodiment, as shown in fig. 9, the information obtaining module 801 includes:
an effective log obtaining module 901, configured to extract a program name and a return value from a system log file through a syntax analysis technique, and filter the program name and the return value to obtain effective log information;
and an extracting module 902, configured to extract input and output information of the test script from the valid log information through a parsing technique.
In one embodiment, the present application provides a set of test script automatic generation system, which automatically generates test cases for scenarios such as regression testing and performance testing. The work flow of the system comprises the following steps:
s1: first, based on the program library, the source code is obtained.
S2: and carrying out syntactic analysis according to the program type, and extracting the communication area of the program.
S3: and filtering the log file of the existing system through a program name, a return code and the like to obtain an effective log.
S4: output information is extracted from the valid log.
S5: and integrating information based on the program communication area and the program input and output information to generate an automatic test case of the program.
S6: the generated automatic test case can support the automatic test of the program in turn, for example, for regression test, performance test and other scenarios.
The device provided by the application can realize the automatic generation system of the deployment test case without changing and influencing the existing system through the syntax analysis technology, is convenient and fast, has strong universality, is effective to various programs and scenes, can be implemented only by mastering the structural characteristics of the programs and recording logs according to a set format when the programs run, and also realizes the technical effects of automatically generating case scripts, improving the test efficiency and saving test resources.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
An embodiment of the present application further provides a specific implementation manner of an electronic device capable of implementing all steps in the method in the foregoing embodiment, and referring to fig. 10, the electronic device specifically includes the following contents:
a processor (processor)1001, a memory 1002, a communication Interface (Communications Interface)1003, a bus 1004, and a nonvolatile memory 1005;
the processor 1001, the memory 1002, and the communication interface 1003 complete mutual communication through the bus 1004;
the processor 1001 is configured to call the computer programs in the memory 1002 and the nonvolatile memory 1005, and when the processor executes the computer programs, the processor implements all the steps in the method in the foregoing embodiments, for example, when the processor executes the computer programs, the processor implements the following steps: s101: and acquiring the test script source code from the test script program library.
S102: and extracting the communication area of the test script program from the test script source code by a syntax analysis technology.
S103: and generating a test script case according to the communication area of the test script program and the acquired system log file.
Embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments, where the computer-readable storage medium stores thereon a computer program, and the computer program when executed by a processor implements all the steps of the method in the above embodiments, for example, the processor implements the following steps when executing the computer program:
s101: and acquiring the test script source code from the test script program library.
S102: and extracting the communication area of the test script program from the test script source code by a syntax analysis technology.
S103: and generating a test script case according to the communication area of the test script program and the acquired system log file.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the hardware + program class embodiment, since it is substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the partial description of the method embodiment. Although embodiments of the present description provide method steps as described in embodiments or flowcharts, more or fewer steps may be included based on conventional or non-inventive means. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or end product executes, it may execute sequentially or in parallel (e.g., parallel processors or multi-threaded environments, or even distributed data processing environments) according to the method shown in the embodiment or the figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, article, or apparatus that comprises the recited elements is not excluded. For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, in implementing the embodiments of the present description, the functions of each module may be implemented in one or more software and/or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules or sub-units, and the like. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form. The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein. The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of an embodiment of the specification. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction. The above description is only an example of the embodiments of the present disclosure, and is not intended to limit the embodiments of the present disclosure. Various modifications and variations to the embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present specification should be included in the scope of the claims of the embodiments of the present specification.

Claims (10)

1. A test script automatic generation method based on a syntax analysis technology is characterized by comprising the following steps:
acquiring a test script source code from a test script program library;
extracting a communication area of a test script program from the test script source code by a syntax analysis technology;
and generating a test script case according to the communication area of the test script program and the acquired system log file.
2. The method of claim 1, wherein the extracting the communication area of the test script program from the test script source code by the parsing technique comprises:
judging the type of the script source code;
performing syntax analysis by adopting a syntax analysis technology according to the type of the script source code to obtain an analysis result;
and extracting the communication area of the test script program from the analysis result.
3. The method for automatically generating a test script based on a parsing technique of claim 2, wherein the generating a test script case according to the communication area of the test script program and the obtained system log file comprises:
acquiring input and output information of a test script from the system log file;
and generating a test script case according to the communication area and the input and output information.
4. The method for automatically generating a test script based on a parsing technique of claim 3, wherein the obtaining input and output information of the test script from the system log file comprises:
extracting program names and return values from the system log files by using a syntax analysis technology, and filtering to obtain effective log information;
and extracting input and output information of the test script from the effective log information through a syntax analysis technology.
5. An apparatus for automatically generating a test script based on a parsing technique, comprising:
the source code acquisition unit is used for acquiring a test script source code from a test script library;
the communication area extracting unit is used for extracting the communication area of the test script program from the test script source code through a syntax analysis technology;
and the test script generating unit is used for generating a test script case according to the communication area of the test script program and the acquired system log file.
6. The parsing-based test script automatic generation apparatus of claim 5, wherein the communication area extraction unit comprises:
the type judgment module is used for judging the type of the script source code;
the syntactic analysis module is used for carrying out syntactic analysis by adopting a syntactic analysis technology according to the type of the script source code to obtain an analysis result;
and the communication area extracting module is used for extracting the communication area of the test script program from the analysis result by the communication area.
7. The parsing-based test script automatic generation apparatus of claim 6, wherein the test script generation unit comprises:
the information acquisition module is used for acquiring the input and output information of the test script from the system log file;
and the script generation module is used for generating a test script case according to the communication area and the input and output information.
8. The parsing-based test script automatic generation apparatus of claim 7, wherein the information obtaining module comprises:
the effective log obtaining module is used for extracting a program name and a return value from the system log file through a syntax analysis technology and filtering to obtain effective log information;
and the extraction module is used for extracting the input and output information of the test script from the effective log information through a syntax analysis technology.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for automatically generating a test script based on a parsing technique of any one of claims 1 to 4 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for automatically generating a test script based on a parsing technique according to any one of claims 1 to 4.
CN202110599792.9A 2021-05-31 2021-05-31 Automatic test script generation method and device based on grammar analysis technology Active CN113342644B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110599792.9A CN113342644B (en) 2021-05-31 2021-05-31 Automatic test script generation method and device based on grammar analysis technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110599792.9A CN113342644B (en) 2021-05-31 2021-05-31 Automatic test script generation method and device based on grammar analysis technology

Publications (2)

Publication Number Publication Date
CN113342644A true CN113342644A (en) 2021-09-03
CN113342644B CN113342644B (en) 2024-03-26

Family

ID=77472505

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110599792.9A Active CN113342644B (en) 2021-05-31 2021-05-31 Automatic test script generation method and device based on grammar analysis technology

Country Status (1)

Country Link
CN (1) CN113342644B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508779A (en) * 2011-11-17 2012-06-20 北京北纬点易信息技术有限公司 Automatic performance test script generating system based on web crawler logs and automatic performance test script generating method based on same
CN102799437A (en) * 2012-07-18 2012-11-28 清华大学 Automatic generating method and device of compiling script
CN108073400A (en) * 2017-12-07 2018-05-25 湖北三新文化传媒有限公司 Software automation construction method, server and storage medium
US20180293157A1 (en) * 2017-04-10 2018-10-11 Fmr Llc Automated script creation and source code generation for testing mobile devices
CN109828900A (en) * 2018-12-14 2019-05-31 深圳壹账通智能科技有限公司 Test script automatic generation method, device, electronic equipment and storage medium
CN110347598A (en) * 2019-07-10 2019-10-18 上海达梦数据库有限公司 A kind of test script generation method, device, server and storage medium
CN111930617A (en) * 2020-07-31 2020-11-13 中国工商银行股份有限公司 Automatic testing method and device based on data objectification
CN112783756A (en) * 2019-11-11 2021-05-11 深圳Tcl数字技术有限公司 Automatic test method, terminal, system and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508779A (en) * 2011-11-17 2012-06-20 北京北纬点易信息技术有限公司 Automatic performance test script generating system based on web crawler logs and automatic performance test script generating method based on same
CN102799437A (en) * 2012-07-18 2012-11-28 清华大学 Automatic generating method and device of compiling script
US20180293157A1 (en) * 2017-04-10 2018-10-11 Fmr Llc Automated script creation and source code generation for testing mobile devices
CN108073400A (en) * 2017-12-07 2018-05-25 湖北三新文化传媒有限公司 Software automation construction method, server and storage medium
CN109828900A (en) * 2018-12-14 2019-05-31 深圳壹账通智能科技有限公司 Test script automatic generation method, device, electronic equipment and storage medium
CN110347598A (en) * 2019-07-10 2019-10-18 上海达梦数据库有限公司 A kind of test script generation method, device, server and storage medium
CN112783756A (en) * 2019-11-11 2021-05-11 深圳Tcl数字技术有限公司 Automatic test method, terminal, system and storage medium
CN111930617A (en) * 2020-07-31 2020-11-13 中国工商银行股份有限公司 Automatic testing method and device based on data objectification

Also Published As

Publication number Publication date
CN113342644B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
US9990209B2 (en) Digital assistance device for facilitating multi-stage setup
CN106547527B (en) JavaScript file construction method and device
CN110750458A (en) Big data platform testing method and device, readable storage medium and electronic equipment
Fisher et al. Spring integration in action
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
EP3113020A1 (en) Data processing device and method for processing serial tasks
CN105045602A (en) Method and device for constructing Hadoop application development framework and electronic device
US10387370B2 (en) Collecting test results in different formats for storage
US20220138074A1 (en) Method, electronic device and computer program product for processing data
CN113076253A (en) Test method and test device
CN111881471A (en) Non-intrusive log data desensitization method, device and system
CN114253798A (en) Index data acquisition method and device, electronic equipment and storage medium
CN108153896B (en) Processing method and device for input data and output data
CN113032281A (en) Method and device for acquiring code coverage rate in real time
CN117290250A (en) Automatic test framework establishment method, computer equipment and computer storage medium
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN113342644B (en) Automatic test script generation method and device based on grammar analysis technology
CN110704099A (en) Alliance chain construction method and device and electronic equipment
CN115237399A (en) Method for collecting data, storage medium, processor and engineering vehicle
CN115481334A (en) Protocol-based route skipping method and device, electronic equipment and storage medium
CN112379967B (en) Simulator detection method, device, equipment and medium
CN113485942A (en) Automatic testing method and device based on independent module
CN114003457A (en) Data acquisition method and device, storage medium and electronic equipment
CN113515447A (en) System automation test method and device
CN112433950A (en) Method for automatically building test environment, electronic 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
GR01 Patent grant
GR01 Patent grant