CN112667517A - Method, device, equipment and storage medium for acquiring automatic test script - Google Patents

Method, device, equipment and storage medium for acquiring automatic test script Download PDF

Info

Publication number
CN112667517A
CN112667517A CN202110019884.5A CN202110019884A CN112667517A CN 112667517 A CN112667517 A CN 112667517A CN 202110019884 A CN202110019884 A CN 202110019884A CN 112667517 A CN112667517 A CN 112667517A
Authority
CN
China
Prior art keywords
screenshots
target
script
logic diagram
screenshot
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
CN202110019884.5A
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.)
Winning Health Technology Group Co Ltd
Original Assignee
Winning Health Technology Group 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 Winning Health Technology Group Co Ltd filed Critical Winning Health Technology Group Co Ltd
Priority to CN202110019884.5A priority Critical patent/CN112667517A/en
Publication of CN112667517A publication Critical patent/CN112667517A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application provides a method, a device, equipment and a storage medium for acquiring an automatic test script, wherein the method comprises the following steps: the method comprises the steps of capturing a plurality of view elements in a target view to obtain a plurality of element captures of the plurality of view elements, displaying the plurality of target element captures in the plurality of element captures, editing operation according to the execution sequence of the plurality of target element captures, displaying a script logic diagram corresponding to the target view, wherein the script logic diagram is used for representing business logic of the target view, editing test parameters in the script logic diagram according to the editing operation of the script logic diagram, and generating an automatic test script of the target view according to the test parameters and the script logic diagram. According to the method and the device, the script logic design is carried out based on the element screenshot, the automatic test script development is realized, any high-level language development technology and any automation technology threshold are not needed, the development and maintenance cost of the automatic test script is reduced, and the element positioning problem in the traditional interface automation process is avoided.

Description

