CN113900932A - Test script generation method, device, medium and electronic equipment - Google Patents

Test script generation method, device, medium and electronic equipment Download PDF

Info

Publication number
CN113900932A
CN113900932A CN202111131513.2A CN202111131513A CN113900932A CN 113900932 A CN113900932 A CN 113900932A CN 202111131513 A CN202111131513 A CN 202111131513A CN 113900932 A CN113900932 A CN 113900932A
Authority
CN
China
Prior art keywords
control
test script
page
tested
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111131513.2A
Other languages
Chinese (zh)
Inventor
王福洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Neusoft Corp
Original Assignee
Neusoft 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 Neusoft Corp filed Critical Neusoft Corp
Priority to CN202111131513.2A priority Critical patent/CN113900932A/en
Publication of CN113900932A publication Critical patent/CN113900932A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The disclosure relates to a test script generation method, a test script generation device, a test script generation medium and electronic equipment, wherein the method comprises the following steps: responding to the monitored target operation in the page to be tested, and acquiring a control aimed at by the target operation and control characteristic information of the control; acquiring an operation record image corresponding to the target operation according to the control feature information; and generating a test script according to the operation record image, wherein the test script is used for testing the page to be tested. Through the technical scheme, a technician can visually know the control to which the target operation aims through the operation recording image in the test script, the readability of the generated test script can be improved, the technician can visually check the test script conveniently, the accuracy of the test script is guaranteed, and the accuracy of testing the page to be tested according to the test script is guaranteed.

Description

