CN110941546A - Automatic test method, device, equipment and storage medium for WEB page case - Google Patents

Automatic test method, device, equipment and storage medium for WEB page case Download PDF

Info

Publication number
CN110941546A
CN110941546A CN201910969484.3A CN201910969484A CN110941546A CN 110941546 A CN110941546 A CN 110941546A CN 201910969484 A CN201910969484 A CN 201910969484A CN 110941546 A CN110941546 A CN 110941546A
Authority
CN
China
Prior art keywords
test
page
web page
case
result
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
CN201910969484.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.)
Ping An Health Insurance Company of China Ltd
Original Assignee
Ping An Health Insurance Company of China 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 Ping An Health Insurance Company of China Ltd filed Critical Ping An Health Insurance Company of China Ltd
Priority to CN201910969484.3A priority Critical patent/CN110941546A/en
Publication of CN110941546A publication Critical patent/CN110941546A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an automatic test method, device, equipment and storage medium for WEB page cases, which are applied to the technical field of automatic test and used for solving the problems of poor transportability and low test efficiency of the existing test method. The method provided by the invention comprises the following steps: acquiring each test case of a WEB page to be tested; converting each test case into each target case in an XML format; aiming at each target case, executing each test step in each target case one by one, and when executing each test step, calling a test object of each target case to participate in the operation of the test step of a to-be-tested WEB page element corresponding to the test object, wherein the to-be-tested WEB page element is stored in a preset XML file; aiming at each target case, obtaining a test result obtained by executing each test step of each target case; and writing the test result corresponding to each target case into the test report to obtain the test report of the WEB page to be tested.

Description