Method, device, equipment and storage medium for acquiring automatic test script
Technical Field
The application relates to the technical field of automated testing, in particular to a method, a device, equipment and a storage medium for acquiring an automated testing script.
Background
The current automated testing is mainly divided into two categories, interface-based automation and interface view-based automation. The automatic test based on the interface view is mainly based on the desktop view, and the simulation operation is carried out through visual elements, so that the purpose of simulating manual test is achieved.
In the prior art, in an automated test based on an interface view by using an automated test script, a view element needs to be located by an attribute value of a front-end element, and the attribute of the front-end element may include attributes such as class, id, name, xpath, css, and the like.
However, in the product development process, many elements are dynamically defined, and the related attributes are not generated in the definition process, so that the elements cannot be positioned according to the existing attributes, which results in difficulty in positioning the elements, and when the front end result of the product changes, the automatic test script for positioning the elements needs to be adjusted, which results in very high development and maintenance costs of the automatic test script.
Disclosure of Invention
An object of the present application is to provide a method, an apparatus, a device, and a storage medium for acquiring an automated test script, so as to solve the problems in the prior art that element positioning is difficult and development and maintenance costs of the automated test script are high.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides an automatic test script obtaining method, where the method includes:
screenshot is conducted on a plurality of view elements in a target view, and a plurality of element screenshots of the view elements are obtained;
displaying a plurality of target element screenshots of the plurality of element screenshots;
displaying a script logic diagram corresponding to the target view according to the execution sequence editing operation of the plurality of target element screenshots, wherein the script logic diagram is used for representing the business logic of the target view;
editing the test parameters in the script logic diagram according to the editing operation on the script logic diagram;
and generating an automatic test script of the target view according to the test parameters and the script logic diagram.
In an optional embodiment, before displaying the multiple target element screenshots in the multiple element screenshots, the method further includes:
acquiring element attributes of elements in each element screenshot, wherein the element attributes indicate whether the elements in each element screenshot are operable or not;
and cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain the plurality of target element screenshots.
In an optional embodiment, the cleaning, according to the element attribute, an inoperable element screenshot in the plurality of element screenshots to obtain the plurality of target element screenshots includes:
cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain an element screenshot set;
and cleaning the element screenshots with incompletely displayed elements from the element screenshot set to obtain the plurality of target element screenshots.
In an optional embodiment, the displaying a plurality of target element screenshots of the plurality of element screenshots includes:
acquiring element types of elements in the multiple target element screenshots;
and classifying and displaying the target element screenshots according to the element types.
In an optional embodiment, the classifying and displaying the plurality of target element screenshots according to the element types includes:
and displaying the target element screenshots of the same element types in the multiple target element screenshots on the same display page.
In an optional embodiment, the displaying, on the same presentation page, a target element screenshot of the same element type in the plurality of target element screenshots includes:
acquiring the operation type of the element in the target element screenshot of the same element type;
and classifying and displaying the target element screenshots of the same operation type on the same display page.
In an optional embodiment, the generating an automated test script of the target view according to the edited script logic diagram includes:
acquiring an operation object, an execution action and an execution sequence corresponding to the edited script logic diagram;
and generating the automatic test script according to the operation object, the execution action and the execution sequence.
In a second aspect, another embodiment of the present application provides an apparatus for acquiring an automated test script, where the apparatus includes:
the processing module is used for carrying out screenshot on a plurality of view elements in a target view to obtain a plurality of element screenshots of the view elements;
the display module is used for displaying a plurality of target element screenshots in the plurality of element screenshots, and displaying a script logic diagram corresponding to the target view according to the execution sequence editing operation of the plurality of target element screenshots, wherein the script logic diagram is used for representing the service logic of the target view;
the processing module is used for editing the test parameters in the script logic diagram according to the editing operation on the script logic diagram;
and the generating module is used for generating the automatic test script of the target view according to the test parameters and the script logic diagram.
In an optional embodiment, the apparatus further comprises:
the acquisition module is used for acquiring the element attribute of each element in each element screenshot, wherein the element attribute indicates whether the element in each element screenshot is operable or not;
and the processing module is further used for cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain the plurality of target element screenshots.
In an optional implementation manner, the obtaining module is specifically configured to:
cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain an element screenshot set;
and cleaning the element screenshots with incompletely displayed elements from the element screenshot set to obtain the plurality of target element screenshots.
In an optional implementation manner, the display module is specifically configured to:
acquiring element types of elements in the multiple target element screenshots;
and classifying and displaying the target element screenshots according to the element types.
In an optional implementation manner, the display module is specifically configured to:
and displaying the target element screenshots of the same element types in the multiple target element screenshots on the same display page.
In an optional implementation manner, the display module is specifically configured to:
acquiring the operation type of the element in the target element screenshot of the same element type;
and classifying and displaying the target element screenshots of the same operation type on the same display page.
In an optional implementation manner, the generating module is specifically configured to:
acquiring an operation object, an execution action and an execution sequence corresponding to the edited script logic diagram;
and generating the automatic test script according to the operation object, the execution action and the execution sequence.
In a third aspect, another embodiment of the present application provides an electronic device, including: a processor, a memory and a bus, the memory storing a computer program executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the processor executing the computer program to perform the method according to any of the first aspect.
In a fourth aspect, a further embodiment of the present application provides a memory having stored thereon a computer program which, when executed by a processor, performs the method according to any of the first aspect above.
The application provides a method, a device, equipment and a storage medium for acquiring an automatic test script, wherein the method comprises the following steps: the method comprises the steps of capturing a plurality of view elements in a target view to obtain a plurality of element captures of the plurality of view elements, displaying the plurality of target element captures in the plurality of element captures, editing operation according to the execution sequence of the plurality of target element captures, displaying a script logic diagram corresponding to the target view, wherein the script logic diagram is used for representing business logic of the target view, editing test parameters in the script logic diagram according to the editing operation of the script logic diagram, and generating an automatic test script of the target view according to the test parameters and the script logic diagram. According to the method and the device, the script logic design is carried out based on the element screenshot, the automatic test script development is realized, any high-level language development technology and any automation technology threshold are not needed, the development and maintenance cost of the automatic test script is reduced, and the element positioning problem in the traditional interface automation process is avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
FIG. 1 is a first flowchart illustrating a method for acquiring an automated test script according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating a script logic diagram provided by an embodiment of the present application;
FIG. 3 is a flowchart illustrating a second method for acquiring an automated test script according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a third method for acquiring an automated test script according to an embodiment of the present application;
FIG. 5 is a fourth flowchart illustrating a method for acquiring an automated test script according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram illustrating an apparatus for acquiring an automated test script according to an embodiment of the present application;
fig. 7 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for illustrative and descriptive purposes only and are not used to limit the scope of protection of the present application. Additionally, it should be understood that the schematic drawings are not necessarily drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
In addition, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that in the embodiments of the present application, the term "comprising" is used to indicate the presence of the features stated hereinafter, but does not exclude the addition of further features.
The current automated testing mainly comprises two categories of interface-based automation and interface view-based automation, wherein the former mainly aims at the protocol standard and service requirement of an interface, simulates the contents of access participation, protocol format and the like of the interface and sends a request to a corresponding interface address to achieve the purpose of interface-based automated testing, and the latter mainly aims at simulating the purpose of manual testing by carrying out simulation operation (such as mouse click, mouse double click, dragging and the like) on visual elements based on an interface view, so that the automated testing based on the interface view is realized.
In the process of performing an automated test based on an interface view, in the current method for positioning elements, the elements are positioned by attribute values of front-end elements, such as attributes of class, id, name, xpath, css, and the like, however, there are two major bottlenecks in positioning the elements by the attribute values:
firstly, in the product development process, many elements are dynamically defined, and related attributes like id, name and the like are not generated in the definition process, so that the positioning cannot be performed through the existing attributes, even if the positioning can be performed through xpath of an absolute path, the readability, maintainability and robustness of the script are very poor, the script cannot be applied in an actual project, and in addition, for some customized controls, the acquisition of sub-elements in the customized controls is a great problem under the condition of no source code.
Secondly, when the front-end structure of the product is changed or adjusted, the scripts of the positioning elements need to be adjusted, once the automatic test scripts reach a certain number, the maintenance workload is very huge, the actual value of the automatic test is greatly reduced, and the input and output are even lower than those of the manual test.
Overall, when an automated test is performed based on an interface view, two obvious defects exist, and 1) element positioning is difficult; 2) the development and maintenance costs of automated test scripts are very high.
Based on the problems, the application provides an automatic test script obtaining method, provides a User Interface (UI) automatic test script rapid development method based on image recognition, realizes automatic test script development by performing script logic design based on element screenshots, does not need any high-level language development technology and automation technology threshold, reduces the development and maintenance cost of the automatic test script, improves the automatic test efficiency and the test quality, and avoids the element positioning problem in the traditional Interface automation process.
The following describes the method for acquiring the automated test script according to the present application in detail with reference to several embodiments.
Fig. 1 is a schematic flowchart illustrating a first flow of a method for acquiring an automated test script according to an embodiment of the present application, where an execution main body of the embodiment may be an electronic device, for example, a terminal device, a server, and the like, and an automated test script development platform is arranged on the electronic device.
As shown in fig. 1, the method may include:
s101, screenshot is conducted on the multiple view elements in the target view, and multiple element screenshots of the multiple view elements are obtained.
The target view can be a desktop view to be subjected to an automated test. The view elements are constituent elements of the target view, and may include, for example, an account number entry box, a password entry box, a login button, and other elements. It should be noted that different desktop views may have different view elements, which is not particularly limited in this embodiment.
In this embodiment, in order to obtain an automated test script of a target view, a plurality of view elements in the target view may be captured to obtain a plurality of element screenshots of the plurality of view elements, where each view element corresponds to one element screenshot.
It should be noted that the screenshot performed on the multiple view elements in the target view may include two screenshot manners, namely manual screenshot and automatic screenshot, where the manual screenshot is performed by inputting a screenshot operation for the multiple view elements in the target view by a script developer, and the electronic device responds to the screenshot operation to obtain multiple element screenshots of the multiple view elements, including a picture screenshot, a text screenshot, and the like; the automatic capture is that the script development platform automatically captures the elements of all view elements on the desktop view, so that the workload of manual capture is reduced. Of course, the two screenshot modes of manual interception and automatic interception can also be used in combination to improve the accuracy of the element screenshot interception.
For example, the resolution of the display corresponding to the target view may also be obtained, in practical application, the image similarity between the target view and the subsequent view may also be calculated, and when the image similarity is greater than the similarity threshold, the subsequent view may also be automatically tested by using an automatic test script of the target view. Wherein calculating the image similarity between the target view and the subsequent view may comprise: and calculating the image similarity between the target view and the subsequent view according to the resolution of the target view, the included view elements, the resolution of the subsequent view and the included view elements, so that the compatibility and sharing of the automatic test script are realized.
And S102, displaying a plurality of target element screenshots in the plurality of element screenshots.
After the screenshot is performed on the target view, a plurality of target element screenshots in the plurality of element screenshots can be displayed on the automatic test script development platform, wherein the plurality of target element screenshots can be element screenshots which are operable by elements in the plurality of element screenshots, and the element screenshots which are operable by the elements refer to element screenshots of the elements which are operable by a user.
Taking the example that the element screenshot comprises the apple screenshot, the apple screenshot comprises the apple which is an element in the apple screenshot, the apple can only be displayed, and a user cannot operate the apple, so that the apple screenshot is a non-target element screenshot, and the element screenshot does not need to be displayed. The user can not operate the apple, and various operations such as input, clicking and the like can not be executed on the apple for the user.
The key point of the embodiment is that the automated test is to simulate real use of a user for testing, and if an element in an element screenshot is not operable, it is not necessary to perform subsequent operations on the element screenshot to generate an automated test script.
Taking a plurality of target element screenshots including a 'job number/name/account number typing here' screenshot, a 'password input please' screenshot, a 'login' screenshot as an example, table 1 shows a display mode of the plurality of target element screenshots, and as shown in table 1, the heads of the plurality of target element screenshots are respectively an element serial number, a target element screenshot and a screenshot name, wherein the target element 1 is 'job number/name/account number typing here', a corresponding 'job number/name/account number typing here' screenshot, and the screenshot name is username. The target element 2 is a screenshot corresponding to 'please input your password', and the screenshot name is password. The target element 3 is 'login', corresponds to 'login' screenshot, and has a screenshot name of loginBtn.
Figure BDA0002888265430000091
TABLE 1
Of course, table 1 is merely provided as an example of display, and in practical applications, the display modes of table 1 are included but not limited.
And S103, displaying a script logic diagram corresponding to the target view according to the execution sequence editing operation of the plurality of target element screenshots.
The execution sequence editing operation may be any one of a drag operation, a click operation, and a double-click operation, which is not particularly limited in this embodiment.
The script developer can input execution sequence editing operation aiming at the multiple target element screenshots, and correspondingly, the electronic equipment displays a script logic diagram corresponding to the target view according to the execution sequence editing operation aiming at the multiple target element screenshots, wherein the script logic diagram is used for representing the business logic of the target view.
The 3 elements illustrated above may form the following business logic (i.e., business execution order): and (3) inputting an account number into the target element 1, inputting a password into the target element 2, and clicking to complete the login process, so that the 3 schematic target element screenshots can be dragged to form and display the service logic of the target view. Fig. 2 shows a schematic diagram of a script logic diagram provided in an embodiment of the present application, and as shown in fig. 2, in a script development process, by dragging 3 visually displayed target element screenshots, the 3 target element screenshots may be specified by an arrow, that is, by pointing the target element screenshot of a previous operation to a target element screenshot of a next operation through the arrow, a script logic diagram may be generated.
And S104, editing the test parameters in the script logic diagram according to the editing operation on the script logic diagram.
And S105, generating an automatic test script of the target view according to the test parameters and the script logic diagram.
After the script logic diagram of the target view is generated, a script developer can also input editing operation aiming at the script logic diagram, correspondingly, the electronic equipment edits the test parameters in the script logic diagram according to the editing operation on the script logic diagram, and then can generate the automatic test script of the target view according to the test parameters and the script logic diagram by adopting a graphic script conversion tool provided by an automatic test script development platform, wherein the test parameters are parameters to be edited in the screenshot of the target element.
Taking fig. 2 as an example, the test parameters in the script logic diagram of the target view include "job number/name/account number" in the "enter your job number/name/account number" screenshot, and "password" in the "please enter your password" screenshot.
It should be noted that, a test parameter input area is also provided in the automated test script development platform, and a script developer can edit and store test parameters in the script logic diagram in the area, and then generate an automated test script of a target view according to the test parameters and the script logic diagram by using a graphic script conversion tool.
The method for acquiring the automated test script comprises the following steps: the method comprises the steps of capturing a plurality of view elements in a target view to obtain a plurality of element captures of the plurality of view elements, displaying the plurality of target element captures in the plurality of element captures, editing operation according to the execution sequence of the plurality of target element captures, displaying a script logic diagram corresponding to the target view, wherein the script logic diagram is used for representing business logic of the target view, editing test parameters in the script logic diagram according to the editing operation of the script logic diagram, and generating an automatic test script of the target view according to the test parameters and the script logic diagram. In the embodiment, the automatic test script development is realized by performing the script logic design based on the element screenshot, any high-level language development technology and automation technology threshold are not needed, the development and maintenance cost of the automatic test script is reduced, and the element positioning problem in the traditional interface automation process is avoided.
In an alternative embodiment, step S105 may include:
acquiring an operation object, an execution action and an execution sequence according to the script logic diagram;
and generating an automatic test script according to the operation object, the execution action, the execution sequence and the test parameters.
The operation object may be a plurality of target element screenshots in the script logic diagram, the execution action may be an execution action of each target element in the plurality of target element screenshots, the execution sequence may be an execution sequence of each target element in the plurality of target element screenshots, and the test parameter may be a parameter corresponding to the operation object.
The operation objects, the execution actions and the execution sequence can be obtained according to the script logic diagram, and then an automatic test script can be generated according to the operation objects, the execution actions, the execution sequence and the test parameters by adopting a graphic script conversion tool.
Taking table 1 and fig. 2 as examples, the script logic diagram is used to represent the service logic of the target view, and then the operation object in fig. 2 may be a plurality of target element screenshots, which are respectively "user name. jpg", "password. jpg", and "loginbtn. jpg", and the execution actions are respectively inputting an account, inputting a password, and logging, and the execution sequence is from target element 1 to target element 2 to target element 3.
And determining an operation object, an execution action, an execution sequence and test parameters of the whole script, and generating an automatic test script by adopting a graphic script conversion tool provided by an automatic test platform, wherein the graphic script conversion tool can be developed by adopting sikuli, selenium and the like.
Taking sikuli as an example, names corresponding to the 3 target element screenshots are "user name. jpg", "password. jpg" and "loginbtn. jpg" user name. jpg respectively, the input test parameters include an account number and a password, which are test and 123456 respectively, and the corresponding automatic test script can be automatically converted into the following values by referring to sikuli script rules:
Screen s=new Screen();
s.paste("Username.jpg","test");
s.paste("Password.jpg","123456");
s.click("loginBtn.jpg");
illustratively, since the automated test is to simulate real use of a user, if there is an element in the element screenshot that is not operable, the element screenshot may also be cleaned. This is illustrated below in conjunction with the embodiment of fig. 3.
Fig. 3 is a flowchart illustrating a second method for acquiring an automated test script according to an embodiment of the present application, where as shown in fig. 3, before step S102, the method may further include:
s201, obtaining element attributes of the elements in each element screenshot.
And S202, cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain a plurality of target element screenshots.
The elements in each element screenshot have element attributes, and the element attributes indicate whether the elements in each element screenshot are operable or not, so that the element attributes of the elements in each element screenshot can be acquired in the embodiment, and the inoperable elements in the multiple element screenshots are cleaned according to the element attributes to obtain multiple target element screenshots.
It should be noted that, if the element attribute indicates that an element in the element screenshot is inoperable, which indicates that, in practical application, a user cannot operate the element and the element belongs to an element that cannot be tested, it is not necessary to perform subsequent operations on the element screenshot to generate an automated test script, so that the inoperable element screenshot can be cleaned to obtain a plurality of target element screenshots.
In an alternative embodiment, the automated test cannot be performed on the element screenshots that some elements are not fully displayed, and therefore, some element screenshots that are not fully displayed may also be cleaned, and the step S202 may include:
s2021, cleaning the inoperable element screenshots in the element screenshots according to the element attributes to obtain an element screenshot set.
S2022, cleaning the element screenshots with incompletely displayed elements from the element screenshot set to obtain a plurality of target element screenshots.
Specifically, the inoperable element screenshots in the element screenshots are cleaned according to the element attributes to obtain an element screenshot set, wherein the element screenshot set comprises other element screenshots except the inoperable element screenshots in the element screenshots, namely the other element screenshots are operable element screenshots.
The element screenshots of the element not all displayed can then be purged from the first set of elements, resulting in a plurality of target element screenshots, wherein the element not all displayed includes both the element being completely occluded (i.e., the element is present but not available) and the element being partially occluded (i.e., the element is partially displayed).
Taking an example that the element screenshot comprises an apple screenshot and a pear screenshot, wherein the apple screenshot comprises an apple and a pear screenshot comprises a pear, the apple is an element in the apple screenshot, the pear is an element in the pear screenshot, and in the first case, the apple is completely shielded by the pear, namely the apple exists but cannot be used, so that the apple screenshot can be removed and cleaned; in the second case, 1/3 of the apple is obscured by the pear, the screenshot of the apple can be washed away.
The key point of the embodiment is that the automated test is to simulate the real use of a user for testing, if the element in the element screenshot is inoperable or incompletely displayed, the user cannot operate the element, so that the inoperable and incompletely displayed element screenshot can be cleaned, and a plurality of target element screenshots are obtained.
The method for acquiring the automated test script comprises the following steps: and acquiring the element attributes of the elements in each element screenshot, and cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain a plurality of target element screenshots. By the method, the element screenshots which cannot be used in the automatic test process can be removed, and the effectiveness of the subsequently generated automatic test script is improved.
In an optional implementation manner, a plurality of target element screenshots may also be displayed in a classified manner, so that a script developer can conveniently search for a required element screenshot to construct a script logic diagram, which is described below with reference to the embodiment of fig. 4.
Fig. 4 is a flowchart illustrating a third flowchart of the method for acquiring an automated test script according to the embodiment of the present application, and as shown in fig. 4, step S102 may include:
s301, obtaining element types of the elements in the multiple target element screenshots.
And S302, classifying and displaying the multiple target element screenshots according to the element types.
Wherein the element type comprises at least one of a Button (Button) type, an Input (Input) type, a Text (Text) type and a hyperlink (Hyperlinks) type.
The elements of the button class include single click, double click, the elements of the input class include keyboard operations, which may include, for example, carriage returns, spaces, the elements of the text class include text, and the elements of the hyperlink class include hyperlinks.
Specifically, when the automatic script development platform displays a plurality of target element screenshots, the element types of the elements in the plurality of target element screenshots can be obtained, the plurality of target element screenshots are displayed in a classified manner according to the element types, and illustratively, the target element screenshots belonging to the same element type are displayed in a list in one area.
In an alternative embodiment, S402 may include:
and displaying the target element screenshots of the same element types in the multiple target element screenshots on the same display page.
The automatic script development platform is further provided with a plurality of display pages, and then target element screenshots of the same element type in the plurality of target element screenshots can be displayed on the same display page, by taking element types including a Button (Button) type, an Input (Input) type, a Text (Text) type and a hyperlink (hyperlink) type as examples, the target element screenshots of the Button type are displayed on a first display page, the target element screenshots of the Input type are displayed on a second display page, the target element screenshots of the Text type are displayed on a third display page, and the target element screenshots of the hyperlink type are displayed on a fourth display page.
The method for acquiring the automatic test script obtains the element types of the elements in the multiple target element screenshots, and displays the multiple target element screenshots in a classified manner according to the element types. In the embodiment, the multiple target element screenshots are displayed in a classified manner, so that a script developer can conveniently and subsequently construct the script logic diagram, and the construction efficiency of the script logic diagram is improved.
Exemplarily, fig. 5 shows a fourth flowchart of the method for acquiring an automated test script provided by the embodiment of the present application, and as shown in fig. 5, displaying target element screenshots of the same element type in multiple target element screenshots on the same presentation page includes:
s401, obtaining the operation types of the elements in the target element screenshot of the same element type.
S402, classifying and displaying the target element screenshots of the same operation type on the same display page.
Wherein the operation types of the elements include: single click, double click, drag, enter, space, etc.
Specifically, the operation types of the elements in the target element screenshots of the same element type may be obtained, and then the target element screenshots of the same operation type are displayed in the same display page in a classified manner, that is, after the target element screenshots of the same element type are displayed on the same display page, the target element screenshots of the same operation type may also be displayed in the same display page in a classified manner according to the operation types of the elements in the target element screenshots of the same element type and according to the operation types, where the displaying in the same display page in a classified manner may be: and dividing the same display page into a plurality of areas, and displaying the target element screenshots of the same operation type in the same area.
As an example, the element type is taken as a button type, and the operation type of the element includes single click and double click, so that the screenshot of the target element of the single click type can be displayed in the first area of the display page, and the screenshot of the target element of the double click type can be displayed in the second area of the display page.
The method for acquiring the automatic test script obtains the operation types of the elements in the target element screenshots of the same element type, and displays the target element screenshots of the same operation types in a classified manner on the same display page. In the embodiment, the target element screenshots of different operation types in the same display page are displayed in a classified manner, so that a script developer can conveniently and subsequently construct the script logic diagram, and the construction efficiency of the script logic diagram is improved.
Based on the same inventive concept, an automatic test script acquisition device corresponding to the automatic test script acquisition method is further provided in the embodiments of the present application, and as the principle of solving the problem of the device in the embodiments of the present application is similar to the automatic test script acquisition method in the embodiments of the present application, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Fig. 6 is a schematic structural diagram illustrating an apparatus for acquiring an automated test script according to an embodiment of the present application, where the apparatus for acquiring an automated test script may be integrated in an electronic device. As shown in fig. 6, the acquiring device 50 of the automated test script may include:
a processing module 501, configured to capture a plurality of view elements in a target view to obtain a plurality of element captures of the plurality of view elements;
a display module 502, configured to display a plurality of target element screenshots in the plurality of element screenshots, and display a script logic diagram corresponding to the target view according to an execution sequence editing operation on the plurality of target element screenshots, where the script logic diagram is used to represent a service logic of the target view;
the processing module 501 is configured to edit the test parameters in the script logic diagram according to the editing operation on the script logic diagram;
and a generating module 503, configured to generate an automated test script for the target view according to the edited script logic diagram.
In an optional embodiment, the apparatus further comprises:
an obtaining module 504, configured to obtain an element attribute of an element in each element screenshot, where the element attribute indicates whether the element in each element screenshot is operable;
the processing module 501 is further configured to wash an inoperable element screenshot from the multiple element screenshots according to the element attribute, so as to obtain the multiple target element screenshots.
In an optional implementation manner, the obtaining module 504 is specifically configured to:
cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain an element screenshot set;
and cleaning the element screenshots with incompletely displayed elements from the element screenshot set to obtain the plurality of target element screenshots.
In an optional implementation manner, the display module 502 is specifically configured to:
acquiring element types of elements in the multiple target element screenshots;
and classifying and displaying the target element screenshots according to the element types.
In an optional implementation manner, the display module 502 is specifically configured to:
and displaying the target element screenshots of the same element types in the multiple target element screenshots on the same display page.
In an optional implementation manner, the display module 502 is specifically configured to:
acquiring the operation type of the element in the target element screenshot of the same element type;
and classifying and displaying the target element screenshots of the same operation type on the same display page.
In an optional implementation manner, the generating module 503 is specifically configured to:
acquiring an operation object, an execution action and an execution sequence corresponding to the edited script logic diagram;
and generating the automatic test script according to the operation object, the execution action and the execution sequence.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Fig. 7 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application, and as shown in fig. 7, an electronic device 60 includes: a processor 601, a memory 602, and a bus 603, wherein the memory 602 stores a computer program executable by the processor 601, and when the electronic device 60 runs, the processor 601 and the memory 602 communicate via the bus 603, and the computer program is executed by the processor 601 to perform the above-mentioned method embodiments.
The embodiment of the present application further provides a storage medium, where a computer program is stored on the storage medium, and the computer program is executed by a processor to perform the above method embodiments.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to corresponding processes in the method embodiments, and are not described in detail in this application. In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and there may be other divisions in actual implementation, and for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or modules through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a memory and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned memory comprises: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.

