Disclosure of Invention
In view of this, the embodiment of the application provides a regression testing method and device for a software-as-a-service platform and an electronic device, which can improve the testing efficiency and avoid missing test items.
A first aspect of the embodiment of the present application provides a regression testing method for a software as a service platform, including:
acquiring a test instruction for testing software, namely a service platform, wherein the test instruction comprises a page identifier;
opening a page corresponding to the page identifier;
Generating an operation instruction corresponding to the page;
And sequentially triggering tabs and/or links on the page according to the operation instruction to obtain a first execution result of the page based on the operation instruction, wherein the first execution result is used for judging whether the page is abnormal or not.
In one possible implementation manner, after the obtaining the first execution result of the page based on the operation instruction, the method further includes:
and if the operation failure information exists in the first execution result, performing screenshot operation on the page.
In one possible implementation manner, before the sequentially triggering the tabs and/or links on the page according to the operation instruction, the method further includes:
and positioning the tab and/or the link according to a preset attribute identifier.
In one possible implementation, the method further includes:
Acquiring test data corresponding to the page;
inputting the test data into an input box and/or a selection box on the page;
And triggering a confirmation control corresponding to the input box and/or the selection box to obtain a second execution result of the page based on the test data, wherein the second execution result is used for judging whether the page has an abnormality or not.
In one possible implementation manner, after the obtaining the second execution result of the page based on the test data, the method further includes:
and generating a test report according to the first execution result and/or the second execution result.
In a possible implementation manner, the test instruction further includes address information, and before the opening of the page corresponding to the page identifier, the method further includes:
And logging in the cloud platform according to the address information.
In one possible implementation manner, the logging on the cloud platform according to the address information includes:
If the software deployed on the cloud platform is detected, namely the information that the service platform finishes upgrading, logging in the cloud platform according to the address information.
A second aspect of the embodiment of the present application provides a regression testing apparatus for a software-as-a-service platform, including:
The acquisition module is used for acquiring a test instruction for testing the software serving as a service platform, wherein the test instruction comprises a page identifier;
the opening module is used for opening the page corresponding to the page identifier;
The generation module is used for generating an operation instruction corresponding to the page;
the test module is used for triggering the tabs and/or links on the page in sequence according to the operation instruction to obtain a first execution result of the page based on the operation instruction, wherein the first execution result is used for judging whether the page is abnormal or not.
A third aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements a regression testing method of the software as a service platform according to the first aspect.
A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program, which when executed by a processor implements a regression testing method of the software as a service platform according to the first aspect.
A fifth aspect of an embodiment of the application provides a computer program product for, when run on a terminal device, causing the terminal device to perform the method of any of the first aspects described above.
Compared with the prior art, the embodiment of the application has the beneficial effects that: the method comprises the steps of obtaining a test instruction for testing software, namely a service platform, opening a page corresponding to a page identifier in the test instruction, generating an operation instruction corresponding to the page, and sequentially triggering a tab and/or a link on the page according to the operation instruction to obtain a first execution result of the page based on the operation instruction, so that the tab and the link can be prevented, the test coverage is improved, and missing of test items is prevented. After the first execution result is obtained, whether the page is abnormal or not can be judged according to the first execution result, so that the automatic test of the software serving as a platform is realized, and the test efficiency is improved.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to illustrate the technical scheme of the application, the following description is made by specific examples.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
In addition, in the description of the present application, the terms "first," "second," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
In order to solve the problems that the efficiency is lower and test items are easy to miss when the regression test of the SaaS platform is manually performed, the application provides a regression test method of a software-as-a-service platform. After the first execution result is obtained, whether the page is abnormal or not can be judged according to the first execution result, so that the automatic test of the software serving as a platform is realized, and the test efficiency is improved.
The regression testing method of the software service platform provided by the application is exemplified below.
Referring to fig. 1, a regression testing method for a software as a service platform according to an embodiment of the present application includes:
s101: and acquiring a test instruction for testing the software serving as a platform, wherein the test instruction comprises a page identifier.
The regression testing method of the software serving as the service platform provided by the embodiment of the application is applied to electronic equipment, and the electronic equipment can be a desktop computer, a notebook computer, a palm computer and the like.
The test instruction can be input by a user, or can be generated after the electronic equipment detects that the SaaS platform finishes upgrading information. The page identity is the address to which the page corresponds or the name of the page.
In an embodiment, the SaaS platform is deployed on the cloud platform, the test instruction further includes address information, the electronic device logs in the cloud platform according to the address information to test the SaaS platform, so that script debugging and test environment debugging can be completed locally, and then the electronic device logs in the cloud platform to test, and the debugging and test efficiency is improved.
In an embodiment, when the electronic device detects that the SaaS platform deployed on the cloud platform completes the updated information, the electronic device logs in the cloud platform according to the address information, and carries out regression testing on the SaaS platform in time.
S102: and opening the page corresponding to the page identifier.
Specifically, the electronic device invokes and runs a test script corresponding to the page identifier, and opens a corresponding page when the test script runs. The test scripts comprise login scripts, homepage scripts, role management scripts, account management scripts, user center scripts, basic data scripts, professional management scripts and industry management scripts, and pages corresponding to the test scripts are login pages, homepage pages, role management pages, account management pages, user center pages, name management pages, professional management pages and industry management pages respectively.
In an embodiment, the electronic device determines a test sequence according to a preset test frame, determines a page identifier of a page to be tested currently according to the test sequence after acquiring the test instruction, calls a corresponding test script according to the page identifier, and opens a page corresponding to the page identifier.
S103: and generating an operation instruction corresponding to the page.
The page comprises at least one tab or link, and the test script generates an operation instruction in the running process, wherein the operation instruction comprises an instruction for triggering the tab or link and a triggering sequence. For example, on a home page, the operation instructions include triggering a home tab, triggering each tab in the list of home tabs in turn, and so on.
S104: and sequentially triggering tabs and/or links on the page according to the operation instruction to obtain a first execution result of the page based on the operation instruction, wherein the first execution result is used for judging whether the page is abnormal or not.
In the running process of the test script, the address of the tab or the link can be input to trigger the corresponding tab or the link, or a clicking instruction can be generated to execute the clicking instruction to click the corresponding tab or the link to trigger. The first execution result may be a page displayed after the tab or the link is triggered, or may be operation information of the page after the tab or the link is triggered.
In an embodiment, if the page displayed after clicking the tab or linking is inconsistent with the preset page, it is indicated that the page is abnormal. In another embodiment, if the first execution result does not have the operation failure information, it is indicated that the page is not abnormal, and if the first execution result has the operation failure information, it is indicated that the page is abnormal. When the page is abnormal, the screenshot operation can be performed on the currently displayed page, the screenshot is saved, and the running information and the page corresponding to the running information can be recorded, so that the user can find the abnormal information.
In an embodiment, after clicking one of the tabs or links, the error reporting information occurs, and then the script corresponding to the page is recalled to retest the current page, or only retest the tab. If the number of times of continuously generating the error reporting information reaches the preset number of times, for example, three times, the current operation fails to run, so that the error reporting information is verified, and the error testing result is prevented from being obtained. After the operation failure information is detected, the operation failure information is recorded, and the next tab or the next page is continuously tested.
In an embodiment, the page further has an input frame and/or a selection frame, the electronic device calls the test data script, obtains test data corresponding to each input frame or selection frame according to basic input data, inputs the test data into the input frame and/or the selection frame on the page, and triggers a confirmation control corresponding to the input frame and/or the selection frame, so that a second execution result of the page based on the test data is obtained, coverage of page elements is improved, and test accuracy is further improved. The test data may be a user name, a password, a new account number, a new name, etc., and the test data may be correct data or incorrect data. The second execution result may be a page displayed after the confirmation control is triggered, or may be operation information after the confirmation control is triggered. For example, an account is input into an account input box on a login page, a password is input into the password input box, a corresponding confirmation control is clicked, if the confirmation control is clicked, the login page is displayed to be logged in, the explanation page is normal, and if the login page is displayed to be logged in incorrectly, the explanation page is abnormal.
In one embodiment, before triggering the tab, link, and confirm control, the positioning script of the interface element needs to be invoked to position each tab, link, input box, and selection box on the page. The positioning script of the interface element can acquire the position of each tab, link, input frame and selection frame by intercepting the image of the page and then carrying out image recognition on the image of the page. The positioning script of the interface element can also be positioned through the attribute identifiers of each tab, link, input box and selection box, the attribute identifiers can be names corresponding to the tabs, links, input boxes or selection boxes, and the test items can be prevented from being missed through the attribute identifier positioning method.
After the first execution result and/or the second execution result are obtained, the electronic equipment records the first execution result and/or the second execution result for the user to check. In an embodiment, the electronic device invokes a script that generates a report, and generates a test report according to the recorded first execution result and/or second execution result. For example, if no operation failure information exists in the first execution result and the second execution result, the generated test report prompts the test to pass. If the first execution result or the second execution result has the operation failure information, the generated test report prompts that the test fails, and outputs a page corresponding to the operation failure information, or outputs a tab, a link, an input box or a selection box corresponding to the operation failure information.
In the above embodiment, by acquiring the test instruction for testing the software, i.e., the service platform, opening the page corresponding to the page identifier in the test instruction, generating the operation instruction corresponding to the page, and sequentially triggering the tab and/or the link on the page according to the operation instruction, to obtain the first execution result of the page based on the operation instruction, thereby preventing the tab and the link, improving the test coverage, and preventing missing the test item. After the first execution result is obtained, whether the page is abnormal or not can be judged according to the first execution result, so that the automatic test of the software serving as a platform is realized, and the test efficiency is improved.
The test method of the SaaS platform provided by the embodiment of the application is described below with reference to a specific scene. Firstly, a login script is operated to open a browser on the electronic equipment, an address management script is called to input an access address in the browser, and the access address is the address of the SaaS platform. Firstly, the page which enters is a login page, in the login page, a user name input box and a password input box are searched by calling a positioning script of an interface element, test data is obtained by calling a test data script, and the user name input box and the password input box corresponding to the test data are input to complete the input of the user name and the password. After the input is completed, searching a confirmation control through the interface element positioning script, clicking the confirmation control, and completing the login.
After the test of the login page is completed, the homepage script is operated to open the homepage, and the tab on the homepage is searched and clicked on the homepage through the positioning script of the interface element. The homepage displays a background management system catalog which comprises all and two collected tabs, searches the collected tabs through a script positioned by an interface element and clicks, and completes the collection operation. And then returning to the background management system target, clicking the collected page, entering the collected page, clicking to cancel collection, and completing the collection canceling operation. After the collection is canceled, returning to the homepage again, searching the superpipe background system through the script positioned by the interface element, clicking the checking tab, and finishing the checking operation.
After the test of the homepage is completed, the character management script is operated to open the character management page, and the newly added link is searched and clicked through the interface element positioning script on the character management page to enter the newly added character window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish the new operation. Returning to the character management page again, searching the modification link through the interface element positioning script, clicking, and entering the modification character window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish modification operation. And then returning to the role management interface, searching and checking the link through the interface element positioning script, clicking, opening the checking window and finishing the checking operation. And closing the viewing window, returning to the role management interface, searching the deletion link through the interface element positioning script, clicking, and completing the deletion operation.
After the role management page is tested, the account management script is operated to open the account management page, and the newly added link is searched and clicked through the interface element positioning script on the account management page to enter the newly added account window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish the new operation. Returning to the account management page again, searching the modification link through the interface element positioning script, clicking, and entering the modification account window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish modification operation. And then returning to the account management interface, searching and checking the link through the interface element positioning script, clicking, opening the checking window and finishing the checking operation. And closing the viewing window, returning to the account management interface, searching the deletion link through the interface element positioning script, clicking, and completing the deletion operation.
After the account management page is tested, a user center script is operated to open the user center page, and the user center page is searched for a checking link through an interface element positioning script and clicked, and a checking window is opened to finish checking operation. And closing the viewing window, returning to the user center page, searching the export link, clicking, and completing the export operation.
After the testing of the user center page is completed, a basic data script is operated, a school/company name management page is opened first, a newly added link is searched through an interface element positioning script and clicked, and a newly added school/company window is entered. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish the new operation. Returning to the school/company name management page again, searching the modification link through the interface element positioning script, clicking, and entering a modification school/company window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish modification operation. And then returning to the school/company name management interface, searching for a viewing link through the interface element positioning script, clicking, opening a viewing window, and completing the viewing operation.
After the test of the school/company name management page is completed, opening the professional management page, searching the newly added link through the interface element positioning script, clicking, and entering the newly added professional window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish the new operation. Returning to the professional management page again, searching the modification link through the interface element positioning script, clicking, and entering the modification professional window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish modification operation. And then returning to the professional management interface, searching and checking the link through the interface element positioning script, clicking, opening the checking window and finishing the checking operation.
After the test of the professional management page is completed, opening the industry management page, searching the newly added link through the interface element positioning script, clicking, and entering the newly added industry window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish the new operation. Returning to the industry management page again, searching the modification link through the interface element positioning script, clicking, and entering the modification industry window. And searching all input boxes and selection boxes on the page through the interface element positioning script, respectively inputting corresponding test data and clicking corresponding confirmation controls to finish modification operation. And returning to the industry management interface, searching and checking the link through the interface element positioning script, clicking, opening the checking window and finishing the checking operation.
And in the testing process of the page, if the operation failure information appears, calling a log file script to record the operation failure information, and carrying out screenshot on the page corresponding to the operation failure information, and storing the screenshot to obtain a picture. And if the running failure information does not appear, calling a report script to generate a test report, and outputting prompt information that the test passes.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
Corresponding to the regression testing method of the software as a service platform described in the above embodiment, fig. 2 shows a block diagram of the regression testing device of the software as a service platform provided in the embodiment of the present application, and for convenience of explanation, only the portion relevant to the embodiment of the present application is shown.
As shown in fig. 2, the regression testing apparatus of the software as a service platform includes,
The acquiring module 10 is configured to acquire a test instruction for testing the software serving as a service platform, where the test instruction includes a page identifier;
an opening module 20, configured to open a page corresponding to the page identifier;
a generating module 30, configured to generate an operation instruction corresponding to the page;
The test module 40 is configured to trigger tabs and/or links on the page in sequence according to the operation instruction, so as to obtain a first execution result of the page based on the operation instruction, where the first execution result is used to determine whether the page has an exception.
In one possible implementation, the test module 40 is further configured to:
and if the operation failure information exists in the first execution result, performing screenshot operation on the page.
In one possible implementation, the test module 40 is further configured to:
and positioning the tab and/or the link according to a preset attribute identifier.
In one possible implementation, the obtaining module 10 is further configured to:
Acquiring test data corresponding to the page;
inputting the test data into an input box and/or a selection box on the page;
And triggering a confirmation control corresponding to the input box and/or the selection box to obtain a second execution result of the page based on the test data, wherein the second execution result is used for judging whether the page has an abnormality or not.
In one possible implementation, the test module 40 is further configured to:
and generating a test report according to the first execution result and/or the second execution result.
In one possible implementation, the obtaining module 10 is further configured to: and logging in the cloud platform according to the address information.
In one possible implementation, the obtaining module 10 is further configured to:
If the software deployed on the cloud platform is detected, namely the information that the service platform finishes upgrading, logging in the cloud platform according to the address information.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 3, the electronic device of this embodiment includes: a processor 11, a memory 12, and a computer program 13 stored in the memory 12 and executable on the processor 11. The processor 11, when executing the computer program 13, implements the steps in the above-described control method embodiment of the electronic device, such as steps S101 to S104 shown in fig. 1. Or the processor 11 may perform the functions of the modules/units of the device embodiments described above, such as the acquisition module 10 to the test module 40 shown in fig. 2, when executing the computer program 13.
Illustratively, the computer program 13 may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 11 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions for describing the execution of the computer program 13 in the terminal device.
It will be appreciated by those skilled in the art that fig. 3 is merely an example of an electronic device and is not meant to be limiting, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the electronic device may further include an input-output device, a network access device, a bus, etc.
The Processor 11 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 12 may be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The memory 12 may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the electronic device. Further, the memory 12 may also include both internal storage units and external storage devices of the electronic device. The memory 12 is used for storing the computer program as well as other programs and data required by the electronic device. The memory 12 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.