CN111026667A - Script execution method and device and electronic equipment - Google Patents

Script execution method and device and electronic equipment Download PDF

Info

Publication number
CN111026667A
CN111026667A CN201911262602.3A CN201911262602A CN111026667A CN 111026667 A CN111026667 A CN 111026667A CN 201911262602 A CN201911262602 A CN 201911262602A CN 111026667 A CN111026667 A CN 111026667A
Authority
CN
China
Prior art keywords
script
execution
executing
recording
browser
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
CN201911262602.3A
Other languages
Chinese (zh)
Other versions
CN111026667B (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.)
Beijing Lexuebang Network Technology Co Ltd
Original Assignee
Beijing Lexuebang Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Lexuebang Network Technology Co Ltd filed Critical Beijing Lexuebang Network Technology Co Ltd
Priority to CN201911262602.3A priority Critical patent/CN111026667B/en
Publication of CN111026667A publication Critical patent/CN111026667A/en
Application granted granted Critical
Publication of CN111026667B publication Critical patent/CN111026667B/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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a script execution method, a script execution device and electronic equipment; applied to a browser, the method comprises the following steps: acquiring a first script corresponding to a first end and a second script corresponding to a second end; executing the first script and the second script; saving the execution result of the first script and the execution result of the second script; recording the execution videos of the first script and the second script in a screen recording mode, and recording the starting time and the ending time of executing the first script and the second script. In the method, after a first script corresponding to the first end and a second script corresponding to the second end are obtained, the first script and the second script are executed, the execution result of the first script and the execution result of the second script are stored, the execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time for executing the first script and the second script are recorded. The execution video can be recorded, and the process of script execution is convenient to view and play back.

Description