Claims (10)

1. An automatic test script obtaining method is characterized by comprising the following steps:
screenshot is conducted on a plurality of view elements in a target view, and a plurality of element screenshots of the view elements are obtained;
displaying a plurality of target element screenshots of the plurality of element screenshots;
displaying a script logic diagram corresponding to the target view according to the execution sequence editing operation of the plurality of target element screenshots, wherein the script logic diagram is used for representing the business logic of the target view;
editing the test parameters in the script logic diagram according to the editing operation on the script logic diagram;
and generating an automatic test script of the target view according to the test parameters and the script logic diagram.
2. The method of claim 1, wherein prior to displaying the plurality of target element screenshots of the plurality of element screenshots, further comprising:
acquiring element attributes of elements in each element screenshot, wherein the element attributes indicate whether the elements in each element screenshot are operable or not;
and cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain the plurality of target element screenshots.
3. The method of claim 2, wherein said cleaning out inoperable ones of said plurality of element screenshots from said element attributes to obtain said plurality of target element screenshots comprises:
cleaning the inoperable element screenshots in the plurality of element screenshots according to the element attributes to obtain an element screenshot set;
and cleaning the element screenshots with incompletely displayed elements from the element screenshot set to obtain the plurality of target element screenshots.
4. The method of claim 1, wherein said displaying a plurality of target element screenshots of said plurality of element screenshots comprises:
acquiring element types of elements in the multiple target element screenshots;
and classifying and displaying the target element screenshots according to the element types.
5. The method of claim 4, wherein the classifying the plurality of target element screenshots according to the element types comprises:
and displaying the target element screenshots of the same element types in the multiple target element screenshots on the same display page.
6. The method of claim 5, wherein displaying target element screenshots of a same element type in the plurality of target element screenshots on a same presentation page comprises:
acquiring the operation type of the element in the target element screenshot of the same element type;
and classifying and displaying the target element screenshots of the same operation type on the same display page.
7. The method of claim 1, wherein generating an automated test script for the target view based on the test parameters and the script logic diagram comprises:
acquiring an operation object, an execution action and an execution sequence according to the script logic diagram;
and generating the automatic test script according to the operation object, the execution action, the execution sequence and the test parameters.
8. An apparatus for acquiring an automated test script, comprising:
the processing module is used for carrying out screenshot on a plurality of view elements in a target view to obtain a plurality of element screenshots of the view elements;
the display module is used for displaying a plurality of target element screenshots in the plurality of element screenshots, and displaying a script logic diagram corresponding to the target view according to the execution sequence editing operation of the plurality of target element screenshots, wherein the script logic diagram is used for representing the service logic of the target view;
the processing module is used for editing the test parameters in the script logic diagram according to the editing operation on the script logic diagram;
and the generating module is used for generating the automatic test script of the target view according to the test parameters and the script logic diagram.
9. An electronic device, comprising: a processor, a memory and a bus, the memory storing a computer program executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the processor executing the computer program to perform the method of any of claims 1 to 7.
10. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, performs the method of any one of claims 1 to 7.
CN202110019884.5A 2021-01-07 2021-01-07 Method, device, equipment and storage medium for acquiring automatic test script Pending CN112667517A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110019884.5A CN112667517A (en) 2021-01-07 2021-01-07 Method, device, equipment and storage medium for acquiring automatic test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110019884.5A CN112667517A (en) 2021-01-07 2021-01-07 Method, device, equipment and storage medium for acquiring automatic test script

