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

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

Info

Publication number
CN116594886A
CN116594886A CN202310561472.3A CN202310561472A CN116594886A CN 116594886 A CN116594886 A CN 116594886A CN 202310561472 A CN202310561472 A CN 202310561472A CN 116594886 A CN116594886 A CN 116594886A
Authority
CN
China
Prior art keywords
page
test
target
control element
path
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
CN202310561472.3A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310561472.3A priority Critical patent/CN116594886A/en
Publication of CN116594886A publication Critical patent/CN116594886A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The present disclosure provides a test script generation method, apparatus, electronic device, and storage medium, which can be applied to the computer technology field, the software testing field, the financial field, or other fields. The method comprises the following steps: responding to a test request aiming at a target front-end application, and determining control elements included in a first page and test instructions corresponding to the control elements included in the first page based on a screenshot of the first page of the target front-end application; analyzing a test path by using control elements included in a first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and generating a test script of the target front-end application based on the multi-label test path and test instructions corresponding to each of a plurality of nodes included in each of the multi-label test path.

Description

Test script generation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology, software testing, finance, and other fields, and more particularly, to a test script generation method, apparatus, electronic device, and storage medium.
Background
Along with the continuous development of internet technology, the front-end application also carries out iterative updating along with the development of requirements and technology, and in the updating and optimizing process of the front-end application, the testing pressure is also larger and larger, and as the background processing logic is also continuously optimized and adjusted, the control of the client side is higher in acquisition difficulty and higher in confidentiality, so that the testing difficulty is also increased continuously.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art, such as: the front-end application test scheme in the related technology has the problems of low test efficiency, low reusability and the like.
Disclosure of Invention
In view of this, the present disclosure provides a test script generation method, apparatus, electronic device, readable storage medium, and computer program product.
One aspect of the present disclosure provides a test script generation method, including:
responding to a test request aiming at a target front-end application, and determining control elements included in a first page and test instructions corresponding to the control elements included in the first page based on a screenshot of the first page of the target front-end application;
analyzing a test path by using control elements included in the first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and
And generating a test script of the target front-end application based on the multi-item target test path and test instructions corresponding to a plurality of nodes included in the multi-item target test path.
According to an embodiment of the present disclosure, the analyzing a test path by using a control element included in the first page to obtain a multi-label test path includes: determining a first target control element from control elements included in the first page; running a test instruction corresponding to the first target control element to obtain a second page; path detection is carried out based on the first page and the second page, and a detection result is obtained; and obtaining the target test path based on the first target control element under the condition that the detection result represents a path closed loop.
According to an embodiment of the disclosure, the performing path detection based on the first page and the second page to obtain a detection result includes: obtaining a page jump detection result based on the page similarity between the first page and the second page; determining the control type of the first target control element under the condition that the page jump detection result indicates that the page jump does not occur; obtaining the detection result indicating that the path is not closed loop under the condition that the control type of the first target control element is a preset control type; and obtaining the detection result representing the path closed loop under the condition that the control type of the first target control element is not the preset control type.
According to an embodiment of the present disclosure, in a case where the page jump detection result indicates that a page jump occurs, the detection result is determined based on the second page.
According to an embodiment of the present disclosure, the determining the detection result based on the second page includes: under the condition that the second page meets the preset condition, the detection result representing the path closed loop is obtained; wherein, the preset condition comprises any one of the following: the second page comprises a characteristic area; the second page is a preset empty page; and the second page does not contain the control element.
According to the embodiment of the disclosure, when the detection result indicates that the path is not closed-loop, determining a second target control element from control elements included in the second page; and running a test instruction corresponding to the second target control element to obtain a third page, and continuing to perform path detection on the third page.
According to an embodiment of the disclosure, in response to obtaining a target page, a control element included in the target page and a test instruction corresponding to the control element included in the target page are determined based on a screenshot of the target page, where the target page includes the second page or the third page.
According to an embodiment of the present disclosure, the determining, based on the screenshot of the first page of the target front-end application, a control element included in the first page and a test instruction corresponding to the control element included in the first page includes: performing image processing on the screenshot of the first page to obtain control elements included in the first page, control types of the control elements and position information of the control elements; for each control element, determining an instruction template and a test instance corresponding to the control element based on the control type of the control element; and obtaining a test instruction corresponding to the control element based on the position information of the control element, the test instance corresponding to the control element and the instruction template corresponding to the control element.
According to an embodiment of the present disclosure, the processing the image processing the screenshot of the first page to obtain a control element included in the first page, a control type of the control element, and location information of the control element includes: carrying out style recognition on the screenshot of the first page to obtain at least one control element region; for each control element area, carrying out text recognition on the control element area to determine control elements related to the control element area and control types of the control elements; and determining the position information of the control element region based on a preset coordinate system, wherein the preset coordinate system is related to the screenshot of the first page.
According to an embodiment of the present disclosure, the generating a test script of the target front-end application based on the multi-label test path and test instructions corresponding to a plurality of nodes included in the multi-label test path includes: for each target test path, splicing test instructions corresponding to the nodes included in the target test path respectively based on edges among the nodes included in the target test path to obtain test sub-scripts; and splicing the test sub-scripts of each multi-item mark test path to obtain the test script.
One aspect of the present disclosure provides a front-end application testing method, including:
and responding to the test request, and running a test script of the target front-end application to test the target front-end application to obtain a test result.
Another aspect of the present disclosure provides a test script generating apparatus, including:
the testing instruction determining module is used for responding to a testing request aiming at a target front-end application, and determining control elements included in a first page and testing instructions corresponding to the control elements included in the first page based on the screenshot of the first page of the target front-end application;
The test path analysis module is used for analyzing a test path by utilizing the control elements included in the first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and
and the test script generation module is used for generating the test script of the target front-end application based on the multi-item target test path and the test instructions corresponding to the nodes included in the multi-item target test path.
Another aspect of the present disclosure provides a front-end application testing apparatus, including:
and the test result determining module is used for responding to the test request, running the test script of the target front-end application and testing the target front-end application to obtain a test result.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more instructions that, when executed by the one or more processors, cause the one or more processors to implement the method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are configured to implement a method as described above.
Another aspect of the present disclosure provides a computer program product comprising computer executable instructions which, when executed, are adapted to carry out a method as described above.
According to the embodiment of the disclosure, a control element and a test instruction corresponding to the control element included in a page are determined through a screenshot of a first page of a front-end application; and analyzing the test paths by utilizing control elements included in the page to obtain a plurality of test paths, and finally generating a test script of the target front-end application based on the multi-item target test paths and test instructions corresponding to a plurality of nodes included in the multi-item target test paths. Because the newly deployed front-end application or the new version of the deployed front-end application is adopted, a plurality of test paths are automatically obtained by utilizing control elements, and then the test scripts of the front-end application are obtained by utilizing the multi-item mark test paths and the test instructions corresponding to the nodes respectively included in the multi-item mark test paths, the technical problems of low test efficiency and low reusability in the prior art are at least partially overcome, and further, the automatic test of the front-end application is realized, and the test efficiency and the test script reusability are improved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
FIG. 1 schematically illustrates an exemplary system architecture for exposing test script generation methods and apparatus of the present disclosure may be applied;
FIG. 2 schematically illustrates a flow chart of a test script generation method according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a screenshot schematic of a target front-end application in accordance with an embodiment of the disclosure;
FIG. 4 schematically illustrates a flow chart of determining a target test path according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a schematic diagram of including feature regions in a second page according to an embodiment of the disclosure;
FIG. 6 schematically illustrates a flow chart of generating a test script in accordance with an embodiment of the present disclosure;
FIG. 7 schematically illustrates a flow chart of a test script generation method according to another embodiment of the present disclosure;
FIG. 8 schematically illustrates a flow chart of a front end application test method according to an embodiment of the disclosure;
FIG. 9 schematically illustrates a block diagram of a test script generating device in accordance with an embodiment of the present disclosure;
FIG. 10 schematically illustrates a block diagram of a front-end application testing apparatus according to an embodiment of the disclosure; and
Fig. 11 schematically illustrates a block diagram of an electronic device 1100 adapted to implement a test script generation method, according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a formulation similar to at least one of "A, B or C, etc." is used, in general such a formulation should be interpreted in accordance with the ordinary understanding of one skilled in the art (e.g. "a system with at least one of A, B or C" would include but not be limited to systems with a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
It should be noted that, unless there is an execution sequence between different operations or an execution sequence between different operations in technical implementation, the execution sequence between multiple operations may be different, and multiple operations may also be executed simultaneously in the embodiment of the disclosure.
The applicant finds that various solutions exist for testing the front-end application, such as control identification, manual script recording and the like, but under the pressure of different developer habits and different testing environments, the solutions have the problems of low testing efficiency, gradually reduced operability and lower reusability, and if page resolution adjustment, page position movement and the like all have influence on the completed script.
In view of this, embodiments of the present disclosure provide a test script generation method, a test script generation apparatus, an electronic device, a readable storage medium, and a computer program product. Responding to a test request aiming at a target front-end application, and determining control elements included in a first page and test instructions corresponding to the control elements included in the first page based on a screenshot of the first page of the target front-end application; analyzing a test path by using control elements included in a first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and generating a test script of the target front-end application based on the multi-label test path and test instructions corresponding to each of a plurality of nodes included in each of the multi-label test path.
It should be noted that, the method and the device for generating the test script determined by the embodiments of the present disclosure may be used in the computer technical field, the software testing field, the financial field or other technical fields. The test script generation method and the test script generation device determined by the embodiment of the disclosure can also be used in any field except the computer technical field, the software test field and the financial field. The application fields of the test script generation method and the test script generation device determined by the embodiment of the disclosure are not limited.
In embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc., of the data involved (including, but not limited to, user personal information) all comply with relevant legal regulations, are used for legal purposes, and do not violate well-known. In particular, necessary measures are taken for personal information of the user, illegal access to personal information data of the user is prevented, and personal information security, network security and national security of the user are maintained.
In embodiments of the present disclosure, the user's authorization or consent is obtained before the user's personal information is obtained or collected.
FIG. 1 schematically illustrates an exemplary system architecture to which test script generation methods and apparatus may be applied, according to embodiments of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and/or wireless communication links, and the like.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients and/or social platform software, to name a few.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that, the test script generating method provided by the embodiments of the present disclosure may be generally executed by the server 105. Accordingly, the test script generating device provided by the embodiments of the present disclosure may be generally provided in the server 105. The test script generation method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the test script generating apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Alternatively, the test script generation method provided by the embodiment of the present disclosure may be executed by the terminal device 101, 102, or 103, or may be executed by another terminal device other than the terminal device 101, 102, or 103. Accordingly, the test script generating apparatus provided by the embodiments of the present disclosure may also be provided in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103.
For example, a test request for a target front-end application may be transmitted to any one of the terminal devices 101, 102, or 103 (for example, but not limited to, the terminal device 101), or stored on an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally execute the test script generation method provided by the embodiment of the present disclosure, or send a test request for the target front-end application to other terminal devices, servers, or server clusters, and execute the test script generation method provided by the embodiment of the present disclosure by the other terminal devices, servers, or server clusters that receive the test request.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 2 schematically illustrates a flow chart of a test script generation method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S203.
In operation S201, in response to a test request for a target front-end application, a control element included in a first page and a test instruction corresponding to the control element included in the first page are determined based on a screenshot of the first page of the target front-end application.
According to the embodiment of the disclosure, when a test request for a target front-end application is received, a page screenshot is firstly carried out on a first page of the target front-end application, and the position, the control type and the corresponding test instruction of each control element are determined by utilizing the page screenshot.
According to the embodiment of the disclosure, the first page is not limited, and may be an initial page when the target front-end application is accessed, or may be an intermediate page after multiple hops when the target front-end application is accessed, or may be other pages.
According to the embodiment of the disclosure, the page screenshot is carried out on the first page, so that the control elements contained in the page and the test instructions corresponding to the control elements can be determined, a foundation is laid for subsequent processing, and the test script can be generated in a later period.
In operation S202, a test path is parsed by using control elements included in the first page, so as to obtain a multi-item-label test path, where the target test path includes a plurality of nodes, the nodes represent the control elements, and edges between the nodes represent an execution sequence of the control elements.
According to the embodiment of the disclosure, each control element is traversed by using the test instruction respectively corresponding to the control elements, wherein a plurality of different target test paths can be obtained according to different traversing sequences of the control elements.
According to the embodiment of the disclosure, the test path analysis is performed on the control elements included in the page, the test instructions of the control elements can be executed according to different sequences, so that a multi-item-standard test path is formed, namely, the automatic analysis of the test path is realized, the test efficiency is improved, the control elements can be traversed according to different sequences, the test path is comprehensively covered, and the problem of omission of the unobvious test path is avoided.
In operation S203, a test script of the target front-end application is generated based on the multi-label test path and test instructions corresponding to each of a plurality of nodes included in each of the multi-label test path.
According to the embodiment of the disclosure, test sub-scripts corresponding to each target test path are obtained by using test instructions corresponding to each target test path and a plurality of nodes included in each target test path, and test scripts corresponding to all target test paths are obtained by using test sub-scripts corresponding to each target test path, so that the test of applying full path coverage to the front end is completed.
According to the embodiment of the disclosure, a control element and a test instruction corresponding to the control element included in a page are determined through a screenshot of a first page of a front-end application; and analyzing the test paths by utilizing control elements included in the page to obtain a plurality of test paths, and finally generating a test script of the target front-end application based on the multi-item target test paths and test instructions corresponding to a plurality of nodes included in the multi-item target test paths. Because the newly deployed front-end application or the new version of the deployed front-end application is adopted, a plurality of test paths are automatically obtained by utilizing control elements, and then the test scripts of the front-end application are obtained by utilizing the multi-item mark test paths and the test instructions corresponding to the nodes respectively included in the multi-item mark test paths, the technical problems of low test efficiency and low reusability in the prior art are at least partially overcome, and further, the automatic test of the front-end application is realized, and the test efficiency and the test script reusability are improved.
The method shown in fig. 2 is further described below with reference to fig. 3-7 in conjunction with the exemplary embodiment.
According to an embodiment of the present disclosure, based on a screenshot of a first page of a target front-end application, determining a control element included in the first page and a test instruction corresponding to the control element included in the first page includes: performing image processing on the screenshot of the first page to obtain a control element, a control type of the control element and position information of the control element included in the first page; for each control element, determining an instruction template and a test instance corresponding to the control element based on the control type of the control element; and obtaining the test instruction corresponding to the control element based on the position information of the control element, the test instance corresponding to the control element and the instruction template corresponding to the control element.
According to the embodiment of the disclosure, the image processing is performed on the screenshot of the first page, and the image processing operations such as re-screenshot, text recognition, pattern recognition and the like can be performed through the screenshot of the page.
According to the embodiment of the disclosure, the control type of the control element is not limited, and may be any control type, for example: input class controls, key class controls, option class controls, and the like.
According to embodiments of the present disclosure, different control types may correspond to one or more instruction templates, which may be set according to actual requirements.
According to the embodiments of the present disclosure, specific settings for the test case may be set according to actual requirements, for example: a test case of a control element may be a control type-control identification-input value, and as for the above test case, it may be specifically in the form of input class-name-Zhang san, input class-mobile phone number-12345678910, etc.
According to embodiments of the present disclosure, the instruction templates and test cases may be stored in a database, which may be a local database, or a database stored by an external device.
According to the embodiment of the disclosure, the position information of the control element and the input information in the test case corresponding to the control element can be automatically matched and extracted in a preset manner, the input information and the position information are matched into the instruction template corresponding to the control element, and the test instruction corresponding to the control element can be obtained, wherein the input information in the test case corresponding to the control and the control element can be the information corresponding to the control element, such as: input value information, control identification information and the like in the test case.
According to the embodiment of the disclosure, the preset manner is not limited, and may be any manner of matching the position information of the control element, the test case corresponding to the control element, and the instruction template corresponding to the control element, for example: machine learning methods, and the like.
According to the embodiment of the disclosure, the first page screenshot is subjected to image processing to obtain the control elements, the control types of the control elements and the position information of the control elements, then the instruction templates and the test cases corresponding to each control element are determined based on the control types of each control element, finally the test instructions corresponding to the control are obtained based on the position information of the control elements, the test cases corresponding to the control elements and the instruction templates corresponding to the control elements, and further the corresponding test instructions are generated through the characteristics of the control elements, so that a foundation is laid for the subsequent path test and the process of generating the test script, the test instructions can be directly called when the test script is used, and the test efficiency and the test accuracy of front-end application are improved.
According to an embodiment of the present disclosure, performing image processing on a screenshot of a first page to obtain a control element included in the first page, a control type of the control element, and position information of the control element, including: carrying out style recognition on the screenshot of the first page to obtain at least one control element region; for each control element region, performing text recognition on the control element region to determine control elements related to the control element region and control types of the control elements; and determining the position information of the control element area based on a preset coordinate system, wherein the preset coordinate system is related to the screenshot of the first page.
According to the embodiment of the disclosure, the manner of pattern recognition of the screenshot of the first page is not limited, and each control element area can be recognized according to the image gradient.
According to the embodiments of the present disclosure, the manner of text recognition is not limited, for example: OCR (optical character recognition) may be utilized to text recognize control elements and types of control elements that are related to a control region.
According to the embodiment of the disclosure, a preset coordinate system may be set on the screenshot of the first page, so that the position information of the control element area is determined according to the coordinate point where the control element area is located, where the position information of the control element area may be determined according to the center point of the control element area, for example, the position coordinate of the control element area may be represented by the center point of any control element area.
FIG. 3 schematically illustrates a screenshot schematic of a target front-end application in accordance with an embodiment of the disclosure.
As shown in fig. 3, the screenshot includes 6 control elements and 2 control types, and a control element area and a specific control element and a control type of the control element can be determined by performing pattern recognition and text recognition on the screenshot, wherein if the position information of the control element area is to be determined, a control element example with a control mark as a name is taken as an example, after a coordinate system is set on the screenshot, an area formed by characters and an input box is identified as a control area 1, and the coordinates of the control area are determined based on the central point of the control area 1.
According to the embodiment of the disclosure, the type of the coordinate system of the preset coordinates is not limited, and may be set according to specific situations, for example, may be an x-y coordinate system, and may also be other coordinate systems.
Fig. 4 schematically illustrates a flow chart of determining a target test path according to an embodiment of the disclosure.
As shown in fig. 4, a target test path is determined, including operations S401 to S404.
In operation S401, a first target control element is determined from control elements included in a first page.
In operation S402, a test instruction corresponding to the first target control element is executed, so as to obtain a second page.
In operation S403, path detection is performed based on the first page and the second page, and a detection result is obtained.
In operation S404, in a case where the detection result indicates that the path is closed-loop, a target test path is obtained based on the first target control element.
According to an embodiment of the present disclosure, the first target control element may be any one of the control elements included in the first page.
According to the embodiment of the disclosure, the second page can be obtained by executing the test instruction corresponding to the first target control element, and the second page can be different when the test instruction is executed on different first target control elements.
According to embodiments of the present disclosure, the detection result may include a detection result indicating that the path is closed loop, or may include a detection result indicating that the path is not closed loop.
According to the embodiment of the disclosure, since the first target control element may be any control element in the first page, any control element may be the start point of the target test path, after the test instruction of one control element is executed, the test result is determined, whether the path is closed or not is determined in real time, and if the path is closed, the path is recorded as an item mark test path.
According to the embodiment of the disclosure, the test path is obtained through automatic analysis, so that automatic test on the front-end application can be realized, the test efficiency is improved, and meanwhile, the full coverage probability of the test path is increased, so that the difficulty of the process of the front-end application test is reduced, and the method is more suitable for a scene of rapid iteration of the front-end application.
According to an embodiment of the present disclosure, path detection is performed based on a first page and a second page, to obtain a detection result, including: obtaining a page jump detection result based on the page similarity between the first page and the second page; determining a control type of a first target control element under the condition that the page jump detection result indicates that the page jump does not occur; under the condition that the control type of the first target control element is a preset control type, a detection result indicating that the path is not closed loop is obtained; and under the condition that the control type of the first target control element is not the preset control type, obtaining a detection result representing the path closed loop.
According to the embodiment of the disclosure, the first page and the second page are compared, the page similarity between the first page and the second page is determined, and the page jump detection result is obtained.
According to the embodiment of the disclosure, if the page similarity exceeds the preset threshold, the page jump detection result is that the page jump occurs, and if the page similarity does not exceed the preset threshold, the page jump detection result is that the page jump does not occur.
According to an embodiment of the present disclosure, the preset control type may be a control type that does not cause a page to jump, for example: input class controls, option class controls, and the like.
According to the embodiment of the disclosure, when the control type of the first target control element is not the preset control type, the second page and the first page can be completely the same, and then a detection result representing the path closed loop is obtained.
According to the embodiment of the disclosure, whether the page jumps or not can be determined by comparing the page similarity, if the page does not jump, the control type of the first target control element is determined, the control type of the first target control element is compared with the preset control type, if the control type is included in the preset control type, the path is determined to be not closed-loop, and if the control type of the first target control element is not the preset control type, the path is determined to be closed-loop.
According to the embodiment of the disclosure, after the test instruction corresponding to the control element is operated, the path is detected in real time, whether the path is closed loop or not can be accurately and rapidly determined, and if the closed loop is closed loop, the closed loop can be directly stored as an item mark test path.
According to an embodiment of the present disclosure, in a case where the page jump detection result indicates that a page jump occurs, the detection result is determined based on the second page.
According to the embodiment of the disclosure, if the page jump detection result indicates that the page jump occurs, whether the second page meets the condition of the path closed loop is determined, if yes, the path closed loop is described, and the first target control element is recorded. And if the path closed-loop condition is not met, performing target test path analysis on the control elements included in the second page.
According to an embodiment of the present disclosure, determining a detection result based on the second page includes: under the condition that the second page meets the preset condition, a detection result representing the path closed loop is obtained; wherein the preset conditions include any one of the following: the second page comprises a characteristic area; the second page is a preset empty page; and the second page does not contain a control element.
According to the embodiment of the disclosure, the preset condition is a page representation result which can represent that the detection result is a path closed loop. For example: the preset condition may be that the second page includes a feature area, the second page is a preset empty page, and the second page does not include a control element.
According to the embodiment of the present disclosure, the expression form of the feature area is not limited, and may be that a popup window area occurs, or that a special mark occurs, or the like.
According to the embodiment of the disclosure, the representation form of the preset blank page is not limited, and the preset blank page can be generated for closing the page, or the page is set to be a blank picture, or the like.
Fig. 5 schematically illustrates a schematic diagram of including feature regions in a second page according to an embodiment of the disclosure.
When the feature area included in the two pages is a popup window area, the expression form of the feature area may be as shown in fig. 5, and other forms of design may be performed as well. In addition, the keywords of the popup window area can be designed, for example, keywords such as happiness, completion, ending, error, thank you, bystandness and the like, and the detection result can be judged according to the method for identifying the keywords.
According to the embodiment of the disclosure, in the case that the detection result indicates that the path is not closed-loop, determining a second target control element from control elements included in a second page; and running a test instruction corresponding to the second target control element to obtain a third page, and continuing to perform path detection on the third page.
According to the embodiment of the disclosure, when the detection result indicates that the path is not closed-loop, determining a second target control element from control elements included in a second page, then running a test instruction corresponding to the second target control element to obtain a third page, then performing path detection on the second page and the third page by using a path detection method for the first page and the second page, namely comparing the page similarity of the second page and the third page to obtain a page detection result, determining a control type of the second target control element according to the page detection result, then determining a detection result indicating whether the path is closed-loop based on the control type, recording that the path is a target test path if the path is closed-loop, and continuously determining a fourth page if the path is not closed-loop, and performing the above operation.
According to the embodiment of the disclosure, the control elements of each interface are continuously tested until the test result is represented as a path closed loop, and the comprehensiveness of the test path can be further increased through a continuous circulation process.
According to the embodiment of the disclosure, in response to obtaining the target page, determining control elements included in the target page and test instructions corresponding to the control elements included in the target page based on a screenshot of the target page, wherein the target page comprises a second page or a third page.
According to the embodiment of the disclosure, the page screenshot is performed on each target page, so that the control element and the test instruction corresponding to the control element included in the target page can be directly determined when the test path analysis is performed, and the effect of accelerating the test efficiency is further achieved.
FIG. 6 schematically illustrates a flow chart of generating a test script in accordance with an embodiment of the present disclosure.
As shown in fig. 6, a test script is generated, including operations S601 to S602.
In operation S601, for each target test path, based on edges between a plurality of nodes included in the target test path, test instructions corresponding to the plurality of nodes included in the target test path are spliced, so as to obtain a test sub-script.
In operation S602, the test sub-scripts of each of the multiple-label test paths are spliced to obtain a test script.
According to the embodiment of the disclosure, for each target test path, based on the execution sequence of each control element, a plurality of nodes included in the target test path, that is, test instructions corresponding to the control elements, may be spliced to obtain test sub-scripts, for example: and if the target test path is input name-input mobile phone-confirmation, splicing the control element input name, the input mobile phone and the test instruction corresponding to each confirmation to obtain a test sub-script.
According to the embodiment of the disclosure, the test path is obtained through automatic analysis, and then the test sub-script is obtained based on the test instructions corresponding to each node in the test path, so that the test script can be obtained more efficiently, the target front end can be tested more efficiently and accurately, and meanwhile, the reusability of the test script can be improved.
FIG. 7 schematically illustrates a flow chart of a test script generation method according to another embodiment of the present disclosure.
The test script generation method of another embodiment as shown in fig. 7 includes operations S701 to S709.
In operation S701, in response to a test request for a target front-end application, a control element included in a first page and a test instruction corresponding to the control element included in the first page are determined based on a page screenshot of the first page of the target front-end application.
In operation S702, a first target control element is determined from control elements included in a first page.
In operation S703, a test instruction corresponding to the first target control element is executed, and a second page is obtained.
In operation S704, path detection is performed based on the first page and the second page, and a detection result is obtained.
In operation S705, it is determined whether the path detection result represents a path closed loop.
In operation S706, in a case where the detection result indicates that the path is closed-loop, a target test path is obtained based on the first target control element.
In operation S707, in a case where the detection result indicates that the path is not closed-loop, a second target control element is determined from among the control elements included in the second page.
In operation S708, a test instruction corresponding to the second target control element is executed, resulting in a third page.
In operation S709, the second page is taken as a new first page, and the third page is taken as a new second page. After the completion of operation S709, execution of operation S704 is returned.
Fig. 8 schematically illustrates a flow chart of a front-end application test method according to an embodiment of the disclosure.
As shown in fig. 8, the front-end application test method includes operation S801.
In operation S801, in response to a test request, a test script of a target front-end application is run to test the target front-end application, and a test result is obtained.
According to the embodiment of the disclosure, when a test request is received, a test script can be operated to test a target front-end application, a plurality of response results corresponding to a multi-item target test path are obtained, a page screenshot of each response result is compared with a page screenshot of a preset result to obtain a comparison result, if the comparison result shows that the similarity of the response result and the preset result meets a preset test condition, the target test path passes the test, and if the comparison result shows that the similarity of the response result and the preset result does not meet the preset test condition, the target test path with a problem is considered to be a problem path.
According to the embodiment of the disclosure, test results are determined based on a plurality of comparison results, if each target test path passes the test, the front-end application is indicated to pass the test, if a problem path exists, the front-end application is considered to have a problem in the path, a test log can be stored, and then retests or alarm reminding can be performed.
According to the embodiment of the disclosure, by testing each label test path, if a problem is found, feedback can be timely performed, whether the service function is normal or not is rapidly verified, and according to feedback information and a test log, an error transaction path is rapidly positioned, the problem in front-end application is timely determined, and correction is performed.
Fig. 9 schematically shows a block diagram of a test script generating apparatus according to an embodiment of the present disclosure.
As shown in fig. 9, the test script generating apparatus 900 includes a test instruction determining module 910, a test path analyzing module 920, and a test script generating module 930.
The test instruction determining module 910 is configured to determine, based on a screenshot of a first page of the target front-end application, a control element included in the first page and a test instruction corresponding to the control element included in the first page, in response to a test request for the target front-end application.
The test path analysis module 920 is configured to analyze a test path by using a control element included in the first page to obtain a multi-label test path, where the target test path includes a plurality of nodes, the nodes represent the control element, and edges between the plurality of nodes represent an execution sequence of the control element.
The test script generating module 930 is configured to generate a test script of the target front-end application based on the multi-label test path and test instructions corresponding to a plurality of nodes included in the multi-label test path.
According to an embodiment of the present disclosure, the test instruction determination module 910 includes: the device comprises a position information acquisition sub-module, an instruction template and a test case determination sub-module and a test instruction determination sub-module.
The position information acquisition sub-module is used for carrying out image processing on the screenshot of the first page to obtain the control element included in the first page, the control type of the control element and the position information of the control element.
The instruction template and test case determining submodule is used for determining an instruction template and a test case corresponding to the control element based on the control type of the control element for each control element.
The test instruction determining submodule is used for obtaining the test instruction corresponding to the control element based on the position information of the control element, the test instance corresponding to the control element and the instruction template corresponding to the control element.
According to an embodiment of the present disclosure, the location information acquisition sub-module includes: style recognition unit, word recognition unit and position information determination unit.
The style identification unit is used for carrying out style identification on the screenshot of the first page to obtain at least one control element area.
And the text recognition unit is used for carrying out text recognition on the control element areas for each control element area so as to determine the control elements related to the control element areas and the control types of the control elements.
The position information determining unit is used for determining the position information of the control element area based on a preset coordinate system, wherein the preset coordinate system is related to the screenshot of the first page.
According to an embodiment of the present disclosure, the test path parsing module 920 includes: the system comprises a first target space element determining sub-module, a second page obtaining sub-module, a detection result obtaining sub-module and a target test path determining sub-module.
The first target space element determination submodule is used for determining a first target control element from control elements included in the first page.
And the second page acquisition sub-module is used for running a test instruction corresponding to the first target control element to obtain a second page.
And the detection result acquisition sub-module is used for carrying out path detection based on the first page and the second page to obtain a detection result.
And the target test path determining sub-module is used for obtaining a target test path based on the first target control element under the condition that the detection result represents the path closed loop.
According to an embodiment of the present disclosure, the detection result acquisition submodule includes: the device comprises a page jump detection result acquisition unit, a control type determination unit, a first detection result acquisition unit and a second detection result acquisition unit.
The page jump detection result acquisition unit is used for acquiring a page jump detection result based on the page similarity between the first page and the second page.
The first page jump detection result representing unit is used for determining the control type of the first target control element under the condition that the page jump detection result represents that the page jump does not occur.
The first detection result obtaining unit is used for obtaining a detection result indicating that the path is not closed loop under the condition that the control type of the first target control element is the preset control type.
The second detection result obtaining unit obtains a detection result representing the path closed loop under the condition that the control type of the first target control element is not the preset control type.
According to an embodiment of the present disclosure, the test script generating apparatus 900 further includes: the second page jump detection result represents the presentation module.
And the second page jump detection result representation module is used for determining a detection result based on the second page when the page jump detection result represents that the page jump occurs.
According to an embodiment of the present disclosure, the second page jump detection result representation module includes: and a second page detection sub-module.
The second page detection sub-module is used for obtaining a detection result representing the path closed loop under the condition that the second page meets the preset condition; wherein the preset conditions include any one of the following: the second page comprises a characteristic area; the second page is a preset empty page; and the second page does not contain a control element.
According to an embodiment of the present disclosure, the test script generating apparatus 900 further includes: the system comprises a second target control element determining module and a third page path detecting module.
And the second target control element determining module is used for determining a second target control element from control elements included in the second page under the condition that the detection result indicates that the path is not closed-loop.
And the third page path detection module is used for running a test instruction corresponding to the second target control element to obtain a third page, and continuously carrying out path detection on the third page.
According to an embodiment of the present disclosure, the test script generating apparatus 900 further includes: control elements and test instruction determination modules.
The control element and test instruction determining module is used for determining control elements included in the target page and test instructions corresponding to the control elements included in the target page based on the screenshot of the target page in response to obtaining the target page, wherein the target page comprises a second page or a third page.
According to an embodiment of the present disclosure, the test script generation module 930 includes: the test sub-script determines the sub-module and the test sub-script splices the sub-module.
And the test sub-script determining sub-module is used for splicing the test instructions corresponding to the nodes included in the target test path based on edges among the nodes included in the target test path for each target test path to obtain the test sub-script.
And the test sub-script splicing sub-module is used for splicing the test sub-scripts of each of the multiple item mark test paths to obtain the test script.
Any number of modules, sub-modules, units, sub-units, or at least some of the functionality of any number of the sub-units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in any other reasonable manner of hardware or firmware that integrates or encapsulates the circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be at least partially implemented as computer program modules, which when executed, may perform the corresponding functions.
For example, any of the test instruction determination module 910, the test path parsing module 920, and the test script generation module 930 may be combined in one module/unit/sub-unit or any of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least some of the functionality of one or more of these modules/units/sub-units may be combined with at least some of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to embodiments of the present disclosure, at least one of the test instruction determination module 910, the test path parsing module 920, and the test script generation module 930 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, at least one of the test instruction determination module 910, the test path parsing module 920, and the test script generation module 930 may be at least partially implemented as a computer program module, which when executed, may perform the corresponding functions.
Fig. 10 schematically illustrates a block diagram of a front-end application testing apparatus according to an embodiment of the present disclosure.
As shown in fig. 10, the front-end application test apparatus 1000 includes a test result determination module 1010.
And the test result determining module 1010 is configured to run a test script of the target front-end application to test the target front-end application in response to the test request, so as to obtain a test result.
Any number of modules, sub-modules, units, sub-units, or at least some of the functionality of any number of the sub-units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in any other reasonable manner of hardware or firmware that integrates or encapsulates the circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be at least partially implemented as computer program modules, which when executed, may perform the corresponding functions.
For example, any number of the test result determination modules 1010 may be combined in one module/unit/sub-unit or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least some of the functionality of one or more of these modules/units/sub-units may be combined with at least some of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to embodiments of the present disclosure, at least one of the test result determination modules 1010 may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, at least one of the test result determination modules 1010 may be implemented at least in part as a computer program module that, when executed, performs the corresponding function.
Fig. 11 schematically illustrates a block diagram of an electronic device adapted to implement a test script generation method according to an embodiment of the disclosure. The electronic device shown in fig. 11 is merely an example, and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 11, a computer electronic device 1100 according to an embodiment of the present disclosure includes a processor 1101 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. The processor 1101 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 1101 may also include on-board memory for caching purposes. The processor 1101 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flow according to embodiments of the present disclosure.
In the RAM1103, various programs and data necessary for the operation of the electronic device 1100 are stored. The processor 1101, ROM1102, and RAM1103 are connected to each other by a bus 1104. The processor 1101 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM1102 and/or the RAM 1103. Note that the program may be stored in one or more memories other than the ROM1102 and the RAM 1103. The processor 1101 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the disclosure, the electronic device 1100 may also include an input/output (I/O) interface 1105, the input/output (I/O) interface 1105 also being connected to the bus 1104. The electronic device 1100 may also include one or more of the following components connected to an input/output (I/O) interface 1105: an input section 1106 including a keyboard, a mouse, and the like; an output portion 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1108 including a hard disk or the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, and the like. The communication section 1109 performs communication processing via a network such as the internet. The drive 1110 is also connected to an input/output (I/O) interface 1105 as required. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed in drive 1110, so that a computer program read therefrom is installed as needed in storage section 1108.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1109, and/or installed from the removable media 1111. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 1101. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM1102 and/or RAM1103 described above and/or one or more memories other than ROM1102 and RAM 1103.
Embodiments of the present disclosure also include a computer program product comprising a computer program comprising program code for performing the methods provided by the embodiments of the present disclosure, the program code for causing an electronic device to implement the test script generation methods provided by the embodiments of the present disclosure when the computer program product is run on the electronic device.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 1101. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program can also be transmitted, distributed over a network medium in the form of signals, downloaded and installed via the communication portion 1109, and/or installed from the removable media 1111. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (16)

1. A test script generation method, comprising:
responding to a test request aiming at a target front-end application, and determining control elements included in a first page and test instructions corresponding to the control elements included in the first page based on a screenshot of the first page of the target front-end application;
analyzing a test path by using control elements included in the first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and
And generating a test script of the target front-end application based on the multi-item target test path and test instructions corresponding to a plurality of nodes respectively included in the multi-item target test path.
2. The method of claim 1, wherein the performing test path parsing by using the control element included in the first page to obtain a multi-label test path includes:
determining a first target control element from control elements included in the first page;
running a test instruction corresponding to the first target control element to obtain a second page;
performing path detection based on the first page and the second page to obtain a detection result; and
and under the condition that the detection result represents a path closed loop, obtaining the target test path based on the first target control element.
3. The method of claim 2, wherein the performing path detection based on the first page and the second page to obtain a detection result includes:
obtaining a page jump detection result based on the page similarity between the first page and the second page;
determining the control type of the first target control element under the condition that the page jump detection result indicates that the page jump does not occur;
Obtaining the detection result indicating that the path is not closed loop under the condition that the control type of the first target control element is a preset control type; and
and under the condition that the control type of the first target control element is not the preset control type, obtaining the detection result representing the path closed loop.
4. A method according to claim 3, further comprising:
and determining the detection result based on the second page under the condition that the page jump detection result indicates that page jump occurs.
5. The method of claim 4, wherein the determining the detection result based on the second page comprises:
under the condition that the second page meets the preset condition, obtaining the detection result representing the path closed loop;
wherein the preset condition includes any one of the following:
the second page comprises a characteristic area;
the second page is a preset empty page; and
the second page does not contain the control element.
6. The method of claim 2, further comprising:
determining a second target control element from control elements included in the second page under the condition that the detection result indicates that the path is not closed-loop; and
And running a test instruction corresponding to the second target control element to obtain a third page, and continuing to perform path detection on the third page.
7. The method of any of claims 2-6, further comprising:
and responding to a target page, and determining control elements included in the target page and test instructions corresponding to the control elements included in the target page based on the page screenshot of the target page, wherein the target page comprises the second page or the third page.
8. The method of claim 1, wherein the determining, based on the screenshot of the first page of the target front-end application, a control element included in the first page and a test instruction corresponding to the control element included in the first page includes:
performing image processing on the screenshot of the first page to obtain a control element included in the first page, a control type of the control element and position information of the control element;
for each control element, determining an instruction template and a test instance corresponding to the control element based on the control type of the control element; and
And obtaining a test instruction corresponding to the control element based on the position information of the control element, the test instance corresponding to the control element and the instruction template corresponding to the control element.
9. The method of claim 8, wherein the image processing the screenshot of the first page to obtain the control element included in the first page, the control type of the control element, and the position information of the control element includes:
carrying out style recognition on the screenshot of the first page to obtain at least one control element region;
for each control element region, carrying out text recognition on the control element region to determine control elements related to the control element region and control types of the control elements; and
and determining the position information of the control element region based on a preset coordinate system, wherein the preset coordinate system is related to the screenshot of the first page.
10. The method of claim 1, wherein the generating the test script of the target front-end application based on the multi-label test path and the test instructions corresponding to each of the plurality of nodes each of which the multi-label test path includes comprises:
For each target test path, splicing test instructions corresponding to a plurality of nodes included in the target test path respectively based on edges among the plurality of nodes included in the target test path to obtain test sub-scripts; and
and splicing the test sub-scripts of each multi-item mark test path to obtain the test script.
11. A front-end application testing method, comprising:
responding to a test request, and running a test script of a target front-end application to test the target front-end application to obtain a test result;
wherein the test script comprises being generated using the test script generation method according to any one of claims 1 to 10.
12. A test script generating device, comprising:
the testing instruction determining module is used for responding to a testing request aiming at a target front-end application, and determining control elements included in a first page and testing instructions corresponding to the control elements included in the first page based on a screenshot of the first page of the target front-end application;
the test path analysis module is used for analyzing a test path by utilizing the control elements included in the first page to obtain a multi-item target test path, wherein the target test path comprises a plurality of nodes, the nodes represent the control elements, and edges among the nodes represent the execution sequence of the control elements; and
And the test script generation module is used for generating the test script of the target front-end application based on the multi-item target test path and the test instructions corresponding to the nodes included in the multi-item target test path.
13. A front-end application testing apparatus, comprising:
the test result determining module is used for responding to the test request, running a test script of the target front-end application and testing the target front-end application to obtain a test result;
wherein the test script comprises being generated using the test script generation method according to any one of claims 1 to 10.
14. An electronic device, comprising:
one or more processors;
a memory for storing one or more instructions,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1 to 11.
15. A computer readable storage medium having stored thereon executable instructions which when executed by a processor cause the processor to implement the method of any of claims 1 to 11.
16. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 11 when executed.
CN202310561472.3A 2023-05-18 2023-05-18 Test script generation method and device, electronic equipment and storage medium Pending CN116594886A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310561472.3A CN116594886A (en) 2023-05-18 2023-05-18 Test script generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310561472.3A CN116594886A (en) 2023-05-18 2023-05-18 Test script generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116594886A true CN116594886A (en) 2023-08-15

Family

ID=87598672

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310561472.3A Pending CN116594886A (en) 2023-05-18 2023-05-18 Test script generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116594886A (en)

Similar Documents

Publication Publication Date Title
US11507677B2 (en) Image classification modeling while maintaining data privacy compliance
US10997249B2 (en) Search query intent
US11256912B2 (en) Electronic form identification using spatial information
CN111291765A (en) Method and device for determining similar pictures
US20160171104A1 (en) Detecting multistep operations when interacting with web applications
CN110688111A (en) Configuration method, device, server and storage medium of business process
CN113535577A (en) Application testing method and device based on knowledge graph, electronic equipment and medium
CN112363814A (en) Task scheduling method and device, computer equipment and storage medium
US8751508B1 (en) Contextual indexing of applications
CN115827122A (en) Operation guiding method and device, electronic equipment and storage medium
CN116594886A (en) Test script generation method and device, electronic equipment and storage medium
CN115080433A (en) Testing method and device based on flow playback
CN112035092A (en) Form processing method, device, equipment and readable medium
CN112417252B (en) Crawler path determination method and device, storage medium and electronic equipment
CN114817007A (en) Information processing method and device, electronic equipment and computer readable storage medium
CN117009701A (en) Front-end page detection method and device, electronic equipment and medium
CN113392014A (en) Test case generation method and device, electronic equipment and medium
CN116894004A (en) Information display method and device, electronic equipment and computer readable storage medium
CN116680184A (en) Code scanning method, device, electronic equipment and medium
CN116450416A (en) Redundancy check method and device for software test cases, electronic equipment and medium
CN116049222A (en) Verification method and device for database access request, electronic equipment and storage medium
CN116594876A (en) Interface testing method, device, equipment and storage medium
CN116541840A (en) Malicious software homology analysis method, device, equipment and medium
CN113961963A (en) Information processing method, information processing apparatus, electronic device, storage medium, and program product
CN116975846A (en) Text information extraction method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination