CN110888641B - Script automatic generation method and device, server and storage medium - Google Patents

Script automatic generation method and device, server and storage medium Download PDF

Info

Publication number
CN110888641B
CN110888641B CN201911120815.2A CN201911120815A CN110888641B CN 110888641 B CN110888641 B CN 110888641B CN 201911120815 A CN201911120815 A CN 201911120815A CN 110888641 B CN110888641 B CN 110888641B
Authority
CN
China
Prior art keywords
script
web
template
web script
target
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.)
Active
Application number
CN201911120815.2A
Other languages
Chinese (zh)
Other versions
CN110888641A (en
Inventor
李金文
司科卫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Hongdian Technologies Corp
Original Assignee
Shenzhen Hongdian Technologies Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Hongdian Technologies Corp filed Critical Shenzhen Hongdian Technologies Corp
Priority to CN201911120815.2A priority Critical patent/CN110888641B/en
Publication of CN110888641A publication Critical patent/CN110888641A/en
Application granted granted Critical
Publication of CN110888641B publication Critical patent/CN110888641B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses an automatic script generation method, device, equipment and storage medium, wherein the method comprises the following steps: calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generating device when detecting a target control triggering the web script template so as to import the web script template to be analyzed into the script generating device; and analyzing the web script template to be analyzed based on the script analysis module to obtain target web script information, and importing the target web script information into a target file. According to the technical scheme, the technical problems that most of current testers are unfamiliar with programming languages, so that certain difficulty exists in writing web scripts, and different programming personnel have inconsistent coding styles, so that the web script output efficiency is affected, automatic writing of the web scripts is realized, the script writing efficiency is improved, and the technical effect of labor cost is reduced are solved.

Description

Script automatic generation method and device, server and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an automatic script generation method, an automatic script generation device, a server and a storage medium.
Background
Web scripts are currently generated primarily by selenium, which can incorporate multiple languages, such as python, java, ruby, etc. That is, to write web scripts, it is necessary to have sufficient knowledge of the selenium and programming language.
At present, most testers are not familiar with programming languages and selenium, so that certain difficulty exists in writing web scripts, and the web scripts are inconsistent in output due to inconsistent coding styles of different programmers, so that the technical problem of lower web script output efficiency is affected.
Disclosure of Invention
The invention provides a script automatic generation method, a script automatic generation device, a server and a storage medium, so as to realize the technical effect of automatically and quickly generating target web script information according to input information.
In a first aspect, an embodiment of the present invention provides a method for automatically generating a script, where the method includes:
calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generating device when detecting a target control triggering the web script template so as to import the web script template to be analyzed into the script generating device;
and analyzing the web script template to be analyzed based on a script analysis module to obtain target web script information, and importing the target web script information into a target file.
In a second aspect, an embodiment of the present invention further provides an apparatus for automatically generating a script, where the apparatus further includes:
the script generation device calling module is used for calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling the script generation device when a target control triggering the web script template is detected so as to import the web script template to be analyzed into the script generation device;
and the Web script information generation module is used for carrying out analysis processing on the Web script template to be analyzed based on the script analysis module to obtain target Web script information, and importing the target Web script information into a target file.
In a third aspect, an embodiment of the present invention further provides a server, where the server includes:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the script automatic generation method as described in any of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a script automatic generation method according to any of the embodiments of the present invention.
According to the technical scheme, the web script template to be analyzed is obtained by calling the pre-written web script template and editing the web script template, and when the target control triggering the web script template is detected, the script generation device is called to guide the web script template to be analyzed into the script generation device; the method comprises the steps of analyzing a web script template to be analyzed based on a script analysis module to obtain target web script information, importing the target web script information into a target file, solving the technical problems that most testers in the prior art are not familiar with programming languages and selenium, a certain difficulty exists in writing web scripts, and the web scripts are inconsistent due to inconsistent encoding styles of different programmers, so that the lower output efficiency of the web scripts is affected, automatic writing of the web scripts is realized, the script writing efficiency is improved, the labor cost is reduced, the format of the web scripts can be unified, and the technical effects of large-batch unified management are facilitated.
Drawings
In order to more clearly illustrate the technical solution of the exemplary embodiments of the present invention, a brief description is given below of the drawings required for describing the embodiments. It is obvious that the drawings presented are only drawings of some of the embodiments of the invention to be described, and not all the drawings, and that other drawings can be made according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for automatically generating a script according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a web script template provided in accordance with one embodiment of the present invention;
FIG. 3 is a schematic diagram of a page for generating web scripts according to a first embodiment of the present invention;
FIG. 4 is a flowchart of an automatic script generation method according to a second embodiment of the present invention;
FIG. 5 is a block diagram corresponding to the script automatic generation method according to the second embodiment of the present invention;
fig. 6 is a schematic structural diagram of an automatic script generating device according to a third embodiment of the present invention;
fig. 7 is a schematic diagram of a server structure according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a method for automatically generating a script according to an embodiment of the present invention, where the method may be performed by a script automatic generating device, and the device may be implemented in software and/or hardware.
As shown in fig. 1, the method of this embodiment includes:
s110, calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generation device when detecting a target control on the triggering web script template so as to import the web script template to be analyzed into the script generation device.
Wherein, web script templates are pre-written. As shown in fig. 2, the pre-written web script includes script steps, step names, browser types, URL paths, element positioning manners, element positioning values, actions, input contents, execution success expected results, execution failure expected results, and the like. The user who needs to obtain the target web script information can pre-call the web script template, edit the corresponding content in the template, and obtain the target web script information after processing the edited content. Each space of the edited content in the web script template may be used as a control. The target control may understand a control that triggers execution of the next operation, and optionally a "confirm" control. The script generating means may be understood as means for processing the content edited in the web script template. And editing the content in the web script template to obtain the script template as the web script template to be analyzed.
Specifically, when the target web script information needs to be obtained, a pre-written web script template can be called, corresponding content is edited in the web script template, and after the content editing is completed, a target control on the web script template can be triggered, namely, a 'confirmation' control on the web script template is triggered. Upon receiving a request corresponding to the "confirm" control, the script generation apparatus may be invoked to import the web script template to be parsed into the script generation apparatus.
Optionally, determining content corresponding to each control based on header information in the web script template to obtain a web script template to be analyzed, and calling the script generating device when detecting triggering a target control in the web script template to be analyzed; and acquiring the web script template to be analyzed based on a target import instruction, and importing the web script template to be analyzed into the script generation device.
The web script template to be analyzed is a template obtained after the content editing in the web script template is completed. The import instruction may be a pre-written application or a command that the user may trigger importing the web script template to be parsed into the script generating device.
Specifically, when the target web script information needs to be generated, the content needing to be edited can be determined according to the header information of the web script template, and after the content is edited, the determination control can be clicked or the content is edited, and the web script template written with the content is used as the web script template to be analyzed. After the web script template to be analyzed is obtained, the web script template to be analyzed can be imported to the script generating device based on the target import instruction.
S120, analyzing the web script template to be analyzed based on the script analyzing module to obtain target web script information, and importing the target web script information into a target file.
The script analysis module may be a module set in the script generating device and used for analyzing and processing the edited content in the web script template; the web script template may be a program code written in advance to analyze the content in the web script template. The target web script information is script information obtained by analyzing and processing web script contents. The object file is used to store object web script information.
Specifically, the script generating device comprises a script analyzing module, the script analyzing module can analyze and process the web script to be analyzed to obtain target web script information, and the target web script information is imported into a target file. The content in the target file may be as shown in fig. 3, and the obtained web script file may be as shown in fig. 3.
In this embodiment, the analyzing the web script template to be analyzed based on the script analyzing module to obtain the target web script information includes: the script analysis module reads the web script template to be analyzed according to a preset rule, and acquires the content in the web script template to be analyzed to obtain target web script information; a library file corresponding to the target web script information is determined and imported into the target web script information.
The preset rule may be to read the content in the web script template to be parsed line by line.
Specifically, the parsing module in the script generating device can process the content in the web script template to be parsed row by row to obtain the target web script information. To determine a library file corresponding to the target web script information because some common library is required during script execution, and import the library file into the target web script information.
After obtaining the target web script information, the target web script information also needs to be stored in the target file, and therefore, before importing the target web script information into the target file, a detection module in the script generating apparatus also needs to be called to determine whether the target file exists. Optionally, deleting the content in the file when the detection module detects that the file corresponding to the target web script information exists in the script generation directory, and taking the file with the emptied content as the target file; or, creating a target file corresponding to the target web script to store the target web script information in the target file based on the detection module not detecting that the file corresponding to the target web script information exists in the script generation directory.
Specifically, when the detection template detects that the script generation directory includes a file corresponding to the target web script information, namely an original file, the stored content in the original file can be deleted, namely all the content stored in the original file is deleted, and the original file with the emptied content is used as the target file, so that the target web script information is stored in the target file; it is also possible to delete the original file and reestablish the target file corresponding to the target web script information. Of course, if the detection module does not detect that the file corresponding to the target web script information exists in the script generation directory, the target file corresponding to the target web script information may be directly created to store the target web script information into the target file.
In order to determine whether an error exists in time in the process of generating the target web script information, a detection check program is also required to detect whether an error exists. Optionally, when the script analysis module analyzes the web script template to be analyzed, the verification program code is invoked to verify the analyzed web script information, and the web script information passing the verification is taken as target web script information.
When verification fails, error information may be displayed on the display interface, so that the user adjusts the content written in the web script according to the error information.
Specifically, if when the verification program code verifies that the web script information has dislocation when the target web script information is generated, that is, when the verification fails, a prompt of error information can be popped up on the display interface, and the user can re-edit the content in the web script template according to the error information until the target web script information is generated.
According to the technical scheme, the web script template to be analyzed is obtained by calling the pre-written web script template and editing the web script template, and when the target control triggering the web script template is detected, the script generation device is called to guide the web script template to be analyzed into the script generation device; the method comprises the steps of analyzing a web script template to be analyzed based on a script analysis module to obtain target web script information, importing the target web script information into a target file, solving the technical problems that most testers in the prior art are not familiar with programming languages and selenium, a certain difficulty exists in writing web scripts, and the web scripts are inconsistent due to inconsistent encoding styles of different programmers, so that the lower output efficiency of the web scripts is affected, automatic writing of the web scripts is realized, the script writing efficiency is improved, the labor cost is reduced, the format of the web scripts can be unified, and the technical effects of large-batch unified management are facilitated.
Example two
As a preferred embodiment of the foregoing embodiments, fig. 4 is another flow chart of a script automatic generation method according to a second embodiment of the present invention. As shown in fig. 4, the method includes:
s401, starting.
It is understood that the target web script information needs to be acquired.
S402, a template editing device.
The template editing device can be understood as a pre-written web script template. The Web script template may include: use case step, script name, browser type, URL path, element location mode, element location value, action, input content, execution success expected result, execution failure expected result. The user may edit the corresponding content in the corresponding box or may select the content to be written to each control when the user triggers each control.
Specifically, the user can edit the required content in the web script template according to the actual requirement to obtain the web script template to be analyzed.
S403, calling a script generator.
Wherein the script generator is script generating means. A script generator may be understood as a device that processes data compiled in a web script template.
Specifically, after the web script template to be parsed is obtained, the script generating device may be invoked.
S404, importing the web script template to be analyzed into a script generator.
The imported template is a web script template to be analyzed.
Specifically, after the script generation device is called, the web script template to be parsed may be imported into the script generator.
S405, selecting a language to be generated by the web script template to be parsed.
The user can set the type of the computer language according to the actual requirement, and the computer language is optional, namely, C language, java language and the like.
Specifically, after the user triggers the language selection control, multiple languages can be popped up on the display interface for selection by the user, and the user can select the language type according to actual requirements.
S406, a script analysis module in the script generator analyzes the web script template to be analyzed.
Specifically, after determining the language type to be converted, an analysis module in the script generator can be called to analyze the web script template to be analyzed. I.e. the content in the web script template to be parsed is obtained.
S407, judging whether the same script file name exists, if so, executing S408; if not, S409 is performed.
The script file refers to whether a file of a web script template to be parsed exists or not. If so, deleting the original web script template, namely deleting the stored original file, and executing S408; if the web script information is not stored, a new script file is established and is used as a target file to store the analyzed web script information.
S408, deleting the original script file.
That is, when the automation script files with the same name exist under the catalog, the original script file can be deleted, and a new script file can be re-created as a target file to store the parsed web script file to be parsed.
S409, generating a new target file under the script directory.
And creating a new script file under the catalog as a target file, and storing corresponding target web script information after the web script template to be analyzed is analyzed.
S410, writing the library file into the target web script information.
The library functions refer to some public libraries in the script execution process, and methods in the public libraries are needed in some scripts. Therefore, after the web script template to be parsed is parsed, a library file corresponding to the parsed content can be determined and imported into the web script to be parsed. The target web script information is the web script template to be analyzed after the analysis.
Specifically, the content in the web script template to be analyzed is analyzed, a library file corresponding to the target web script information is determined, and the library file is imported to the target web script information.
S411, writing the test function into the target file.
Wherein the test function may be understood as target web script information. The target web script information corresponds to content edited in the web script template to be parsed.
Specifically, web script contents may be sequentially written into the target file to obtain a web script file, i.e., a web script required by the user.
It should be noted that, writing the test function into the target file, that is, writing the target web script information into the target file may be: for clarity of understanding of specific logic, it may be understood in conjunction with fig. 2. Reading the template content row by row starting from the second row, a < 0 >. A < 9 > representing the value of each column of the row, respectively; if a [0] is not empty, a [0] is written into the script file, if a [2] is not empty, a [2] is written into the script file (a [2] is selected by a browser), and if a [3] is not empty, a [3] is written into the script file (a [3] is URL input); and determining whether to perform exception handling on the related operation of the element according to whether the expected result is filled in. If the expected result is filled, the operation of the element is processed abnormally, if the execution is successful, a [8] is returned, if the execution fails, a [9] is returned, the main function is exited, and False is returned. If the expected result is not filled in, the operation of the element is not subjected to abnormal detection processing, and the related operation of the element is directly written into the test main function. It should also be noted that the positioning of elements to perform a related action is considered a set of consecutive input features. A [4], a [5], a [6], a [7] (a [4] is element positioning mode, a [5] is element positioning value, a [6] is action, a [7] is input content) is added into an action list. The element positioning mode and the values in the action table are corresponding to specific scripts in a dictionary mode, for example, when a [4] is name, the corresponding script is 'find_element_by_name'. At this time, we can output the operation script of an element according to a certain format only according to the value corresponding to the action list. And repeatedly executing the operation, and executing the last line in the completed template to obtain a complete main test function script, namely a file corresponding to the content of the web script template to be analyzed.
S412, writing the test entry script into the target file.
Wherein a test entry script may be understood as a test command line. Test functions, i.e., target web script information, cannot run directly and must have a call to run. A test entry is a piece of code that can call a test function.
Specifically, a test entry script corresponding to the target web script information is determined, and the test entry script is written into the target file.
It should be noted that, the library file, the test main function and the test entry script together form a test script, and the script needs to be normally operated, which is indispensable. The library file determines whether some methods in the test master function can be normally executed, and the test master function is a main body part tested by us, namely the content in the web script template obtained after the web script template to be analyzed is analyzed. If the test content needs to be executed, an entry needs to be defined, so that the test script entry can call the test main function.
S413, judging whether the generation of the target web script information is successful; if not, then S414 is executed; if yes, S415 is performed.
In this embodiment, in order to improve the efficiency of acquiring the target web script information, an automatic verification module, that is, a verification program is also provided. The automatic checking module is used for judging whether the script is successfully generated. If not, the error reason can be popped up on the display interface, so that the user can edit new content in the web script template again according to the error prompt, that is, S414 is executed; if so, the verification is successful, the web script file is obtained, and the operation is ended.
S414, re-editing the web script template according to the error prompt information.
That is, the web script file is not automatically generated, and script error information may be popped up on the display interface so that the user may re-edit the content in the web script template according to the error information prompt.
When the editing of the web script template is completed, the above steps may be repeatedly performed to generate a web script file.
S415, ending.
And ending the program operation.
In this embodiment, a block diagram corresponding to the web script automation generation method may be referred to fig. 5. Writing content into a user web script template to obtain a web script template to be analyzed, and importing the web script template to be analyzed into a script generator so that the script generator can acquire original data in the web script template to be analyzed. The analysis module in the script generator can analyze the web script template to be analyzed, and the analyzed data contains contents such as script names, browser types and the like, so that target web script information is obtained. The target web script information includes a library file and a test script entry corresponding to script contents. If errors are reported in the process of generating the target web script information, the generation of the target web script information fails, the web script template needs to be edited again, and if errors are not reported, the generation of the script information is successful.
According to the technical scheme, the web script template to be analyzed is obtained by calling the pre-written web script template and editing the web script template, and when the target control triggering the web script template is detected, the script generation device is called to guide the web script template to be analyzed into the script generation device; the method comprises the steps of analyzing a web script template to be analyzed based on a script analysis module to obtain target web script information, importing the target web script information into a target file, solving the technical problems that most testers in the prior art are not familiar with programming languages and selenium, a certain difficulty exists in writing web scripts, and the web scripts are inconsistent due to inconsistent encoding styles of different programmers, so that the lower output efficiency of the web scripts is affected, automatic writing of the web scripts is realized, the script writing efficiency is improved, the labor cost is reduced, the format of the web scripts can be unified, and the technical effects of large-batch unified management are facilitated.
Example III
Fig. 6 is a schematic diagram of an automatic script generating device according to a third embodiment of the present invention, where the device includes: the script generating means invokes the module 610 and the Web script information generating module 620.
The script generation device calling module 610 is configured to call a pre-written web script template, edit the web script template to obtain a web script template to be parsed, and call a script generation device when detecting a target control triggering the web script template, so as to import the web script template to be parsed into the script generation device; and the Web script information generating module 620 is configured to perform an parsing process on the Web script template to be parsed based on the script parsing module, obtain target Web script information, and import the target Web script information into a target file.
According to the technical scheme, when the target control on the script template is detected to be triggered by calling the pre-written web script template, a script generating device is called to guide the web script template into the script generating device; the web script template is analyzed based on the script analysis module to obtain target web script information, and the target web script information is imported into a target folder, so that the problems that most testers in the prior art are not familiar with programming languages and selenium, a certain difficulty exists in writing web scripts, and the web scripts are inconsistent due to inconsistent encoding styles of different programmers are solved, the technical problem of lower web script output efficiency is affected, automatic writing of web scripts is realized, script writing efficiency is improved, labor cost is reduced, and the technical effects of convenience in large-scale unified management are achieved due to unified web script formats written.
On the basis of the technical scheme, the script generating device calling module is further used for:
determining contents corresponding to each control on the basis of header information in the web script template to obtain a web script template to be analyzed, and calling the script generating device when detecting triggering of a target control in the web script template to be analyzed;
and acquiring the web script template to be analyzed based on a target import instruction, and importing the web script template to be analyzed into the script generation device.
On the basis of the above technical solutions, the script generating device calling module is further configured to, before the importing the target web script information into the target folder, further be configured to:
deleting the content in the folder when the detection module detects that the folder corresponding to the target web script information exists in the script generation directory, and taking the folder with the emptied content as the target folder; or alternatively, the first and second heat exchangers may be,
creating a target folder corresponding to the target web script to store the target web script information in the target folder based on the detection module not detecting that the folder corresponding to the target web script information exists in the script generation directory.
On the basis of the above technical solutions, the web script information generating module is further configured to:
the script analysis module reads the web script template to be analyzed according to a preset rule, and acquires the content in the web script template to be analyzed to obtain the target web script information;
determining a library file corresponding to the target web script information, and importing the library file into the target web script information.
On the basis of the technical schemes, the device further comprises: the test entry script writing module is used for:
determining a test entry script corresponding to the target web script information, and writing the test entry script into the target file to test the target web script information stored in the target file.
On the basis of the above technical solutions, the web script information generating module is further configured to:
and when the analysis script module analyzes the web script template, calling a verification program code to verify the analyzed web script information, and taking the web script information passing the verification as the target web script information.
On the basis of the technical schemes, the device further comprises: a verification module for:
and when the verification fails, prompting error information so that a user can adjust the written content in the web script template according to the error information.
The script automatic generation device provided by the embodiment of the invention can execute the script automatic generation method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
It should be noted that each unit and module included in the above apparatus are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present invention.
Example IV
Fig. 7 is a schematic structural diagram of a server according to a fourth embodiment of the present invention. Fig. 7 shows a block diagram of an exemplary server 70 suitable for use in implementing embodiments of the present invention. The server 70 shown in fig. 7 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
As shown in FIG. 7, the server 70 is embodied in the form of a general purpose computing device. Components of server 70 may include, but are not limited to: one or more processors or processing units 701, a system memory 702, and a bus 703 that connects the various system components (including the system memory 702 and the processing units 701).
Bus 703 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Server 70 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by server 70 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 702 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 704 and/or cache memory 705. Server 70 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 706 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard drive"). Although not shown in fig. 7, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 703 through one or more data medium interfaces. Memory 702 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 708 having a set (at least one) of program modules 707 may be stored in, for example, memory 702, such program modules 707 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 707 generally perform the functions and/or methods of the embodiments described herein.
The server 70 may also be in communication with one or more external devices 709 (e.g., keyboard, pointing device, display 710, etc.), one or more devices that enable a user to interact with the server 70, and/or any devices (e.g., network card, modem, etc.) that enable the server 70 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 711. Also, server 70 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through a network adapter 712. As shown, network adapter 712 communicates with other modules of server 70 via bus 703. It should be appreciated that although not shown in fig. 7, other hardware and/or software modules may be used in connection with server 70, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 701 executes various functional applications and data processing by running a program stored in the system memory 72, for example, implements the script automatic generation method provided by the embodiment of the present invention.
Example five
A fifth embodiment of the present invention also provides a storage medium containing computer-executable instructions for performing a script automatic generation method when executed by a computer processor.
The method comprises the following steps:
calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generating device when detecting a target control triggering the web script template so as to import the web script template to be analyzed into the script generating device;
and analyzing the web script template to be analyzed based on a script analysis module to obtain target web script information, and importing the target web script information into a target file.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (8)

1. An automatic script generation method is characterized by comprising the following steps:
calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generating device when detecting a target control triggering the web script template so as to import the web script template to be analyzed into the script generating device;
analyzing the web script template to be analyzed based on a script analyzing module to obtain target web script information, and importing the target web script information into a target file;
the method comprises the steps of calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling a script generating device when detecting that a target control on the web script template is triggered, wherein the method comprises the following steps: determining contents corresponding to each control on the basis of header information in the web script template to obtain a web script template to be analyzed, and calling the script generating device when detecting triggering of a target control in the web script template to be analyzed;
acquiring the web script template to be analyzed based on a target importing instruction, and importing the web script template to be analyzed into the script generating device;
the web script template to be analyzed is a template obtained after the content editing in the web script template is completed; the importing instruction is a pre-written application program or a command for triggering the importing of the web script template to be analyzed to the script generating device by a user;
the script-based analysis module analyzes the web script template to be analyzed to obtain target web script information, and the method comprises the following steps:
the script analysis module reads the web script template to be analyzed according to a preset rule, and acquires the content in the web script template to be analyzed to obtain the target web script information;
determining a library file corresponding to the target web script information, and importing the library file into the target web script information;
the preset rules are that the content in the web script template to be analyzed is read row by row;
wherein, the library file, the test main function and the test entry script form a test script together; the library file determines whether a method in the test master function can be normally executed, wherein the test master function is a main part of the test, namely, the content in the web script template obtained after the web script template to be analyzed is analyzed; the test script entry invokes the test master function.
2. The method of claim 1, further comprising, prior to said importing said target web script information into a target file:
deleting the content in the file when the detection module detects that the file corresponding to the target web script information exists in the script generation catalog, and taking the file with the emptied content as a target file; or alternatively, the first and second heat exchangers may be,
and creating a target file corresponding to the target web script information based on the detection module not detecting that the file corresponding to the target web script information exists in the script generation directory, so as to store the target web script information into the target file.
3. The method as recited in claim 1, further comprising:
determining a test entry script corresponding to the target web script information, and writing the test entry script into the target file to test the target web script information stored in the target file.
4. The method according to claim 1, wherein the analyzing the web script template to be analyzed based on the script analyzing module to obtain the target web script information includes:
and when the script analysis module analyzes the web script template to be analyzed, calling a verification program code to verify the analyzed web script information, and taking the web script information passing the verification as the target web script information.
5. The method as recited in claim 4, further comprising:
and when the verification fails, displaying error information so that the user can re-edit the written content in the web script template according to the error information.
6. An automatic script generating device, characterized by further comprising:
the script generation device calling module is used for calling a pre-written web script template, editing the web script template to obtain a web script template to be analyzed, and calling the script generation device when a target control triggering the web script template is detected so as to import the web script template to be analyzed into the script generation device;
the web script information generation module is used for carrying out analysis processing on the web script template to be analyzed based on the script analysis module to obtain target web script information, and importing the target web script information into a target file;
the script generating device calling module is further used for: determining contents corresponding to each control on the basis of header information in the web script template to obtain a web script template to be analyzed, and calling the script generating device when detecting triggering of a target control in the web script template to be analyzed;
acquiring the web script template to be analyzed based on a target importing instruction, and importing the web script template to be analyzed into the script generating device;
the web script template to be analyzed is a template obtained after the content editing in the web script template is completed; the importing instruction is a pre-written application program or a command for triggering the importing of the web script template to be analyzed to the script generating device by a user;
wherein, web script information generation module is further used for:
the script analysis module reads the web script template to be analyzed according to a preset rule, and acquires the content in the web script template to be analyzed to obtain the target web script information;
determining a library file corresponding to the target web script information, and importing the library file into the target web script information;
the preset rules are that the content in the web script template to be analyzed is read row by row;
wherein, the library file, the test main function and the test entry script form a test script together; the library file determines whether a method in the test master function can be normally executed, wherein the test master function is a main part of the test, namely, the content in the web script template obtained after the web script template to be analyzed is analyzed; the test script entry invokes the test master function.
7. A server, the server comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the script automatic generation method of any of claims 1-5.
8. A storage medium containing computer executable instructions for performing the script automatic generation method of any of claims 1-5 when executed by a computer processor.
CN201911120815.2A 2019-11-15 2019-11-15 Script automatic generation method and device, server and storage medium Active CN110888641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911120815.2A CN110888641B (en) 2019-11-15 2019-11-15 Script automatic generation method and device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911120815.2A CN110888641B (en) 2019-11-15 2019-11-15 Script automatic generation method and device, server and storage medium

Publications (2)

Publication Number Publication Date
CN110888641A CN110888641A (en) 2020-03-17
CN110888641B true CN110888641B (en) 2024-04-05

Family

ID=69747616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911120815.2A Active CN110888641B (en) 2019-11-15 2019-11-15 Script automatic generation method and device, server and storage medium

Country Status (1)

Country Link
CN (1) CN110888641B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736815A (en) * 2020-06-28 2020-10-02 武汉精立电子技术有限公司 Test file script modular development tool, system and method
CN113033137B (en) * 2021-03-05 2022-02-01 北京润尼尔网络科技有限公司 Method and device for establishing digital component model and server

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7039899B1 (en) * 2002-03-27 2006-05-02 Oracle International Corporation System and method for automatically generating a script for testing software
CN103135979A (en) * 2011-12-05 2013-06-05 中国移动通信集团广东有限公司 Method, device and system for generating terminal applications
CN106126215A (en) * 2016-06-17 2016-11-16 深圳市麦斯杰网络有限公司 Business rule scenario generation method and device
CN108874649A (en) * 2017-05-08 2018-11-23 中兴通讯股份有限公司 Generation method, device and its computer equipment of automatic test script
CN109101231A (en) * 2018-08-07 2018-12-28 百度在线网络技术(北京)有限公司 Scripted code generation method, device, computer equipment and storage medium
CN110347598A (en) * 2019-07-10 2019-10-18 上海达梦数据库有限公司 A kind of test script generation method, device, server and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7039899B1 (en) * 2002-03-27 2006-05-02 Oracle International Corporation System and method for automatically generating a script for testing software
CN103135979A (en) * 2011-12-05 2013-06-05 中国移动通信集团广东有限公司 Method, device and system for generating terminal applications
CN106126215A (en) * 2016-06-17 2016-11-16 深圳市麦斯杰网络有限公司 Business rule scenario generation method and device
CN108874649A (en) * 2017-05-08 2018-11-23 中兴通讯股份有限公司 Generation method, device and its computer equipment of automatic test script
CN109101231A (en) * 2018-08-07 2018-12-28 百度在线网络技术(北京)有限公司 Scripted code generation method, device, computer equipment and storage medium
CN110347598A (en) * 2019-07-10 2019-10-18 上海达梦数据库有限公司 A kind of test script generation method, device, server and storage medium

Also Published As

Publication number Publication date
CN110888641A (en) 2020-03-17

Similar Documents

Publication Publication Date Title
US7673292B2 (en) Auto conversion of tests between different functional testing tools
US8516442B2 (en) Graphical user interface metadata evolution tool
CN105608012A (en) Automatic test method and automatic test system
CN110990411B (en) Data structure generation method and device, and calling method and device
CN110888641B (en) Script automatic generation method and device, server and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110659197B (en) Application test case generation method and device and software test system
CN113760729A (en) Code detection method and device
CN114077430A (en) Interface generation method and device, electronic equipment and storage medium
CN115658529A (en) Automatic testing method for user page and related equipment
CN111881054A (en) User interface automation test method, system, equipment and storage medium
CN113836014A (en) Interface testing method and device, electronic equipment and storage medium
CN114003269A (en) Component processing method and device, electronic equipment and storage medium
CN110837467B (en) Software testing method, device and system
CN111078529B (en) Client writing module testing method and device and electronic equipment
CN112988578A (en) Automatic testing method and device
CN112748930B (en) Compilation detection method, device, equipment and storage medium
CN112131611B (en) Data correctness verification method, device, equipment, system and storage medium
CN111399901B (en) State enumeration class generation method, device, server and storage medium
CN113760291A (en) Log output method and device
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN116820946B (en) Method and device for automatically testing compatibility of target software
US20230401074A1 (en) Automated testcase execution
CN113485688B (en) Code completion method and device, storage medium and electronic equipment
CN112988593B (en) Code analysis method, device, computer 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
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: Zhong Guo

Address after: 518,000 2301, 501, 401, Block A, Hongdian Building, No. 100, Huabao Road, Shansha Community, Pinghu Street, Longgang District, Shenzhen, Guangdong

Applicant after: SHENZHEN HONGDIAN TECHNOLOGIES Corp.

Address before: 518000 14 / F, 1501, 1502, 1503, 16 / F, building 1, building a, China Hisense science and Technology Park, No. 12, Ganli Road, Ganli Industrial Park, Buji street, Longgang District, Shenzhen City, Guangdong Province

Applicant before: SHENZHEN HONGDIAN TECHNOLOGIES Corp.

Country or region before: Zhong Guo

GR01 Patent grant
GR01 Patent grant