Publications (1)

Publication Number Publication Date
CN112667517A true CN112667517A (en) 2021-04-16

Family

ID=75413480

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110019884.5A Pending CN112667517A (en) 2021-01-07 2021-01-07 Method, device, equipment and storage medium for acquiring automatic test script

Country Status (1)

Country Link
CN (1) CN112667517A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127354A (en) * 2021-04-21 2021-07-16 武汉思普崚技术有限公司 Automatic testing method, device and equipment based on Web UI and storage medium
CN115794056A (en) * 2022-11-28 2023-03-14 中电金信软件有限公司 Script file processing method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110214107A1 (en) * 2010-03-01 2011-09-01 Experitest, Ltd. Method and system for testing graphical user interfaces
CN102521120A (en) * 2011-11-16 2012-06-27 中国民航信息网络股份有限公司 Software automation test system and method
JP2018092361A (en) * 2016-12-02 2018-06-14 日本電信電話株式会社 Test script correction apparatus and test script correction program
CN110275834A (en) * 2019-06-25 2019-09-24 中国工商银行股份有限公司 User interface automatization test system and method
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
US20190303269A1 (en) * 2018-03-28 2019-10-03 Layout.io Ltd Methods and systems for testing visual aspects of a web page

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110214107A1 (en) * 2010-03-01 2011-09-01 Experitest, Ltd. Method and system for testing graphical user interfaces
CN102521120A (en) * 2011-11-16 2012-06-27 中国民航信息网络股份有限公司 Software automation test system and method
JP2018092361A (en) * 2016-12-02 2018-06-14 日本電信電話株式会社 Test script correction apparatus and test script correction program
US20190303269A1 (en) * 2018-03-28 2019-10-03 Layout.io Ltd Methods and systems for testing visual aspects of a web page
CN110297758A (en) * 2019-05-20 2019-10-01 深圳壹账通智能科技有限公司 User interface automated testing method, device and computer readable storage medium
CN110275834A (en) * 2019-06-25 2019-09-24 中国工商银行股份有限公司 User interface automatization test system and method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127354A (en) * 2021-04-21 2021-07-16 武汉思普崚技术有限公司 Automatic testing method, device and equipment based on Web UI and storage medium
CN113127354B (en) * 2021-04-21 2023-08-11 武汉思普崚技术有限公司 Automatic test method, device, equipment and storage medium based on Web UI
CN115794056A (en) * 2022-11-28 2023-03-14 中电金信软件有限公司 Script file processing method, device, equipment and storage medium
CN115794056B (en) * 2022-11-28 2023-11-28 中电金信软件有限公司 Script file processing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
JP7398068B2 (en) software testing
CN108628741B (en) Webpage testing method and device, electronic equipment and medium
WO2019144680A1 (en) Automatic testing method and apparatus, storage medium and electronic device
CN109697066B (en) Method and system for realizing data sheet splicing and automatically training machine learning model
US8490050B2 (en) Automatic generation of user interfaces
US8843879B2 (en) Software design and automatic coding for parallel computing
CN109739855B (en) Method and system for realizing data sheet splicing and automatically training machine learning model
Au et al. Automated usability testing framework
CN110515830A (en) Operation trace method for visualizing, device, equipment and storage medium
CN105975393B (en) Page display detection method and system
CN112667517A (en) Method, device, equipment and storage medium for acquiring automatic test script
Silva et al. A comparative study of milestones for featuring GUI prototyping tools
CN113449877A (en) Method and system for displaying machine learning modeling process
CN111506298A (en) Method for carrying out interface visual configuration based on JSON object
CN117057318A (en) Domain model generation method, device, equipment and storage medium
CN114385150A (en) Low code development method based on intelligent engine
CN114201144A (en) Micro service system construction method, device and medium based on domain-driven design
CN114416516A (en) Test case and test script generation method, system and medium based on screenshot
Fang et al. Automated tracing and visualization of software security structure and properties
CN115373673A (en) Application page construction method and device, computer equipment and readable storage medium
CN115495362A (en) Method, device, storage medium and computer equipment for generating test code
Swearngin et al. Easing the generation of predictive human performance models from legacy systems
CN110347577B (en) Page testing method, device and equipment thereof
CN112633853A (en) Project management method and device and electronic equipment
WO2020263417A1 (en) Chat bot diagnostic visualization

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