Test script generation method, device, medium and electronic equipment
Technical Field
The present disclosure relates to the field of page testing technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for generating a test script.
Background
Before a website is released, a large amount of test work needs to be performed to test whether a page in the website is abnormal, and currently, an automatic test mode is usually adopted to test the page so as to save labor cost and time cost.
The automatic test needs to record a test script (Testingscript) in advance, the test script refers to a series of instructions of a specific test, and the automatic test tool executes corresponding operation according to the test script, so that the function of the page is tested, and therefore whether the automatic test process can be smoothly carried out depends on the accuracy of the test script. After the test script is recorded or written, a technician usually needs to check the test script to check whether the steps therein are accurate or not, so that the readability of the test script directly affects the judgment of the technician, thereby affecting the accuracy of the test script.
Disclosure of Invention
The purpose of the present disclosure is to provide a test script generation method, device, medium, and electronic device, which can improve the readability of the generated test script, and facilitate a technician to visually check the test script, thereby ensuring the accuracy of the test script.
In order to achieve the above object, in a first aspect, the present disclosure provides a test script generation method, where the method includes:
responding to the monitored target operation in the page to be tested, and acquiring a control aimed at by the target operation and control characteristic information of the control;
acquiring an operation record image corresponding to the target operation according to the control feature information;
and generating a test script according to the operation record image, wherein the test script is used for testing the page to be tested.
Optionally, the obtaining, according to the control feature information, an operation record image corresponding to the target operation includes:
determining whether a preset control screenshot condition is met or not according to the control characteristic information;
under the condition that the control screenshot condition is met, screenshot operation is carried out on the control, and the operation recording image is obtained according to the captured image;
and under the condition that the control screenshot condition is not met, performing screenshot operation on a local area where an operation position corresponding to the target operation is located in the page to be tested, and obtaining the operation record image according to the intercepted image.
Optionally, the control feature information includes feature information for characterizing whether the control is a hidden control, feature information for characterizing whether the control is a nested control, feature information for characterizing whether the control has size information of the control, and feature information for characterizing whether the control has position information of the control in the page to be tested;
the determining whether a preset control screenshot condition is met according to the control characteristic information includes:
and if the control is not a hidden control, the control is not a nested control, the size information of the control is contained, and the position information of the control in the page to be tested is contained, determining that the screenshot condition of the control is met.
Optionally, the screenshot operation performed on the control includes:
acquiring size information of the control and position information of the control in the page to be tested;
and performing screenshot operation on the control according to the size information and the position information.
Optionally, the obtaining the operation recording image according to the captured image includes:
and marking the operation position corresponding to the target operation in the captured image to obtain the operation record image.
Optionally, before the step of generating a test script according to the operation recording image, the method further includes:
acquiring extensible markup language path information of the control;
generating a test script according to the operation record image, wherein the test script comprises:
and generating the test script according to the operation record image and the path information of the extensible markup language.
Optionally, the page to be tested is a Web page.
In a second aspect, the present disclosure provides a test script generating apparatus, the apparatus comprising:
the first acquisition module is used for responding to monitoring target operation carried out in a page to be tested and acquiring a control aimed at by the target operation and control characteristic information of the control;
the second obtaining module is used for obtaining an operation record image corresponding to the target operation according to the control feature information;
and the generating module is used for generating a test script according to the operation record image, wherein the test script is used for testing the page to be tested.
Optionally, the second obtaining module includes:
the determining sub-module is used for determining whether a preset control screenshot condition is met or not according to the control characteristic information;
the first obtaining sub-module is used for carrying out screenshot operation on the control under the condition that the screenshot condition of the control is met, and obtaining the operation record image according to the intercepted image;
and the second obtaining sub-module is used for carrying out screenshot operation on a local area where an operation position corresponding to the target operation is located in the page to be tested under the condition that the screenshot condition of the control is not met, and obtaining the operation record image according to the intercepted image.
Optionally, the control feature information includes feature information for characterizing whether the control is a hidden control, feature information for characterizing whether the control is a nested control, feature information for characterizing whether the control has size information of the control, and feature information for characterizing whether the control has position information of the control in the page to be tested;
the determination submodule is further configured to: and if the control is not a hidden control, the control is not a nested control, the size information of the control is contained, and the position information of the control in the page to be tested is contained, determining that the screenshot condition of the control is met.
Optionally, the first obtaining sub-module includes:
the third obtaining sub-module is used for obtaining the size information of the control and the position information of the control in the page to be tested;
and the screenshot submodule is used for carrying out screenshot operation on the control according to the size information and the position information.
Optionally, the first obtaining sub-module and the second obtaining sub-module include:
and the marking submodule is used for marking the operation position corresponding to the target operation in the intercepted image so as to obtain the operation record image.
Optionally, the apparatus further comprises:
the third obtaining module is used for obtaining the extensible markup language path information of the control before the generating module generates the test script according to the operation record image;
the generation module comprises:
and the generating submodule is used for generating the test script according to the operation record image and the extensible markup language path information.
In a third aspect, the present disclosure provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method provided by the first aspect of the present disclosure.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method provided by the first aspect of the present disclosure.
According to the technical scheme, the control to which the target operation aims and the control characteristic information of the control are obtained in response to monitoring of the target operation performed in the page to be tested, the operation recording image corresponding to the target operation is obtained according to the control characteristic information, the operation recording image can be used for recording the target operation and describing the target operation, the test script is generated according to the operation recording image, and technicians can intuitively know the control to which the target operation aims and what kind of operation is performed on the control through the operation recording image in the test script. Compared with the mode that only the path language is adopted to describe the control in the related technology, the readability of the generated test script can be improved, technicians can conveniently and visually check the test script, and therefore the accuracy of the test script is guaranteed, and the accuracy of testing the page to be tested according to the test script is guaranteed.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a schematic diagram illustrating a page to be tested according to an exemplary embodiment.
Fig. 2 is a schematic diagram of a test script generated in a manner of the related art.
FIG. 3 is a flow diagram illustrating a method of test script generation in accordance with an exemplary embodiment.
FIG. 4 is a diagram illustrating a test script generated using an embodiment of the present disclosure, according to an exemplary embodiment.
Fig. 5 is a flowchart illustrating a method for obtaining an operation log image corresponding to a target operation according to control feature information according to an exemplary embodiment.
Fig. 6 is a block diagram illustrating a test script generating apparatus according to an example embodiment.
FIG. 7 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
First, a method of generating a test script in the related art will be described. Fig. 1 is a schematic diagram of a page to be tested according to an exemplary embodiment, as shown in fig. 1, the page to be tested is a login page and includes a user name control, a password control and a login control, and testing the page may include five operation steps, where the first operation step is to click the user name control, the second operation step is to input a user name, the third operation step is to click the password control, the fourth operation step is to input a password, and the fifth operation step is to click the login control.
When a test script is generated in the related art, an Xpath (Extensible Markup Language Path information) is generally used to describe a control related to an operation step, fig. 2 is a schematic diagram of the test script generated in the related art, as shown in fig. 2, the Xpath is a Path Language and is poor in readability, the control related to the operation step is described through the Xpath, and a technician cannot easily identify and know which control on a page is operated in each test step, so that the technician cannot conveniently check the test script, and therefore the accuracy of the test script cannot be guaranteed, and the accuracy of an automated test according to the test script is affected.
In view of this, the present disclosure provides a method, an apparatus, a medium, and an electronic device for generating a test script, which can improve the readability of the generated test script, and facilitate a technician to visually check the test script, thereby ensuring the accuracy of the test script.
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
Fig. 3 is a flowchart illustrating a test script generation method according to an exemplary embodiment, which may be applied to an electronic device with processing capability, such as a terminal device of a personal computer, a notebook computer, and the like. As shown in fig. 3, the method may include S301 to S303.
In S301, in response to monitoring a target operation performed in a page to be tested, a control targeted by the target operation and control feature information of the control are obtained.
The page to be tested can be any page needing to be tested, for example, a Web page, and the page to be tested can include one or more controls, such as a button control, an input control, a tree control, a toolbar and the like, and can also include a hidden control and a nested control.
The target operation may be any one of operation steps required for testing the page to be tested, and may be, for example, a click operation, an input operation, or the like. An event listener may be integrated in the page to be tested, and the event listener may be configured to monitor a target operation performed in the page to be tested, and acquire a control targeted by the target operation, where the control targeted by the target operation may be a control at an operation position corresponding to the target operation, for example, a control clicked by a mouse when a click operation is performed. The control characteristic information of the control can be characteristic information for describing the control, and the control characteristic information can be stored in the page content of the page to be tested.
In S302, an operation recording image corresponding to the target operation is acquired according to the control feature information.
The target operation is an operation performed on the control, and an operation record image corresponding to the target operation can be acquired according to the control characteristic information of the control. For example, whether the control can be directly subjected to screenshot can be judged according to the control feature information, if the control can be directly subjected to screenshot, the operation record image can be the image of the control, and if the control cannot be directly subjected to screenshot, the operation record image can be the image around the operation position corresponding to the target operation, so that the target operation is recorded through the image around the operation position.
In S303, a test script is generated based on the operation recording image. The test script is used for testing the page to be tested.
The operation recording image can be used for recording target operation and describing the target operation, a test script is generated according to the operation recording image, and technicians can intuitively know the control to which the target operation aims and what kind of operation is performed on the control through the operation recording image in the test script.
Taking the page to be tested shown in fig. 1 as an example, fig. 4 is a schematic diagram of a test script generated by the embodiment of the present disclosure according to an exemplary embodiment. As shown in fig. 4, compared with the mode that only Xpath describes the control shown in fig. 2, in the test script generated by the embodiment of the present disclosure, each operation step has a corresponding operation record image, which is convenient for a technician to visually check the test script, and improves the readability of the test script.
According to the technical scheme, the control to which the target operation aims and the control characteristic information of the control are obtained in response to monitoring of the target operation performed in the page to be tested, the operation recording image corresponding to the target operation is obtained according to the control characteristic information, the operation recording image can be used for recording the target operation and describing the target operation, the test script is generated according to the operation recording image, and technicians can intuitively know the control to which the target operation aims and what kind of operation is performed on the control through the operation recording image in the test script. Compared with the mode that only the path language is adopted to describe the control in the related technology, the readability of the generated test script can be improved, technicians can conveniently and visually check the test script, and therefore the accuracy of the test script is guaranteed, and the accuracy of testing the page to be tested according to the test script is guaranteed.
Fig. 5 is a flowchart illustrating a method for obtaining an operation recording image corresponding to a target operation according to control feature information according to an exemplary embodiment, and as shown in fig. 5, S302 may include S501 to S503.
In S501, it is determined whether a preset control screenshot condition is satisfied according to the control feature information.
For example, the control feature information may include feature information for characterizing whether the control is a hidden control, feature information for characterizing whether the control is a nested control, feature information for characterizing whether the control has size information of the control, and feature information for characterizing whether the control has position information of the control in the page to be tested.
In order to avoid occupying the space of the page, when the page is designed, some controls can be set as hidden controls, and the hidden controls have certain functions but are invisible in the page, namely are not directly displayed in the page. Complex page structures typically involve nesting of controls, and some controls may have other controls embedded within them, i.e., nested controls may exist in the page. In addition, some widgets may not have dimension information, such as a widget in the form of a hyperlink, and there may not be specific dimension information if there is no rectangular box outside the hyperlink, and there may not be position information of the widget in the page to be tested if there is no fixed position of the widget.
Accordingly, the implementation of S501 may be: and if the control is not a hidden control, the control is not a nested control, the size information of the control is contained, and the position information of the control in the page to be tested is contained, determining that the screenshot condition of the control is met.
If the control is a hidden control, namely the control is invisible in a page to be tested, the control cannot be directly subjected to screenshot, the condition for screenshot of the control can be determined not to be met, if the control is a nested control, namely other controls are nested in the control, the condition for screenshot of the control can be determined not to be met, if the size information and the position information of the control are not available, the control cannot be directly subjected to screenshot, and the condition for screenshot of the control can be determined not to be met.
In S502, under the condition that the control screenshot condition is satisfied, a screenshot operation is performed on the control, and an operation recording image is obtained according to the captured image.
If the control screenshot condition is met, the representation can directly perform screenshot on the control, screenshot operation can be performed on the control, and the implementation mode of performing screenshot operation on the control can be as follows: acquiring size information of a control and position information of the control in a page to be tested; and performing screenshot operation on the control according to the size information and the position information.
The control can be a rectangular frame, the size information of the control can comprise width information and height information of the control, the position information of the control can comprise coordinate information of each vertex of the control in a page to be tested, the control is subjected to screenshot operation according to the size information and the position information, an image of the control can be intercepted, and an operation recording image is obtained according to the intercepted image.
In S503, under the condition that the control screenshot condition is not satisfied, a screenshot operation is performed on a local area where an operation position corresponding to the target operation is located in the page to be tested, and an operation recording image is obtained according to the captured image.
If the control screenshot condition is not met, the control cannot be directly screenshot, screenshot operation can be performed on a local area where an operation position corresponding to the target operation is located, the shape and the size of the local area can be preset, and the method is not limited. As an example, the local area may be a rectangle centered at the operation position, for example, a square having a width and a height of 50 pixels, or a circle centered at the operation position and having a radius of a preset distance.
Therefore, even if the screenshot of the control cannot be directly performed, the target operation can be accurately described and recorded through the image of the local area where the operation position is located.
According to the technical scheme, whether the preset control screenshot condition is met or not is determined according to the control characteristic information, if the preset control screenshot condition is met, screenshot operation can be directly performed on the control, an operation record image is obtained according to the captured image, and a technician can intuitively know which control the target operation is directed at according to the operation record image. If the control screenshot condition is not met, screenshot operation can be performed on a local area where an operation position corresponding to the target operation is located, and the image of the local area can accurately describe and record the target operation.
In this disclosure, regardless of whether the screenshot operation is performed on the control or the screenshot operation is performed on the local area where the operation position corresponding to the target operation is located, the embodiment of obtaining the operation record image according to the captured image may be: and marking the operation position corresponding to the target operation in the captured image to obtain an operation record image.
The operation position may be marked by a preset mark, and the color and shape of the preset mark are not limited in the present disclosure, as shown in fig. 4, the preset mark may be a dot, and it should be noted that the marking manner shown in fig. 4 is only an example. Therefore, the operation position is marked in the operation record image, and technicians can know the control corresponding to the target operation and visually find out the corresponding operation position through the operation record image, so that the readability of the test script is further improved.
In an embodiment, before the step of generating the test script according to the operation recording image in S303, the test script generation method provided by the present disclosure may further include:
acquiring extensible markup language path information of a control;
the extensible markup language path information, Xpath, is used for describing the control in a path language manner.
Accordingly, S303 may include: and generating a test script according to the operation record image and the path information of the extensible markup language.
As shown in fig. 4, the test script may include the operation recording image and the xml path information of the control, and the test script is generated according to the operation recording image and the xml path information, so that the test script is more complete, and the recording and description of the target operation are more complete.
Based on the same inventive concept, the present disclosure also provides a test script generating apparatus, and fig. 6 is a block diagram of a test script generating apparatus according to an exemplary embodiment, as shown in fig. 6, the apparatus 600 may include:
a first obtaining module 601, configured to obtain a control targeted by a target operation and control feature information of the control in response to monitoring the target operation performed in a page to be tested;
a second obtaining module 602, configured to obtain, according to the control feature information, an operation record image corresponding to the target operation;
a generating module 603, configured to generate a test script according to the operation record image, where the test script is used to test the page to be tested.
By adopting the device 600, in response to monitoring the target operation performed in the page to be tested, the control targeted by the target operation and the control characteristic information of the control are obtained, the operation recording image corresponding to the target operation is obtained according to the control characteristic information, the operation recording image can be used for recording the target operation and describing the target operation, the test script is generated according to the operation recording image, and a technician can intuitively know the control targeted by the target operation and what kind of operation is performed on the control through the operation recording image in the test script. Compared with the mode that only the path language is adopted to describe the control in the related technology, the readability of the generated test script can be improved, technicians can conveniently and visually check the test script, and therefore the accuracy of the test script is guaranteed, and the accuracy of testing the page to be tested according to the test script is guaranteed.
Optionally, the second obtaining module 602 may include:
the determining sub-module is used for determining whether a preset control screenshot condition is met or not according to the control characteristic information;
the first obtaining sub-module is used for carrying out screenshot operation on the control under the condition that the screenshot condition of the control is met, and obtaining the operation record image according to the intercepted image;
and the second obtaining sub-module is used for carrying out screenshot operation on a local area where an operation position corresponding to the target operation is located in the page to be tested under the condition that the screenshot condition of the control is not met, and obtaining the operation record image according to the intercepted image.
Optionally, the control feature information includes feature information for characterizing whether the control is a hidden control, feature information for characterizing whether the control is a nested control, feature information for characterizing whether the control has size information of the control, and feature information for characterizing whether the control has position information of the control in the page to be tested;
the determination submodule is further configured to: and if the control is not a hidden control, the control is not a nested control, the size information of the control is contained, and the position information of the control in the page to be tested is contained, determining that the screenshot condition of the control is met.
Optionally, the first obtaining sub-module includes:
the third obtaining sub-module is used for obtaining the size information of the control and the position information of the control in the page to be tested;
and the screenshot submodule is used for carrying out screenshot operation on the control according to the size information and the position information.
Optionally, the first obtaining sub-module and the second obtaining sub-module include:
and the marking submodule is used for marking the operation position corresponding to the target operation in the intercepted image so as to obtain the operation record image.
Optionally, the apparatus 600 may further include:
a third obtaining module, configured to obtain extensible markup language path information of the control before the generating module 603 generates a test script according to the operation record image;
the generating module 603 may include:
and the generating submodule is used for generating the test script according to the operation record image and the extensible markup language path information.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 7 is a block diagram illustrating an electronic device 700 in accordance with an example embodiment. As shown in fig. 7, the electronic device 700 may include: a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input/output (I/O) interface 704, and a communication component 705.
The processor 701 is configured to control the overall operation of the electronic device 700, so as to complete all or part of the steps in the test script generation method. The memory 702 is used to store various types of data to support operation at the electronic device 700, such as instructions for any application or method operating on the electronic device 700 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and the like. The Memory 702 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia components 703 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 702 or transmitted through the communication component 705. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 704 provides an interface between the processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 705 may thus include: Wi-Fi module, Bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic Device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the test script generation method described above.
In another exemplary embodiment, there is also provided a computer readable storage medium including program instructions which, when executed by a processor, implement the steps of the test script generation method described above. For example, the computer readable storage medium may be the above-mentioned memory 702 comprising program instructions executable by the processor 701 of the electronic device 700 to perform the above-mentioned test script generation method.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the test script generation method described above when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (10)

1. A method for generating a test script, the method comprising:
responding to the monitored target operation in the page to be tested, and acquiring a control aimed at by the target operation and control characteristic information of the control;
acquiring an operation record image corresponding to the target operation according to the control feature information;
and generating a test script according to the operation record image, wherein the test script is used for testing the page to be tested.
2. The method according to claim 1, wherein the obtaining an operation record image corresponding to the target operation according to the control feature information includes:
determining whether a preset control screenshot condition is met or not according to the control characteristic information;
under the condition that the control screenshot condition is met, screenshot operation is carried out on the control, and the operation recording image is obtained according to the captured image;
and under the condition that the control screenshot condition is not met, performing screenshot operation on a local area where an operation position corresponding to the target operation is located in the page to be tested, and obtaining the operation record image according to the intercepted image.
3. The method according to claim 2, wherein the control feature information comprises feature information for characterizing whether the control is a hidden control, feature information for characterizing whether the control is a nested control, feature information for characterizing whether the control has size information of the control, and feature information for characterizing whether the control has position information of the control in the page to be tested;
the determining whether a preset control screenshot condition is met according to the control characteristic information includes:
and if the control is not a hidden control, the control is not a nested control, the size information of the control is contained, and the position information of the control in the page to be tested is contained, determining that the screenshot condition of the control is met.
4. The method of claim 2, wherein the screenshot operation on the control comprises:
acquiring size information of the control and position information of the control in the page to be tested;
and performing screenshot operation on the control according to the size information and the position information.
5. The method of claim 2, wherein deriving the operation recording image from the captured image comprises:
and marking the operation position corresponding to the target operation in the captured image to obtain the operation record image.
6. The method of claim 1, wherein prior to the step of generating a test script from the operation record image, the method further comprises:
acquiring extensible markup language path information of the control;
generating a test script according to the operation record image, wherein the test script comprises:
and generating the test script according to the operation record image and the path information of the extensible markup language.
7. The method according to any of claims 1-6, characterized in that the page to be tested is a Web page.
8. An apparatus for generating a test script, the apparatus comprising:
the first acquisition module is used for responding to monitoring target operation carried out in a page to be tested and acquiring a control aimed at by the target operation and control characteristic information of the control;
the second obtaining module is used for obtaining an operation record image corresponding to the target operation according to the control feature information;
and the generating module is used for generating a test script according to the operation record image, wherein the test script is used for testing the page to be tested.
9. A non-transitory computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 7.
CN202111131513.2A 2021-09-26 2021-09-26 Test script generation method, device, medium and electronic equipment Pending CN113900932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111131513.2A CN113900932A (en) 2021-09-26 2021-09-26 Test script generation method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111131513.2A CN113900932A (en) 2021-09-26 2021-09-26 Test script generation method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113900932A true CN113900932A (en) 2022-01-07