Automatic test method, device, equipment and storage medium for WEB page case
Technical Field
The invention relates to the technical field of automatic testing, in particular to an automatic testing method, device, equipment and storage medium for WEB page cases.
Background
With the rapid development and progress of science and technology, the iteration cycle of projects such as systems, software and the like is shorter and shorter, and the projects need to be tested in each iteration process to check the result of iterative update. It can be seen that the cost of testing required during the development and maintenance of a project is becoming higher and higher, which leads to a reduction in testing costs and an increase in testing efficiency being one of the trends in the art.
At present, automatic testing tools in the industry, such as qtp (quick Test service), are basically performed in a recording/playback manner, although the tools are simple and easy to use, the stability is very poor, the recording process is slow, the situations that elements on the interface of a software product cannot be identified and operated easily occur, scripts, data and services of Test cases recorded by the tools are mixed together, the whole body is moved by pulling one time, and the subsequent maintenance cost is very high. For example, when an operation test needs to be performed on a certain new WEB page element, codes of test cases need to be rewritten for the new element, and the rewritten codes include contents of the element to be tested, the operation of the test, the test step, and the like. Therefore, the existing testing method has the problems of poor transportability and low testing efficiency.
Disclosure of Invention
The embodiment of the invention provides an automatic test method, device, computer equipment and storage medium for WEB page cases, and aims to solve the problems of poor transportability and low test efficiency of the conventional test method.
An automatic test method for WEB page use cases comprises the following steps:
obtaining each test case of a WEB page to be tested, wherein each test case comprises a test object, an operation and each test step;
converting each test case into each target case in an XML format;
executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file;
aiming at each target case, obtaining a test result obtained by executing each test step of each target case;
and writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested.
An automatic test device for WEB page use cases comprises:
the test case acquisition module is used for acquiring each test case of the WEB page to be tested, wherein each test case comprises a test object, an operation and each test step;
the case conversion module is used for converting each test case into each target case in an XML format;
the test step execution module is used for executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file;
the test result acquisition module is used for acquiring a test result obtained by executing each test step of each target case aiming at each target case;
and the report writing module is used for writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested.
A computer device comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the processor realizes the steps of the automatic test method of the WEB page use case when executing the computer program.
A computer readable storage medium stores a computer program, and the computer program when executed by a processor implements the steps of the automated testing method for WEB page use cases.
Firstly, obtaining each test case of a to-be-tested WEB page, wherein each test case comprises a test object, an operation and each test step; then, converting each test case into each target case in an XML format; executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file; then, aiming at each target case, obtaining a test result obtained by executing each test step of each target case; and finally, writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested. Therefore, the invention separately stores the page elements in the XML file for management, and the test case is separated from the XML file. By the design, the page elements of the WEB page to be tested can be acquired from the XML file through the test object to participate in the execution of the test step when needed, so that the test case can be conveniently executed, the test result and the test report can be generated, and when the page elements need to be newly added, modified and deleted, the XML file for storing the page elements and the mapping relation between the page elements and the test object only need to be adjusted, so that the maintenance cost of the case test is greatly reduced, and the portability and the test efficiency of the case test are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of an application environment of an automated testing method for a WEB page use case according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for automated testing of WEB page use cases in an embodiment of the invention;
FIG. 3 is a schematic flow chart illustrating a preset correspondence relationship of an automated testing method for a WEB page use case in an application scenario according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a template for newly adding a test step in an application scenario in the automated test method for a WEB page case according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart illustrating the verification of the test result in an application scenario by the automated test method for a WEB page use case according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating an automated testing method for a WEB page use case according to an embodiment of the present invention, recording a failure result of a testing step in an application scenario;
FIG. 7 is a schematic structural diagram of an automated testing apparatus for a WEB page use case in a first application scenario according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an automated testing apparatus for a WEB page use case in a second application scenario according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an automated testing apparatus for WEB page use cases in a third application scenario according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a computer device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The automatic test method for the WEB page use case provided by the application can be applied to an application environment shown in figure 1, wherein a client communicates with a server through a network. Wherein the client may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers.
In an embodiment, as shown in fig. 2, an automated testing method for a WEB page use case is provided, which is described by taking the server in fig. 1 as an example, and includes the following steps:
101. obtaining each test case of a WEB page to be tested, wherein each test case comprises a test object, an operation and each test step;
in this embodiment, a tester may generate each test case in advance for a to-be-tested WEB page, where the test cases include a test object, an operation, and each test step, and may be stored in an EXCEL table, so as to facilitate sorting and setting of the test cases.
Specifically, a test template set can be preset on the server, the test template set comprises a plurality of test step templates, and when a tester needs to generate a test case, the tester can call a corresponding test step template from the test template set to generate a test step, so that the efficiency of the tester for generating and sorting each test case of the to-be-tested WEB page is greatly improved.
According to the above contents, when starting the test, the server may obtain each test case of the to-be-tested WEB page from the EXCEL table.
Before starting, initialization configuration can be performed according to the configuration file, and a corresponding WEB page browser is started. The browser can be an IE, firefox, google browser, etc., and the user can define the browser in the configuration file as IE, chroma or firefox, and the corresponding driver.
102. Converting each test case into each target case in an XML format;
it can be understood that, in order to facilitate the execution of the test cases, the server may convert each test case into each target case in an XML format, where the converted target case is in the XML format, which is more favorable for the invocation of the operation and test steps.
Specifically, in this embodiment, the server may implement format conversion and subsequent call execution of the test case through a secondarily encapsulated Selenium framework. The Selenium framework may include five modules, which are a use case parsing module, a bottom API module, a Page module, an execution module, and a Report module, respectively, and the content of each module is as follows:
a use case analysis module: and the method is responsible for analyzing each test case in the table according to the path in the EXCEL table, converting the test case into a target case in an XML format, and storing the target case into the hash table. In a specific application scenario, the data in the EXCEL table may include type, description (category), Page, elementName (use case parameter), action (action), and value, where the data type types may have four types:
step, namely, a using example Step;
template, namely a case Template, and the user can modularize the test case with higher use frequency to realize the reusability of the test case;
function, i.e., call Function, the Selenium framework provides a Function class, defining functions such as automatic generation of a mobile phone number;
sql, i.e., an operation database, and the Selenium framework provides DB classes that can connect and operate the corresponding operation database according to the corresponding action values.
A bottom layer API module: and the function for simulating the operation of the WEB page by the user is written, such as opening the page, clicking a button and the like.
A Page module: the method comprises the steps of converting a WEB page file in an XML format into readable page elements, and storing the readable page elements in a Page elements class, wherein the page elements mainly comprise pageName, type, name, finder and value. In the page element, the definition of each element is as follows:
type: the type of the page space is the type of the page space, and at present, there are eleven types, namely Button, CheckBox, Date, Link, MenuTree, Radio, SelectList, SubWindow, Table, TextField and UploadFile.
finder: the method refers to a method for searching page elements, and the Selenium framework supports four modes of id, name, xpath and menuPath, wherein the menuPath is specially customized for a menu.
value: refers to looking up a specific value of a page element.
And the execution module is the core of the whole Selenium frame, finds corresponding operation according to the keywords by using the java reflection principle, and executes the use case steps.
The Report module is mainly responsible for generating a test Report in an XML format, wherein the test Report can comprise a case name, a test result, duration, total number of cases, success number and failure number, and screenshot storage can be performed on the failure cases.
103. Executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file;
in this embodiment, it should be noted that, first, a correspondence between a test object and a page element of the to-be-tested WEB page is preset on the server, and in the correspondence, one test object may point to a specific page element or may point to a certain type of page element, and may be specifically set according to an actual use condition. The page elements of the to-be-tested WEB page are stored in a preset XML file, and therefore, when the page elements need to be modified, deleted or adjusted, the server can directly edit the XML file, updating of all the page elements on the to-be-tested WEB page can be completed, and adjustment and management of the page elements in the WEB page by testers are facilitated.
For ease of understanding, the setting process of the correspondence relationship will be described in detail below. Further, as shown in fig. 3, the correspondence between the test object and the page element may be preset by the following steps:
201. reading the WEB page to be tested in an XML format;
202. extracting each page element in the WEB page to be tested;
203. determining the page control type corresponding to each page element;
204. aiming at each page element, extracting a keyword of each page element according to the page control type corresponding to each page element;
205. and aiming at each page element, establishing a corresponding relation between each page element and a matched test object, wherein the matched test object refers to a test object with recorded test object information consistent with the keyword of each page element.
For step 201, first, the server may read the WEB page to be tested in XML format.
With respect to step 202, it is understood that the WEB page to be tested is composed of a plurality of page elements, including but not limited to Button, CheckBox, Date, Link, MenuTree, Radio, SelectList, SubWindow, Table, TextField, UploadFile, and so on. After the server reads the WEB page to be tested, each page element is easily extracted from the WEB page to be tested.
For step 203, after each page element is extracted, the type of the page element may be determined according to the type of the page control, and the type of the page element is the type of the page control, which is not described herein again. For example, for each "Button" on the WEB page, the page control type of each "Button" element can be determined as "Button".
With respect to step 204, it is understood that the positions of the keywords of page elements of different page control types may be different. For example, for a "Button" type page element, its keyword is typically the "Button" name, i.e., the value of the name; for a "CheckBox" type page element, the keyword is generally the name value of the Form corresponding to the check box, and the value can also be extracted from the attribute of the page element. Therefore, the server can extract the keyword of each page element according to the page control type corresponding to each page element.
As for step 205, it can be understood that, after the server extracts the keyword corresponding to each page element, the server may establish, for each page element, a corresponding relationship between each page element and a matched test object, where the matched test object refers to a test object whose recorded test object information is consistent with the keyword of each page element. That is, the server may find out a test object whose information recorded by the test object is consistent with the keyword, and establish a corresponding relationship between the found test object and the page element corresponding to the keyword. For example, if the information of the test object is "back", a certain page element is a "button", and the name value of the certain page element is "back", the test object is a matching object of the page element, and therefore a corresponding relationship can be established between the test object and the page element.
When the server executes step 103, the target use cases may be processed individually or may be processed individually. In the process of processing a target use case, the server can execute each test step in the target use case one by one. When executing each test step, the server may participate in the operation of the test object by calling the test object and the corresponding operation described in the target case according to the requirement of the test step, so as to execute each test step described in the test case one by one and obtain an output test result.
In order to facilitate the generation and subsequent use of the test step template, the method can also automatically convert the test steps meeting the conditions into the test step template according to the conditions, and the test step template exists in the test template set, so that a tester can call the test step template conveniently when other test cases are generated subsequently. Specifically, as shown in fig. 4, the method for automatically testing a WEB page use case may further include:
301. accumulating the total execution times of each test step;
302. respectively judging whether the total execution times of each test step exceed a preset threshold value, if so, executing step 303, and if not, not needing to be taken care of;
303. determining the test steps with the total execution times exceeding a preset threshold value as test step templates;
304. and adding the test step template into a preset test template set, wherein the test template set is used for calling the test step template to generate a test step for the test case when the test case is created.
With respect to step 301, it can be understood that the server accumulates the total execution times of each test step, the accumulation of the total execution times is not limited to be in one test case, and all test cases executed on the server may be counted, so that the total execution times of the test steps may reflect the usage degree of the test steps in all test cases. It can be known that the more the total number of execution times, the more frequently the test step is used in the test case.
For step 302, as can be seen from the above, the server may preset a preset threshold, which is used to define which test steps are used frequently enough to be used as a template. The setting of the preset threshold may be determined according to the actual usage, for example, may be set to 100 times. Therefore, the server may respectively determine whether the total number of times of executing the test steps exceeds a preset threshold, if so, execute step 303, and if not, do not need to be taken care of.
With respect to step 303, it is understood that when the total number of times of executing the test step exceeds the preset threshold, the test step may be considered to be frequently used enough to be used as a template, and therefore, the server may determine the test step as a test step template.
For step 304, after determining the testing steps whose total number of times of execution exceeds the preset threshold as the testing step template, the server may add the testing step template to a preset testing template set, where the testing template set is used to call the testing step template therein to generate the testing steps for the test cases when the test cases are created. It can be understood that when a tester creates a test case, a test step can be quickly generated by calling a test step template in a test template set, and the generation efficiency of the test case is improved.
104. Aiming at each target case, obtaining a test result obtained by executing each test step of each target case;
it can be understood that, for each target use case, after the respective testing steps in each target use case are executed one by one, the server may obtain a testing result obtained by executing the respective testing steps of the target use cases. In this embodiment, in a plurality of test steps in one target case, each test step may output one test result, or only one test result may be output after all the test steps of one target case are completely executed, which is specifically determined according to actual execution of the test steps, and this embodiment is not limited specifically.
105. And writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested.
Therefore, the server can write the test result corresponding to each target case into the test report to obtain the test report of the to-be-tested WEB page, so that a tester can look up the test report to know the specific situation of the to-be-tested WEB page in the current test.
In order to facilitate the tester to quickly know the test effect when reviewing the test report, the comparison result between the test result of each test step and the expected result may be written in the test report. In this embodiment, as shown in fig. 5, further, the method for automatically testing a WEB page use case may further include:
401. acquiring a preset expected result of one testing step each time after one testing step is finished;
402. comparing the preset expected result with the test result of the test step to obtain a comparison result;
403. if the comparison result is consistent, determining that the verification result of the test step is verification pass;
404. if the comparison result is inconsistent, determining that the verification result of the testing step is that the verification fails;
405. and writing the verification result into the test report.
For step 401, before starting the test, the tester may preset a desired result for each test step, so that the server may obtain the preset desired result for one test step each time after the server performs the test step. It should be noted that the tester responsible for generating the test case and the tester reviewing the test report may be different persons, so that it is interesting for the test task to preset the expected result, which not only can effectively improve the readability of the final test report, but also can assist the assistance and communication among different persons in the test project.
For step 402, after obtaining the test result of executing the test step and the expected result, the server may compare the preset expected result with the test result of the test step to obtain a comparison result.
For steps 403 and 404, it is understood that if the comparison result is consistent, the verification result of the one test step is determined to be passed, whereas if the comparison result is inconsistent, the verification result of the one test step is determined to be failed.
For step 405, after each verification result of a test step is obtained, the server may write the verification result into the test report. Specifically, the server may write the verification results into the test report one by one, or may write all the test results and the corresponding verification results into the test report at one time after all the target use cases are executed.
Further, in order to facilitate a tester to quickly locate a problem existing in a test process after a test, as shown in fig. 6, in this embodiment, the automatic test method for a WEB page use case may further include:
501. acquiring a current page screenshot and a page source code of the WEB page to be tested after executing a test step fails;
502. and recording a failure result of the test step which fails to be executed, the current page screenshot and the page source code into a preset failure log file.
For step 501, after executing a testing step fails, the server may obtain a current page screenshot and a page source code of the to-be-tested WEB page in order to record a reason for the failure of the testing step. It can be understood that the reason and the problem high probability of the failure of the test step can be embodied in the page source code and the page screenshot, so that the server acquires and records the current page screenshot and the page source code of the to-be-tested WEB page, and can effectively help a tester to perform error troubleshooting.
Preferably, after executing a test step fails, the server may accumulate the number of case failures plus 1, so that the server may count the number of failure times of each test case, but when the number of failure times of a certain test case is too high, for example, exceeds a preset value, the server reminds the tester to pay attention, so that the tester can check whether the configuration of the test case is normal.
For step 502, finally, the server may record the failure result of the test step that fails to be executed, the current page screenshot and the page source code into a preset failure log file, where the failure log file may be stored in the server or may be written into a test report together, and may be specifically set according to the actual use condition.
In the embodiment, firstly, each test case of a to-be-tested WEB page is obtained, wherein each test case comprises a test object, an operation and each test step; then, converting each test case into each target case in an XML format; executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file; then, aiming at each target case, obtaining a test result obtained by executing each test step of each target case; and finally, writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested. Therefore, the invention separately stores the page elements in the XML file for management, and the test case is separated from the XML file. By the design, the page elements of the WEB page to be tested can be acquired from the XML file through the test object to participate in the execution of the test step when needed, so that the test case can be conveniently executed, the test result and the test report can be generated, and when the page elements need to be newly added, modified and deleted, the XML file for storing the page elements and the mapping relation between the page elements and the test object only need to be adjusted, so that the maintenance cost of the case test is greatly reduced, and the portability and the test efficiency of the case test are improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an embodiment, an automatic test device for a WEB page use case is provided, and the automatic test device for the WEB page use case corresponds to the automatic test method for the WEB page use case in the above embodiment one to one. As shown in fig. 7, the automated testing apparatus for WEB page use cases includes a test use case obtaining module 601, a use case converting module 602, a testing step executing module 603, a testing result obtaining module 604, and a report writing module 605. The functional modules are explained in detail as follows:
the test case obtaining module 601 is configured to obtain each test case of a to-be-tested WEB page, where each test case includes a test object, an operation, and each test step;
a use case conversion module 602, configured to convert each test use case into each target use case in an XML format;
a test step executing module 603, configured to execute each test step in each target case one by one, where when each test step is executed, a test object of each target case is called, and a page element of the to-be-tested WEB page corresponding to the test object is involved in an operation of the test step, where the page element of the to-be-tested WEB page is stored in a preset XML file;
a test result obtaining module 604, configured to obtain, for each target case, a test result obtained by executing each test step of each target case;
a report writing module 605, configured to write the test result corresponding to each target case into a test report, so as to obtain the test report of the to-be-tested WEB page.
As shown in fig. 8, further, the correspondence between the test object and the page element may be preset by the following modules:
the page reading module 606 is configured to read the to-be-tested WEB page in the XML format;
the page element extraction module 607 is configured to extract each page element in the to-be-tested WEB page;
a control type determining module 608, configured to determine a page control type corresponding to each page element;
a keyword extraction module 609, configured to, for each page element, extract a keyword of each page element according to a page control type corresponding to each page element;
the correspondence relationship establishing module 610 is configured to establish, for each page element, a correspondence relationship between each page element and a matched test object, where the matched test object is a test object whose recorded test object information is consistent with a keyword of each page element.
As shown in fig. 9, further, the automatic testing apparatus for WEB page use case may further include:
an expected result obtaining module 611, configured to obtain a preset expected result of one test step each time after the test step is completed;
a result comparison module 612, configured to compare the preset expected result with the test result of the test step to obtain a comparison result;
a verification passing module 613, configured to determine that the verification result of the test step is a verification pass if the comparison result obtained by the result comparison module is consistent;
a fail module 614, configured to determine that the verification result of the test step is failed if the comparison result obtained by the result comparison module is inconsistent;
a result writing module 615, configured to write the verification result into the test report.
Further, the automatic testing apparatus for WEB page use cases may further include:
the screenshot module is used for acquiring a current page screenshot and a page source code of the WEB page to be tested after executing a test step fails;
and the log recording module is used for recording a failure result of the test step which fails to be executed, the current page screenshot and the page source code into a preset failure log file.
Further, the automatic testing apparatus for WEB page use cases may further include:
the total times accumulation module is used for accumulating the total times of execution of each test step;
the total number judging module is used for respectively judging whether the total number of execution times of each test step exceeds a preset threshold value;
the template determining module is used for determining the testing step with the total execution times exceeding a preset threshold as a testing step template if the judgment result of the total times judging module is positive;
and the template adding module is used for adding the testing step template into a preset testing template set, and the testing template set is used for calling the testing step template to generate a testing step for the testing case when the testing case is created.
For specific limitations of the automated testing apparatus for WEB page use cases, reference may be made to the above limitations of the automated testing method for WEB page use cases, which are not described herein again. All modules in the automatic testing device for the WEB page use case can be completely or partially realized through software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data related to the automatic test method of the WEB page use case. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to realize an automatic test method of WEB page use cases.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the steps of the automated testing method for WEB page use cases in the above embodiments, for example, steps 101 to 105 shown in fig. 2. Alternatively, the processor implements the functions of each module/unit of the automatic test apparatus for WEB page use cases in the above embodiments, for example, the functions of the modules 601 to 605 shown in fig. 7, when executing the computer program. To avoid repetition, further description is omitted here.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and the computer program is executed by a processor to implement the steps of the automated testing method for WEB page use cases in the above embodiments, such as steps 101 to 105 shown in fig. 2. Alternatively, the computer program, when executed by the processor, implements the functions of each module/unit of the automatic test apparatus for WEB page use cases in the above-described embodiments, for example, the functions of the modules 601 to 605 shown in fig. 7. To avoid repetition, further description is omitted here.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. An automatic test method for WEB page use cases is characterized by comprising the following steps:
obtaining each test case of a WEB page to be tested, wherein each test case comprises a test object, an operation and each test step;
converting each test case into each target case in an XML format;
executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file;
aiming at each target case, obtaining a test result obtained by executing each test step of each target case;
and writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested.
2. The automatic test method for the WEB page use case according to claim 1, wherein the correspondence between the test object and the page element is preset by the following steps:
reading the WEB page to be tested in an XML format;
extracting each page element in the WEB page to be tested;
determining the page control type corresponding to each page element;
aiming at each page element, extracting a keyword of each page element according to the page control type corresponding to each page element;
and aiming at each page element, establishing a corresponding relation between each page element and a matched test object, wherein the matched test object refers to a test object with recorded test object information consistent with the keyword of each page element.
3. The method for automatically testing a WEB page use case according to claim 1, wherein the method for automatically testing a WEB page use case further comprises:
acquiring a preset expected result of one testing step each time after one testing step is finished;
comparing the preset expected result with the test result of the test step to obtain a comparison result;
if the comparison result is consistent, determining that the verification result of the test step is verification pass;
if the comparison result is inconsistent, determining that the verification result of the testing step is that the verification fails;
and writing the verification result into the test report.
4. The method for automatically testing a WEB page use case according to claim 1, wherein the method for automatically testing a WEB page use case further comprises:
acquiring a current page screenshot and a page source code of the WEB page to be tested after executing a test step fails;
and recording a failure result of the test step which fails to be executed, the current page screenshot and the page source code into a preset failure log file.
5. The method for automatically testing the WEB page use case according to any one of claims 1 to 4, wherein the method for automatically testing the WEB page use case further comprises:
accumulating the total execution times of each test step;
respectively judging whether the total execution times of each test step exceeds a preset threshold value;
if the total execution times of the test steps exceed a preset threshold, determining the test steps with the total execution times exceeding the preset threshold as test step templates;
and adding the test step template into a preset test template set, wherein the test template set is used for calling the test step template to generate a test step for the test case when the test case is created.
6. An automatic test device for WEB page use cases is characterized by comprising:
the test case acquisition module is used for acquiring each test case of the WEB page to be tested, wherein each test case comprises a test object, an operation and each test step;
the case conversion module is used for converting each test case into each target case in an XML format;
the test step execution module is used for executing each test step in each target case one by one aiming at each target case, wherein when each test step is executed, a test object of each target case is called, so that page elements of the to-be-tested WEB page corresponding to the test object participate in the operation of the test step, and the page elements of the to-be-tested WEB page are stored in a preset XML file;
the test result acquisition module is used for acquiring a test result obtained by executing each test step of each target case aiming at each target case;
and the report writing module is used for writing the test result corresponding to each target case into a test report to obtain the test report of the WEB page to be tested.
7. The automatic test device for the WEB page use case according to claim 6, wherein the correspondence between the test object and the page element is preset by the following modules:
the page reading module is used for reading the WEB page to be tested in the XML format;
the page element extraction module is used for extracting each page element in the WEB page to be tested;
the control type determining module is used for determining the page control type corresponding to each page element;
the keyword extraction module is used for extracting keywords of each page element according to the page control type corresponding to each page element;
and the corresponding relation establishing module is used for establishing a corresponding relation between each page element and a matched test object aiming at each page element, wherein the matched test object refers to a test object with recorded test object information consistent with the key words of each page element.
8. The apparatus for automatically testing WEB page use cases according to claim 6 or 7, further comprising:
the expected result acquisition module is used for acquiring a preset expected result of one test step after the test step is executed;
the result comparison module is used for comparing the preset expected result with the test result of the test step to obtain a comparison result;
the verification passing module is used for determining that the verification result of the test step is verification passing if the comparison result obtained by the result comparison module is consistent;
the non-passing module is used for determining that the verification result of the test step is not passed if the comparison result obtained by the result comparison module is inconsistent;
and the result writing module is used for writing the verification result into the test report.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the automated testing method for the WEB page use case according to any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements a method for automated testing of a WEB page use case according to any of claims 1 to 5.
CN201910969484.3A 2019-10-12 2019-10-12 Automatic test method, device, equipment and storage medium for WEB page case Pending CN110941546A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910969484.3A CN110941546A (en) 2019-10-12 2019-10-12 Automatic test method, device, equipment and storage medium for WEB page case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910969484.3A CN110941546A (en) 2019-10-12 2019-10-12 Automatic test method, device, equipment and storage medium for WEB page case