Script execution method and device and electronic equipment
Technical Field
The invention relates to the technical field of automatic testing, in particular to a script execution method and device and electronic equipment.
Background
In the existing automatic test scheme, because the service scene is complex, the functions of different platforms are generally tested independently, and the real-time interaction of a user side and a customer service side is not realized; in the testing process, the control is not loaded due to the mutual influence of other elements of the network or the page, and the success rate of the script is not high; in the space loading process, the whole page is always required to be completely loaded by giving more fixed time for 5S or longer, and then the next operation is carried out, so that the waiting time is longer; the wrong execution result is saved through screenshot, and the execution result is associated with the execution report through a naming rule, so that the problem is inconvenient to follow, and the script execution process cannot be checked and played back.
Disclosure of Invention
In view of the above, the present invention provides a script execution method, apparatus and electronic device to record an execution video and facilitate viewing and playing back a script execution process.
In a first aspect, an embodiment of the present invention provides a script execution method, which is applied to a browser, and includes: acquiring a first script corresponding to a first end and a second script corresponding to a second end; executing the first script and the second script; saving the execution result of the first script and the execution result of the second script; recording the execution videos of the first script and the second script in a screen recording mode, and recording the starting time and the ending time of executing the first script and the second script.
In a preferred embodiment of the present invention, the step of executing the first script and the second script includes: establishing a first browser handle for the first end and a second browser handle for the second end; and switching between the first browser handle and the second browser handle, executing the first script by adopting the first browser handle, and executing the second script by adopting the second browser handle.
In a preferred embodiment of the present invention, the step of executing the first script by using the first browser handle includes: loading a control corresponding to the first script by adopting the first browser handle; periodically checking page elements corresponding to the controls in the first browser according to a preset time interval; and when the page element corresponding to the control is checked, executing the first script.
In a preferred embodiment of the present invention, the method further includes: and storing the first script and the second script in the same folder of the Jenkins server.
In a preferred embodiment of the present invention, the step of recording the execution videos of the first script and the second script in a screen recording manner, and recording the start time and the end time for executing the first script and the second script includes: when the first script starts to execute, recording an execution video of the first script in the first browser handle, and recording the starting time and the deadline of executing the first script; when the second script starts to execute, recording an execution video of the second script in the second browser handle, and recording the starting time and the ending time of executing the second script; when the first script and the second script start to execute simultaneously, recording the whole execution video of the first script in the first browser handle and the second script in the second browser handle, recording the starting time and the ending time of executing the first script simultaneously, and recording the starting time and the ending time of executing the second script simultaneously.
In a preferred embodiment of the present invention, the execution result includes a start time and an end time for generating an error; the method further comprises the following steps: based on the start time and the deadline at which the error is generated, a corresponding start time and deadline from the execution video are selected for playback.
In a second aspect, an embodiment of the present invention further provides a script execution apparatus, which is applied to a browser, and includes: the script acquisition module is used for acquiring a first script corresponding to the first end and a second script corresponding to the second end; the script execution module is used for executing the first script and the second script; the line result storage module is used for storing the execution result of the first script and the execution result of the second script; and the execution video recording module is used for recording the execution videos of the first script and the second script in a screen recording mode and recording the starting time and the ending time of executing the first script and the second script.
In a preferred embodiment of the present invention, the script executing module is configured to: establishing a first browser handle for the first end and a second browser handle for the second end; and switching between the first browser handle and the second browser handle, executing the first script by adopting the first browser handle, and executing the second script by adopting the second browser handle.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a processor and a memory, where the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the steps of the script execution method described above.
In a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the steps of the script execution method described above.
The embodiment of the invention has the following beneficial effects:
according to the script execution method, the script execution device and the electronic equipment, after a first script corresponding to a first end and a second script corresponding to a second end are obtained, the first script and the second script are executed, the execution result of the first script and the execution result of the second script are stored, the execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time of executing the first script and the second script are recorded. The execution video can be recorded, and the process of script execution is convenient to view and play back.
Additional features and advantages of the disclosure will be set forth in the description which follows, or in part may be learned by the practice of the above-described techniques of the disclosure, or may be learned by practice of the disclosure.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of a conventional automated testing method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a script execution method according to an embodiment of the present invention;
FIG. 3 is a flowchart of another script execution method provided by an embodiment of the present invention;
FIG. 4 is a diagram illustrating a script execution method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a script execution apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
At present, in a technical aspect, a UI (User Interface) automation test means that a running script executes a test case, so as to replace manual verification of the system function, which is the mode closest to the use scene and operation of a User. Referring to fig. 1, a schematic diagram of a conventional automatic test method, as shown in fig. 1, the conventional UI automatic test has the following features: 1. and the manual operation is covered for system verification, the automatic test case generally covers the main test scene, and the result after the operation is judged to be consistent with the expectation or not, so that the repeated and cyclic manual operation is reduced. 2. Reusability and secondary operation simplification, generally, UI automation test is recommended to be carried out on a relatively stable system so as to reduce updating of use cases and improve reusability. 3. Code robustness and operation of a scripting language on a control need a certain degree of stability, the control is generally waited to be completely loaded through sleep and implementation _ wait in the industry, even more fixed time is given for 5 seconds or more to wait for the whole page to be completely loaded, and then the next operation is carried out, so that the realizability of the front and back operations is ensured. 4. Problem traceability, what is more in the industry at present, is to write in a verification result corresponding to each use case by introducing a report mode of an Excel package or HTML (HyperText Markup Language), which is relatively intuitive, and meanwhile, during verification, a use case with a fail execution result is stored in a fixed path through screenshot, and a step of locating a BUG appears in a later stage.
The mode of combining Excel or HTML report and screenshot commonly adopted by the existing UI automation test has the following problems: 1. because the service scene is complex, the functions of different platforms are generally tested independently, and the real-time interaction between a user side and a customer service side is not realized; 2. the control is not loaded due to the mutual influence of other elements of the network or the page, and the operation of part of the control is unstable, so that the success rate of the script is not high; 3. in order to avoid script failure, fixed waiting time is set between each step, generally 1-5 seconds are different, the success probability of the script is ensured by the associated control even waiting for 8 seconds, the waiting time is long, server resources are wasted, and the production environment cost is very high; 4. the test result is written into the Excel and is separated from the full screen screenshot when the execution is wrong, the association is realized only through a naming rule, and the follow-up problem is inconvenient.
Based on this, the script execution method, the script execution device and the electronic device provided by the embodiment of the invention are applied to the technical field of automatic testing, and are particularly applicable to a testing situation adopting multi-segment interaction.
For the convenience of understanding the embodiment, a script execution method disclosed in the embodiment of the present invention will be described in detail first.
Example 1
An embodiment of the present invention provides a script execution method, which is applied to a browser, and referring to a flowchart of the script execution method shown in fig. 2, the script execution method includes the following steps:
step S202, a first script corresponding to the first end and a second script corresponding to the second end are obtained.
The first end and the second end refer to two ports used for interaction in the automated testing, wherein the first end can be a client side, and the second end can be a customer service side. The first section and the second end can be devices which can communicate with each other, such as a computer, a mobile phone, a tablet computer and the like. The first script is used by the first end for testing, and the second script is used by the second end for testing. Generally, a first script is executed by a first end and a second script is executed by a second end, which are executed on two devices respectively.
And step S204, executing the first script and the second script.
Respectively executing the first script and the second script, wherein the first script can be executed by adopting a first end, and the second script can be executed by adopting a second end; it is also possible to execute the first script and the second script together using the same end.
Step S206, saving the execution result of the first script and the execution result of the second script.
And after the script is executed, storing the execution result of the script. The execution result of the first script and the execution result of the second script may be saved as one file; the execution result of the first script may also be saved as one file, the execution result of the second script may be saved as another file, and finally, the two files may be associated or stored in one folder.
And step S208, recording the execution videos of the first script and the second script in a screen recording mode, and recording the starting time and the ending time for executing the first script and the second script.
The execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time of the execution of the first script and the second script are recorded.
According to the script execution method provided by the embodiment of the invention, after a first script corresponding to a first end and a second script corresponding to a second end are obtained, the first script and the second script are executed, the execution result of the first script and the execution result of the second script are stored, the execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time for executing the first script and the second script are recorded. The execution video can be recorded, and the process of script execution is convenient to view and play back.
Example 2
The embodiment of the invention also provides another script execution method; the method is realized on the basis of the method of the embodiment; the method focuses on a specific implementation manner for executing the first script and the second script.
Fig. 3 is a flowchart of another script execution method, which includes the steps of:
step S302, a first script corresponding to the first end and a second script corresponding to the second end are obtained.
Here, a PC (Personal Computer) side in which the first side is a client and the second side is a customer service side will be described as an example. Referring to a schematic diagram of a script execution method shown in fig. 4, a module 1 performs test environment and case preparation, builds python, selenium, and pytest frames, designs UI automation test cases, i.e., user operation steps, and completes code script design. Wherein python is a cross-platform computer programming language, selenium is a tool for Web application testing, and pytest is a fully functional python testing framework.
The module 2 executes the script to realize the automatic test process (the content of the module 2 is different according to different designed use cases) which comprises the following steps: the script automatically executes the designed use case and verification point, and automatically fills the result in the script, and stores the running data.
In the process of designing the first script and the second script, a timely communication scene needs to be realized, the waiting time is optimized, the process scripts are separated according to the correlation, remote parameterization construction is carried out, a screen recording synchronization function is added innovatively, and a directory tree is formed by combining case (time) starting and ending time, so that an automatic test result is more visual, and the problem of backtracking is more convenient.
When the use case script (i.e. the first script and the second script) is designed, an explicit waiting method may be adopted, specifically executed through step a 1-step A3:
and step A1, loading the control corresponding to the first script by using the first browser handle.
And (3) packaging, checking and loading an arbitrary _ ready (), summarizing and classifying the attributes of the loaded control, and continuing the next step after the loading is finished.
Step A2, periodically checking the page elements corresponding to the controls in the first browser according to a preset time interval.
And (3) using an explicit waiting method (explicit waiting, namely checking whether the page elements exist at intervals, and throwing an exception until the set time is not detected) self. For example, the loading of basic elements of a page is completed after self.wait.unit (regular _ ready ()), the clicking operation is executed when the attribute of a button is clickable, and self.wait.unit (ec.element _ to _ be _ clickable ((by.css _ SELECTOR' li [ ng-click () "))))))) click (), the failure of a script caused by incomplete loading is avoided without fixedly waiting for 3 seconds each time, and the running time of the whole script after adjustment is reduced from 4 minutes of the original scheme to 54 seconds at present.
Step A3, when the page element corresponding to the control is checked, executing the first script.
When the page elements corresponding to the controls are checked, the unstable controls are considered to be loaded completely, then the first script is executed, so that the time cost of BUG tracking can be shortened, the playback time is correspondingly shortened, and the positioning problem is quicker.
As shown in FIG. 4, the first script and the second script are stored in the same folder of the Jenkins server. Jenkins is an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform to enable continuous integration of software. The script separation can be constructed in whole or in part, and the whole test flow is automatically executed. If the script needs to be modified, git (git is an open source distributed version control system) submits a code merging branch, and Jenkins is constructed; if the completed script is executed, a script flow is constructed through different parameters; returning to the whole process, namely, only needing to use tag name as null; returning to partial flow, and filling the file name to construct; separating the scripts according to the correlation, wherein problematic processes can independently construct regression and independently execute; the whole process is realized remotely and is not influenced by a local network or the environment.
Step S304, a first browser handle is established for the first end, and a second browser handle is established for the second end.
In a device, a first browser handle is established for a first end and a second browser handle is established for a second end. The handle is a call to a data structure inside the system, that is, two handles are established in the browser, namely a first browser handle and a second browser handle. The first browser handle and the second browser handle are designed, a real-time communication scene can be achieved, and the requirement on timeliness of message interaction is higher.
Step S306, switching is carried out between the first browser handle and the second browser handle, the first script is executed by adopting the first browser handle, and the second script is executed by adopting the second browser handle.
By switching different scripts, two scripts, namely a first script and a second script, are executed on one device. If the browser handle is switched to the first browser handle, the first script can be executed in the first browser handle; if a switch is made to the second browser handle, a second script may be executed in the second browser handle.
In this manner. After a first script corresponding to the first end and a second script corresponding to the second end are obtained, a first browser handle and a second browser handle are respectively established for the first end and the second end, and the first end and the second end are switched by switching the first browser handle and the second browser handle, so that interactive testing of the first end and the second end is realized.
The first browser handle and the second browser handle may be switched by: the automatic tool seleniumwebdriver opens the customer service system, calls out the system window-1, IMwindow0, logs in the user system window1, obtains the browser handle window _ handles, and the browser switches different windows to enable the user and the customer service to realize online conversation, verifies automatic reply, quick reply, and sends pictures, characters and expressions, including the main mode of timely communication.
Step S308, saving the execution result of the first script and the execution result of the second script.
The execution result comprises the starting time and the ending time of the error, and the corresponding starting time and the corresponding ending time can be selected from the execution video for playback based on the starting time and the ending time of the error. The VNC _ START _ NUM START end time of each use case is obtained. For example, the use case test _03call _ Callout starts from the 8 th second and ends from the 13 th second, the directory tree video is clicked to play back from the 8 th second, the video time node corresponding to the wrong use case can be accurately located, operations related before and after the error are checked, and the playback interface provides error stack detail information.
Step S310, recording the execution videos of the first script and the second script in a screen recording mode, and recording the starting time and the ending time of executing the first script and the second script.
The execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time of the execution of the first script and the second script are recorded. As shown in fig. 4, a VNC (Virtual network console) screen recording playback mode of Linux is adopted, and Linux is a set of operating system.
Specifically, the execution videos of the first script and the second script can be recorded separately, and the execution videos of the first script and the second script can also be recorded simultaneously, and the execution is performed through the following steps: when the first script starts to execute, recording an execution video of the first script in the first browser handle, and recording the starting time and the deadline of executing the first script; when the second script starts to execute, recording an execution video of the second script in the second browser handle, and recording the starting time and the ending time of executing the second script; when the first script and the second script start to execute simultaneously, recording the whole execution video of the first script in the first browser handle and the second script in the second browser handle, recording the starting time and the ending time of executing the first script simultaneously, and recording the starting time and the ending time of executing the second script simultaneously.
As shown in fig. 4, the server starts the VNC recording browser to perform the whole-process operation, obtains the start deadline of each use case, and generates a directory tree with time node tags corresponding to the video and the use case name, where the directory tree includes the total duration of the whole script, the start deadline, the durations of scripts in different processes, the start deadline, and the duration and the start deadline of each use case. And a playback link of the test case is generated through the report file and the video, and each executed case can be played back quickly, so that a factual basis is provided for verification operation.
According to the method provided by the embodiment of the invention, a multi-terminal interaction scene is realized by switching the handle of the browser; the packaging inspection loading method is combined with an explicit waiting method, so that the regression time is reduced; the separation script is constructed wholly or partially through parameters, and the whole interactive test process is executed remotely; the whole test process can be viewed and played back based on VNC screen recording; and the playback interface provides error stack detail information and positions the time point of the error case.
Example 3
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides a script execution apparatus, and as shown in fig. 5, a schematic structural diagram of the script execution apparatus includes:
a script obtaining module 51, configured to obtain a first script corresponding to the first end and a second script corresponding to the second end;
a script execution module 52 for executing the first script and the second script;
an execution result saving module 53, configured to save an execution result of the first script and an execution result of the second script;
and the execution video recording module 54 is used for recording the execution videos of the first script and the second script in a screen recording mode and recording the starting time and the ending time of executing the first script and the second script.
According to the script execution method and device provided by the embodiment of the invention, after the first script corresponding to the first end and the second script corresponding to the second end are obtained, the first script and the second script are executed, the execution result of the first script and the execution result of the second script are stored, the execution videos of the first script and the second script can be recorded in a screen recording mode, and the starting time and the ending time for executing the first script and the second script are recorded. The execution video can be recorded, and the process of script execution is convenient to view and play back.
In some embodiments, the script execution module is to establish a first browser handle for the first end and a second browser handle for the second end; and switching between the first browser handle and the second browser handle, executing the first script by adopting the first browser handle, and executing the second script by adopting the second browser handle.
In some embodiments, the script execution module is configured to load a control corresponding to a first script by using a first browser handle; periodically checking page elements corresponding to the controls in the first browser according to a preset time interval; and when the page element corresponding to the control is checked, executing the first script.
In some embodiments, the apparatus further comprises a Jenkins server saving module for saving the first script and the second script in a same folder of the Jenkins server.
In some embodiments, the execution video recording module is configured to record an execution video of the first script in the first browser handle when the first script starts executing, and record a start time and an end time for executing the first script; when the second script starts to execute, recording an execution video of the second script in the second browser handle, and recording the starting time and the ending time of executing the second script; when the first script and the second script start to execute simultaneously, recording the whole execution video of the first script in the first browser handle and the second script in the second browser handle, recording the starting time and the ending time of executing the first script simultaneously, and recording the starting time and the ending time of executing the second script simultaneously.
In some embodiments, the execution results include a start time and an end time to generate an error; the device also comprises an error playback module used for selecting corresponding starting time and ending time from the execution video for playback based on the starting time and the ending time for generating the error.
The script execution device provided by the embodiment of the invention has the same technical characteristics as the script execution method provided by the embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved.
Example 4
The embodiment of the invention also provides the electronic equipment which is used for operating the script execution method; referring to fig. 6, an electronic device includes a memory 100 and a processor 101, where the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to implement the script execution method.
Further, the electronic device shown in fig. 6 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
The Memory 100 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but that does not indicate only one bus or one type of bus.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the script execution method.
The script execution method, the script execution device, and the computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the apparatus and/or the electronic device described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A script execution method, applied to a browser, includes:
acquiring a first script corresponding to a first end and a second script corresponding to a second end;
executing the first script and the second script;
saving the execution result of the first script and the execution result of the second script;
recording the execution videos of the first script and the second script in a screen recording mode, and recording the starting time and the ending time of executing the first script and the second script.
2. The method of claim 1, wherein the step of executing the first script and the second script comprises:
establishing a first browser handle for the first end and a second browser handle for the second end;
and switching between the first browser handle and the second browser handle, executing the first script by adopting the first browser handle, and executing the second script by adopting the second browser handle.
3. The method of claim 2, wherein executing the first script using the first browser handle comprises:
loading a control corresponding to the first script by using the first browser handle;
periodically checking page elements corresponding to the controls in the first browser according to a preset time interval;
and when the page element corresponding to the control is detected, executing the first script.
4. The method of claim 1, further comprising:
and storing the first script and the second script into the same folder of a Jenkins server.
5. The method according to claim 2, wherein the step of recording the execution video of the first script and the second script by means of screen recording and recording the start time and the deadline for executing the first script and the second script comprises:
when the first script starts to execute, recording an execution video of the first script in the first browser handle, and recording a starting time and a deadline for executing the first script;
when the second script starts to execute, recording an execution video of the second script in the second browser handle, and recording a starting time and an ending time for executing the second script;
when the first script and the second script start to execute simultaneously, recording the whole execution video of the first script in the first browser handle and the second script in the second browser handle, recording the starting time and the ending time of executing the first script simultaneously, and recording the starting time and the ending time of executing the second script simultaneously.
6. The method of claim 1, wherein the execution result includes a start time and an end time for generating an error; the method further comprises the following steps:
and selecting corresponding starting time and ending time from the execution video for playback based on the starting time and the ending time of the generated error.
7. A script execution device, applied to a browser, includes:
the script acquisition module is used for acquiring a first script corresponding to the first end and a second script corresponding to the second end;
the script execution module is used for executing the first script and the second script;
the execution result storage module is used for storing the execution result of the first script and the execution result of the second script;
and the execution video recording module is used for recording the execution videos of the first script and the second script in a screen recording mode and recording the starting time and the ending time of executing the first script and the second script.
8. The apparatus of claim 7, wherein the script execution module is configured to:
establishing a first browser handle for the first end and a second browser handle for the second end;
and switching between the first browser handle and the second browser handle, executing the first script by adopting the first browser handle, and executing the second script by adopting the second browser handle.
9. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor to perform the steps of the script execution method of any one of claims 1 to 6.
10. A computer-readable storage medium having stored thereon computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the steps of the script execution method of any one of claims 1 to 6.
CN201911262602.3A 2019-12-09 2019-12-09 Script execution method and device and electronic equipment Active CN111026667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911262602.3A CN111026667B (en) 2019-12-09 2019-12-09 Script execution method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911262602.3A CN111026667B (en) 2019-12-09 2019-12-09 Script execution method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111026667A true CN111026667A (en) 2020-04-17
CN111026667B CN111026667B (en) 2023-05-05

Family

ID=70205487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911262602.3A Active CN111026667B (en) 2019-12-09 2019-12-09 Script execution method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111026667B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114282222A (en) * 2021-12-16 2022-04-05 上海健交科技服务有限责任公司 Trusted script loading and executing method and device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1555014A (en) * 2003-12-26 2004-12-15 中兴通讯股份有限公司 Human-machine order testing method
US20110191676A1 (en) * 2010-01-29 2011-08-04 Microsoft Corporation Cross-Browser Interactivity Recording, Playback, and Editing
US20120311539A1 (en) * 2011-05-31 2012-12-06 International Business Machines Corporation Interactive semi-automatic test case maintenance
CN103092756A (en) * 2013-01-08 2013-05-08 彭勇 Interactive automated testing system and method thereof
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
CN109144850A (en) * 2018-07-23 2019-01-04 上海携程商务有限公司 The test method interactively communicated and system of mobile terminal
CN109344066A (en) * 2018-09-29 2019-02-15 深圳市奇林软件有限公司 A kind of test method of browser page, system and terminal
CN109388556A (en) * 2017-08-11 2019-02-26 航天信息股份有限公司 A kind of analysis method and device of test process
CN109446064A (en) * 2018-09-18 2019-03-08 珠海金山网络游戏科技有限公司 A kind of interactive testing method based on browser
CN109783379A (en) * 2019-01-03 2019-05-21 广州云测信息技术有限公司 Script execution method of specifying error and device
CN110297759A (en) * 2019-05-22 2019-10-01 深圳壹账通智能科技有限公司 A kind of method, apparatus making test page script, equipment and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1555014A (en) * 2003-12-26 2004-12-15 中兴通讯股份有限公司 Human-machine order testing method
US20110191676A1 (en) * 2010-01-29 2011-08-04 Microsoft Corporation Cross-Browser Interactivity Recording, Playback, and Editing
US20120311539A1 (en) * 2011-05-31 2012-12-06 International Business Machines Corporation Interactive semi-automatic test case maintenance
CN103092756A (en) * 2013-01-08 2013-05-08 彭勇 Interactive automated testing system and method thereof
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
CN109388556A (en) * 2017-08-11 2019-02-26 航天信息股份有限公司 A kind of analysis method and device of test process
CN109144850A (en) * 2018-07-23 2019-01-04 上海携程商务有限公司 The test method interactively communicated and system of mobile terminal
CN109446064A (en) * 2018-09-18 2019-03-08 珠海金山网络游戏科技有限公司 A kind of interactive testing method based on browser
CN109344066A (en) * 2018-09-29 2019-02-15 深圳市奇林软件有限公司 A kind of test method of browser page, system and terminal
CN109783379A (en) * 2019-01-03 2019-05-21 广州云测信息技术有限公司 Script execution method of specifying error and device
CN110297759A (en) * 2019-05-22 2019-10-01 深圳壹账通智能科技有限公司 A kind of method, apparatus making test page script, equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
M.B.COHEN等: "Constructing test suites for interaction testing", 《25TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING,2003.PROCEEDINGS》 *
程佩: "基于Selenium WebDriver和Selendroid的自动化测试的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
高培等: "浏览器兼容性自动化测试方法研究", 《福建工程学院学报》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114282222A (en) * 2021-12-16 2022-04-05 上海健交科技服务有限责任公司 Trusted script loading and executing method and device

Also Published As

Publication number Publication date
CN111026667B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN111104315A (en) Test script generation method and device and computer readable storage medium
CN111159049B (en) Automatic interface testing method and system
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
US9405660B2 (en) Intermediary for testing content and applications
US8515876B2 (en) Dry-run design time environment
US10073761B2 (en) Legacy system
CN107508720B (en) Automatic testing method and device
CN108228444B (en) Test method and device
CN111522749B (en) Page testing method and device, readable storage medium and electronic equipment
CN110716853A (en) Test script recording method, application program testing method and related device
CN105045602A (en) Method and device for constructing Hadoop application development framework and electronic device
WO2017028574A1 (en) Router testing method and testing device
CN112882930B (en) Automatic test method and device, storage medium and electronic equipment
CN109657475A (en) Code vulnerabilities check method, apparatus, equipment and storage medium
CN111026667B (en) Script execution method and device and electronic equipment
CN113064816B (en) Testing device and testing method for programmable logic device software
CN117499287A (en) Web testing method, device, storage medium and proxy server
CN111078529B (en) Client writing module testing method and device and electronic equipment
US9374437B2 (en) Schema validation proxy
CN115514677B (en) Method and system for server dial testing
CN116166536A (en) Test method, test device, electronic equipment and storage medium
CN113961469A (en) Script online debugging method, system and storage medium
CN110704262A (en) Dynamic service logic debugging method, system, storage medium and intelligent device
CN114584760B (en) Media resource dial testing method and related equipment
CN108446229A (en) A kind of automated testing method and device

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