Family

ID=79029345

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111131513.2A Pending CN113900932A (en) 2021-09-26 2021-09-26 Test script generation method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113900932A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610557A (en) * 2023-04-10 2023-08-18 前海飞算云智软件科技(深圳)有限公司 Action binding information debugging method and device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610557A (en) * 2023-04-10 2023-08-18 前海飞算云智软件科技(深圳)有限公司 Action binding information debugging method and device, storage medium and electronic equipment
CN116610557B (en) * 2023-04-10 2024-02-09 前海飞算云智软件科技(深圳)有限公司 Action binding information debugging method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN109165162B (en) Test method and related equipment for vehicle-mounted system
CN108959068B (en) Software interface testing method, device and storage medium
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
CN107506300B (en) User interface testing method, device, server and storage medium
CN110134600B (en) Test script recording method, device and storage medium
CN109634841B (en) Electronic device, interface automatic test method and storage medium
US9298594B2 (en) Testing apparatus and testing method
CN113282488B (en) Terminal test method and device, storage medium and terminal
CN105824742A (en) Operation recording method and device of user interface
CN113900932A (en) Test script generation method, device, medium and electronic equipment
CN110489333B (en) Method, device, medium and electronic equipment for debugging data based on inspector
CN108984417B (en) Software testing method, device, terminal and storage medium
CN112286782A (en) Control shielding detection method, software detection method, device and medium
CN116069612A (en) Abnormality positioning method and device and electronic equipment
KR20070058957A (en) Apparatus and method for debugging sensor network using simulation
CN109739758B (en) Test case conversion method and device
CN115543831A (en) Test script generation method, device, equipment and storage medium
CN115600213A (en) Vulnerability management method, device, medium and equipment based on application program
CN115525499A (en) Data analysis method and device for hard disk, electronic equipment and storage medium
CN111290944B (en) Script generation method, script generation device and storage medium
CN110851313B (en) Sensor debugging method, intelligent terminal, storage medium and electronic equipment
CN111026644B (en) Operation result labeling method and device, storage medium and electronic equipment
CN112214404A (en) Mobile application testing method and device, storage medium and electronic equipment
US11070716B2 (en) Image sensor system, image sensor, data generation method of image sensor in image sensor system, and non-transitory computer-readable recording medium
CN110601879A (en) Method and device for forming Zabbix alarm process information 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