Publications (1)

Publication Number Publication Date
CN110941546A true CN110941546A (en) 2020-03-31

Family

ID=69905907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910969484.3A Pending CN110941546A (en) 2019-10-12 2019-10-12 Automatic test method, device, equipment and storage medium for WEB page case

Country Status (1)

Country Link
CN (1) CN110941546A (en)

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625471A (en) * 2020-06-12 2020-09-04 北京灵汐科技有限公司 Execution processing and exception positioning method, device, equipment and medium of test case
CN111737135A (en) * 2020-06-24 2020-10-02 泰康保险集团股份有限公司 General test method, device, equipment and storage medium for trusted system
CN111966580A (en) * 2020-07-24 2020-11-20 厦门快商通科技股份有限公司 Automatic testing method, device, equipment and storage medium based on artificial intelligence
CN112015638A (en) * 2020-07-30 2020-12-01 西安雷风电子科技有限公司 Automatic testing method and system
CN112231229A (en) * 2020-11-09 2021-01-15 恩亿科(北京)数据科技有限公司 Web UI (user interface) automatic testing method and system, electronic equipment and readable storage medium
CN112256578A (en) * 2020-10-23 2021-01-22 恒生电子股份有限公司 Management method and management terminal of test case, electronic device and storage medium
CN112540916A (en) * 2020-11-30 2021-03-23 的卢技术有限公司 Automatic rerun method and device for failed case, computer equipment and storage medium
CN112579456A (en) * 2020-12-24 2021-03-30 安徽航天信息科技有限公司 Web automatic testing method and device
CN112905451A (en) * 2021-02-02 2021-06-04 北京罗克维尔斯科技有限公司 Automatic testing method and device for application program
CN112988590A (en) * 2021-04-01 2021-06-18 中车青岛四方机车车辆股份有限公司 Electromagnetic environment hybrid automatic testing method and system, storage medium and terminal equipment
CN112988585A (en) * 2021-03-23 2021-06-18 京东数科海益信息科技有限公司 PaaS platform test method, device, equipment and medium
CN113392030A (en) * 2021-07-30 2021-09-14 北京达佳互联信息技术有限公司 Method and device for testing Js bridge and related equipment
CN113448845A (en) * 2021-06-22 2021-09-28 重庆长安汽车股份有限公司 UI automation test method and system
CN113515462A (en) * 2021-08-24 2021-10-19 北京百度网讯科技有限公司 Method, device, equipment and storage medium for testing
CN113656304A (en) * 2021-08-16 2021-11-16 上海浦东发展银行股份有限公司 Method and device for testing front-end application program and storage medium
CN113806150A (en) * 2021-08-16 2021-12-17 济南浪潮数据技术有限公司 Method, system, equipment and storage medium for remote testing of storage server
CN113821437A (en) * 2021-09-23 2021-12-21 北京光启元数字科技有限公司 Page testing method, device, equipment and medium
CN114268569A (en) * 2020-09-16 2022-04-01 中盈优创资讯科技有限公司 Configurable network operation, maintenance, acceptance and test method and device
CN114968823A (en) * 2022-07-27 2022-08-30 国能日新科技股份有限公司 Automatic testing method, device, equipment and storage medium
WO2022237253A1 (en) * 2021-05-11 2022-11-17 华为云计算技术有限公司 Test case generation method, apparatus and device
CN115658463A (en) * 2022-09-09 2023-01-31 广州市盛通建设工程质量检测有限公司 Use case management method and device, computer equipment and storage medium
CN117112400A (en) * 2023-07-24 2023-11-24 东方通创新科技(重庆)有限公司 Automatic test case generation platform

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693183A (en) * 2012-05-30 2012-09-26 瑞斯康达科技发展股份有限公司 Method and system for realizing automatic software testing
CN102981958A (en) * 2012-12-19 2013-03-20 青岛海信传媒网络技术有限公司 Method and device for testing software
CN104156342A (en) * 2014-08-01 2014-11-19 福建星网视易信息系统有限公司 Method and device for converting Excel format testing case into XML (extensive markup language) format
CN108628748A (en) * 2018-05-09 2018-10-09 平安普惠企业管理有限公司 Automatic test management method and automatic test manage system
CN109828906A (en) * 2018-12-15 2019-05-31 中国平安人寿保险股份有限公司 UI automated testing method, device, electronic equipment and storage medium
CN109857652A (en) * 2019-01-16 2019-06-07 深圳壹账通智能科技有限公司 A kind of automated testing method of user interface, terminal device and medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693183A (en) * 2012-05-30 2012-09-26 瑞斯康达科技发展股份有限公司 Method and system for realizing automatic software testing
CN102981958A (en) * 2012-12-19 2013-03-20 青岛海信传媒网络技术有限公司 Method and device for testing software
CN104156342A (en) * 2014-08-01 2014-11-19 福建星网视易信息系统有限公司 Method and device for converting Excel format testing case into XML (extensive markup language) format
CN108628748A (en) * 2018-05-09 2018-10-09 平安普惠企业管理有限公司 Automatic test management method and automatic test manage system
CN109828906A (en) * 2018-12-15 2019-05-31 中国平安人寿保险股份有限公司 UI automated testing method, device, electronic equipment and storage medium
CN109857652A (en) * 2019-01-16 2019-06-07 深圳壹账通智能科技有限公司 A kind of automated testing method of user interface, terminal device and medium

Cited By (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625471A (en) * 2020-06-12 2020-09-04 北京灵汐科技有限公司 Execution processing and exception positioning method, device, equipment and medium of test case
CN111625471B (en) * 2020-06-12 2023-05-09 北京灵汐科技有限公司 Method, device, equipment and medium for executing and processing test cases and locating abnormality
CN111737135A (en) * 2020-06-24 2020-10-02 泰康保险集团股份有限公司 General test method, device, equipment and storage medium for trusted system
CN111966580A (en) * 2020-07-24 2020-11-20 厦门快商通科技股份有限公司 Automatic testing method, device, equipment and storage medium based on artificial intelligence
CN112015638A (en) * 2020-07-30 2020-12-01 西安雷风电子科技有限公司 Automatic testing method and system
CN114268569A (en) * 2020-09-16 2022-04-01 中盈优创资讯科技有限公司 Configurable network operation, maintenance, acceptance and test method and device
CN114268569B (en) * 2020-09-16 2023-10-31 中盈优创资讯科技有限公司 Configurable network operation and maintenance acceptance test method and device
CN112256578A (en) * 2020-10-23 2021-01-22 恒生电子股份有限公司 Management method and management terminal of test case, electronic device and storage medium
CN112256578B (en) * 2020-10-23 2024-01-19 恒生电子股份有限公司 Management method and system for test cases, electronic equipment and storage medium
CN112231229A (en) * 2020-11-09 2021-01-15 恩亿科(北京)数据科技有限公司 Web UI (user interface) automatic testing method and system, electronic equipment and readable storage medium
CN112540916A (en) * 2020-11-30 2021-03-23 的卢技术有限公司 Automatic rerun method and device for failed case, computer equipment and storage medium
CN112579456A (en) * 2020-12-24 2021-03-30 安徽航天信息科技有限公司 Web automatic testing method and device
CN112579456B (en) * 2020-12-24 2024-04-09 安徽航天信息科技有限公司 Web automatic testing method and device
CN112905451B (en) * 2021-02-02 2023-08-25 北京罗克维尔斯科技有限公司 Automatic testing method and device for application program
CN112905451A (en) * 2021-02-02 2021-06-04 北京罗克维尔斯科技有限公司 Automatic testing method and device for application program
CN112988585A (en) * 2021-03-23 2021-06-18 京东数科海益信息科技有限公司 PaaS platform test method, device, equipment and medium
CN112988585B (en) * 2021-03-23 2024-05-17 京东科技信息技术有限公司 PaaS platform testing method, paaS platform testing device, paaS platform testing equipment and PaaS platform testing medium
CN112988590A (en) * 2021-04-01 2021-06-18 中车青岛四方机车车辆股份有限公司 Electromagnetic environment hybrid automatic testing method and system, storage medium and terminal equipment
WO2022237253A1 (en) * 2021-05-11 2022-11-17 华为云计算技术有限公司 Test case generation method, apparatus and device
CN113448845A (en) * 2021-06-22 2021-09-28 重庆长安汽车股份有限公司 UI automation test method and system
CN113392030A (en) * 2021-07-30 2021-09-14 北京达佳互联信息技术有限公司 Method and device for testing Js bridge and related equipment
CN113392030B (en) * 2021-07-30 2023-10-24 北京达佳互联信息技术有限公司 Method and device for testing Js bridge and related equipment
CN113656304B (en) * 2021-08-16 2024-04-30 上海浦东发展银行股份有限公司 Testing method, device and storage medium of front-end application program
CN113806150B (en) * 2021-08-16 2024-02-13 济南浪潮数据技术有限公司 Method, system, equipment and storage medium for remote test of storage server
CN113806150A (en) * 2021-08-16 2021-12-17 济南浪潮数据技术有限公司 Method, system, equipment and storage medium for remote testing of storage server
CN113656304A (en) * 2021-08-16 2021-11-16 上海浦东发展银行股份有限公司 Method and device for testing front-end application program and storage medium
CN113515462A (en) * 2021-08-24 2021-10-19 北京百度网讯科技有限公司 Method, device, equipment and storage medium for testing
CN113821437A (en) * 2021-09-23 2021-12-21 北京光启元数字科技有限公司 Page testing method, device, equipment and medium
CN114968823A (en) * 2022-07-27 2022-08-30 国能日新科技股份有限公司 Automatic testing method, device, equipment and storage medium
CN115658463A (en) * 2022-09-09 2023-01-31 广州市盛通建设工程质量检测有限公司 Use case management method and device, computer equipment and storage medium
CN117112400A (en) * 2023-07-24 2023-11-24 东方通创新科技(重庆)有限公司 Automatic test case generation platform

Similar Documents

Publication Publication Date Title
CN110941546A (en) Automatic test method, device, equipment and storage medium for WEB page case
CN107992409B (en) Test case generation method and device, computer equipment and storage medium
WO2020000706A1 (en) Database comparison-based interface testing method and system, device and storage medium
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
CN112256558B (en) Test case generation method and device, computer equipment and storage medium
CN109710677B (en) Experiment data processing method and device, computer equipment and storage medium
CN108459962B (en) Code normalization detection method and device, terminal equipment and storage medium
CN109800258B (en) Data file deployment method, device, computer equipment and storage medium
CN108427613B (en) Abnormal interface positioning method and device, computer equipment and storage medium
CN110704304B (en) Application program testing method and device, storage medium and server
US20160283357A1 (en) Call stack relationship acquiring method and apparatus
CN112148509A (en) Data processing method, device, server and computer readable storage medium
CN108628748B (en) Automatic test management method and automatic test management system
CN110109897A (en) Database script generation method, device, computer equipment and storage medium
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
CN110647471B (en) Interface test case generation method, electronic device and storage medium
CN109445837B (en) Application program publishing method and device
CN110737594B (en) Database standard conformance testing method and device for automatically generating test cases
WO2020232883A1 (en) Script defect scanning method and apparatus, computer device and storage medium
CN113282513B (en) Interface test case generation method and device, computer equipment and storage medium
CN108446224B (en) Performance analysis method of application program on mobile terminal and storage medium
CN114168190A (en) Interface document generation method and device, computer equipment and storage medium
CN112306533A (en) Front-end framework automatic conversion method and device, computer equipment and storage medium
CN111767213B (en) Database check point testing method and device, electronic equipment and storage medium
CN117493188A (en) Interface testing method and device, electronic 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