Page testing method, device, equipment and storage medium
1. A page testing method is characterized by comprising the following steps:
responding to a target test operation aiming at a target page, and acquiring test verification information corresponding to the target test operation; the test verification information comprises a verification type identifier and a page identifier of the target page;
determining a verification class corresponding to the verification type identifier in a preset verification class set; the verification method is used for testing and verifying, and the verification method and the page identifier have a corresponding relation;
and in the verification class, calling a verification method corresponding to the page identification of the target page, and verifying an operation result corresponding to the target test operation.
2. The method according to claim 1, wherein the page identifier belongs to an input parameter of a verification method having a corresponding relationship with the page identifier, and the invoking the verification method corresponding to the page identifier of the target page in the verification class to verify the operation result corresponding to the target test operation comprises:
determining a verification method to which the input parameter matched with the page identifier of the target page belongs from the verification class based on the input parameter dimension of the verification method, and taking the determined verification method as the target verification method;
and calling the target verification method to verify the operation result corresponding to the target test operation.
3. The method according to claim 1, wherein before determining the authentication class corresponding to the authentication type identifier in the preset authentication class set, the method further comprises:
acquiring the verification type identifier and the page identifier of the target page from the test verification information;
transmitting the verification type identifier and the page identifier of the target page to a verification method caller; wherein the verification method invoker is configured to determine a verification method based on the verification type identifier and the page identifier;
correspondingly, the determining, in the preset verification class set, a verification class corresponding to the verification type identifier, calling, in the verification class, a verification method corresponding to the page identifier of the target page, and verifying the operation result corresponding to the target test operation includes:
determining a verification class corresponding to the verification type identifier from a preset verification class set by using the verification method caller as a target verification class;
and determining a verification method corresponding to the page identifier of the target page from the target verification class by using the verification method invoker, and invoking the verification method to verify an operation result corresponding to the target test operation.
4. The method according to claim 2 or 3, wherein the verification class comprises a common verification method, and the common verification method is determined based on the same verification logic in each verification method in the verification class;
in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation, wherein the verification method comprises the following steps:
and in the verification class, calling a verification method corresponding to the page identifier of the target page and the common verification method, and verifying an operation result corresponding to the target test operation.
5. The method of claim 1, further comprising:
receiving a modification request for a target verification method; wherein, the modification request carries an authentication type identifier and a page identifier;
determining a verification class corresponding to the verification type identifier in the preset verification class set, and determining a verification method corresponding to the page identifier in the verification class as the target verification method;
receiving a modification operation for the target verification method.
6. A page testing apparatus, characterized in that the apparatus comprises:
the first acquisition module is used for responding to target test operation aiming at a target page and acquiring test verification information corresponding to the target test operation; the test verification information comprises a verification type identifier and a page identifier of the target page;
the first determining module is used for determining a verification class corresponding to the verification type identifier in a preset verification class set; the verification method is used for testing and verifying, and the verification method and the page identifier have a corresponding relation;
and the calling module is used for calling a verification method corresponding to the page identifier of the target page in the verification class and verifying the operation result corresponding to the target test operation.
7. The apparatus according to claim 6, wherein the page identifier belongs to an input parameter of a verification method having a corresponding relationship with the page identifier, and the calling module comprises:
the determining submodule is used for determining a verification method to which the input parameter matched with the page identifier of the target page belongs from the verification class based on the dimension of the input parameter of the verification method, and taking the determined verification method as the target verification method;
and the calling submodule is used for calling the target verification method and verifying the operation result corresponding to the target test operation.
8. A computer-readable storage medium having stored therein instructions which, when run on a terminal device, cause the terminal device to implement the method of any one of claims 1-5.
9. An apparatus, comprising: memory, a processor, and a computer program stored on the memory and executable on the processor, when executing the computer program, implementing the method of any of claims 1-5.
10. A computer program product, characterized in that the computer program product comprises a computer program/instructions which, when executed by a processor, implements the method according to any of claims 1-5.
Background
In the Page test, a Page Object (PO) contains static elements and Page behaviors in a Page, wherein the static elements refer to controls and the like on the Page, and the Page behaviors define operations which can be triggered by a user on the current Page.
At present, in a page testing method, a test stream and a result verification logic are tightly coupled, and specifically, an assertion for implementing result verification is usually written at a corresponding page behavior in the test stream to verify an operation result corresponding to the page behavior. For example, an assertion used to implement login verification is typically written after a login operation in a test stream to verify the user's login information.
However, since the test flow and the result verification logic are tightly coupled in the page test method, once the result verification logic (such as the login verification logic) is changed, the code of the page test method has to be adjusted, and the code maintenance cost is high.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the present disclosure provides a page testing method, apparatus, device and storage medium.
In a first aspect, the present disclosure provides a page testing method, where the method includes:
responding to a target test operation aiming at a target page, and acquiring test verification information corresponding to the target test operation; the test verification information comprises a verification type identifier and a page identifier of the target page;
determining a verification class corresponding to the verification type identifier in a preset verification class set; the verification method is used for testing and verifying, and the verification method and the page identifier have a corresponding relation;
and in the verification class, calling a verification method corresponding to the page identification of the target page, and verifying an operation result corresponding to the target test operation.
In an optional implementation manner, the step of calling, in the verification class, the verification method corresponding to the page identifier of the target page to verify the operation result corresponding to the target test operation includes:
determining a verification method to which the input parameter matched with the page identifier of the target page belongs from the verification class based on the input parameter dimension of the verification method, and taking the determined verification method as the target verification method;
and calling the target verification method to verify the operation result corresponding to the target test operation.
In an optional implementation manner, before determining, in the preset verification class set, the verification class corresponding to the verification type identifier, the method further includes:
acquiring the verification type identifier and the page identifier of the target page from the test verification information;
transmitting the verification type identifier and the page identifier of the target page to a verification method caller; wherein the verification method invoker is configured to determine a verification method based on the verification type identifier and the page identifier;
correspondingly, the determining, in the preset verification class set, a verification class corresponding to the verification type identifier, calling, in the verification class, a verification method corresponding to the page identifier of the target page, and verifying the operation result corresponding to the target test operation includes:
determining a verification class corresponding to the verification type identifier from a preset verification class set by using the verification method caller as a target verification class;
and determining a verification method corresponding to the page identifier of the target page from the target verification class by using the verification method invoker, and invoking the verification method to verify an operation result corresponding to the target test operation.
In an optional embodiment, the verification class includes a common verification method, and the common verification method is determined based on the same verification logic in each verification method in the verification class;
in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation, wherein the verification method comprises the following steps:
and in the verification class, calling a verification method corresponding to the page identifier of the target page and the common verification method, and verifying an operation result corresponding to the target test operation.
In an optional embodiment, the method further comprises:
receiving a modification request for a target verification method; wherein, the modification request carries an authentication type identifier and a page identifier;
determining a verification class corresponding to the verification type identifier in the preset verification class set, and determining a verification method corresponding to the page identifier in the verification class as the target verification method;
receiving a modification operation for the target verification method.
In a second aspect, the present disclosure provides a page testing apparatus, the apparatus comprising:
the first acquisition module is used for responding to target test operation aiming at a target page and acquiring test verification information corresponding to the target test operation; the test verification information comprises a verification type identifier and a page identifier of the target page;
the first determining module is used for determining a verification class corresponding to the verification type identifier in a preset verification class set; the verification method is used for testing and verifying, and the verification method and the page identifier have a corresponding relation;
and the calling module is used for calling a verification method corresponding to the page identifier of the target page in the verification class and verifying the operation result corresponding to the target test operation.
In an optional implementation manner, the page identifier belongs to an input parameter of a verification method having a corresponding relationship with the page identifier, and the invoking module includes:
the determining submodule is used for determining a verification method to which the input parameter matched with the page identifier of the target page belongs from the verification class based on the dimension of the input parameter of the verification method, and taking the determined verification method as the target verification method;
and the calling submodule is used for calling the target verification method and verifying the operation result corresponding to the target test operation.
In a third aspect, the present disclosure provides a computer-readable storage medium having stored therein instructions that, when run on a terminal device, cause the terminal device to implement the above-mentioned method.
In a fourth aspect, the present disclosure provides an apparatus comprising: the system comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the method.
In a fifth aspect, the present disclosure provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the method described above.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the embodiment of the disclosure provides a page testing method, which responds to a target testing operation aiming at a target page and acquires testing verification information corresponding to the target testing operation. The test verification information comprises a verification type identifier and a page identifier of the target page. Then, in a preset verification class set, determining a verification class corresponding to the verification type identifier, wherein the verification class comprises a verification method for testing verification, and the verification method has a corresponding relation with the page identifier. And then, in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation. According to the page testing method and device, the page testing is achieved based on the verification method in the preset verification class set, the testing flow is decoupled from the verification method, even if the verification logic changes, only the verification method in the preset verification class set needs to be adjusted, the code of the page testing method does not need to be adjusted, and the code maintenance cost is reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic diagram of a test flow of a login process according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a test flow of another login procedure provided in the embodiment of the present disclosure;
fig. 3 is a flowchart of a page testing method provided by the embodiment of the present disclosure;
FIG. 4 is a flowchart of another page testing method provided by the embodiments of the present disclosure;
fig. 5 is a schematic diagram of an execution process of a page testing method according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram illustrating an execution process of another page testing method according to the embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a page testing apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a page testing device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
In the field of application testing, a page object is considered as an atom, and contains static elements in a page and page behaviors, wherein the page behaviors define operations which can be triggered by a user in a current page, such as an operation of clicking a certain control and the like, and the operations are encapsulated in the page behaviors and can be repeatedly triggered.
The Test Case (Test Case) is a scientific organization and induction for the behavior activity of the software Test, and aims to convert the behavior of the software Test into a manageable mode.
In practical application, before performing page testing, test cases are written based on testing requirements. Specifically, in a test case, each test flow in the page test generally includes a plurality of page behaviors, as shown in fig. 1, which is a schematic diagram of a test flow of a login flow provided by the embodiment of the present disclosure. After triggering the page behavior of 'inputting an account', executing corresponding assertion verification, then triggering and executing the page behavior of 'inputting a password', correspondingly executing corresponding assertion verification, further triggering and executing the page behavior of 'clicking login', and similarly executing corresponding assertion verification. It can be seen that the current test flow is tightly coupled with the result verification logic (i.e., assertion verification), and once the result verification logic changes, the test case needs to be adjusted, which results in higher code maintenance cost.
Therefore, the disclosure provides a page testing method, which responds to a target testing operation for a target page and acquires testing verification information corresponding to the target testing operation. The test verification information comprises a verification type identifier and a page identifier of the target page. Then, in a preset verification class set, determining a verification class corresponding to the verification type identifier, wherein the verification class comprises a verification method for testing verification, and the verification method has a corresponding relation with the page identifier. And then, in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation.
According to the page testing method and device, the page testing is achieved based on the verification method in the preset verification class set, the testing flow is decoupled from the verification method, even if the verification logic changes, only the verification method in the preset verification class set needs to be adjusted, the code of the page testing method does not need to be adjusted, and the code maintenance cost is reduced.
Compared with the test flow of the login flow shown in fig. 1, the present disclosure provides another schematic diagram of the test flow of the login flow, referring to fig. 2, where the test flow includes page behaviors of "input account", "input password", and "click login", and the result verification logic (i.e., assertion verification) corresponding to each page behavior is decoupled from the test flow, even if the result verification logic changes, it only needs to adjust the code of the result verification logic, and it is not necessary to adjust the code of the test flow, thereby reducing the code maintenance cost.
Based on this, the embodiment of the present disclosure provides a page testing method, and referring to fig. 3, it is a flowchart of the page testing method provided in the embodiment of the present disclosure, and the method includes:
s301: and responding to the target test operation aiming at the target page, and acquiring test verification information corresponding to the target test operation.
The test verification information comprises a verification type identifier and a page identifier of the target page.
In the embodiment of the disclosure, the target page may be any page in the application program to be tested, and the target page includes a page behavior, and the page behavior is used to define an operation that can be triggered by a user on the target page. The target test operation in the embodiment of the present disclosure is an operation that can be triggered on a target page for a user, for example, the target test operation may be the "enter account" operation in fig. 1 described above.
In the embodiment of the disclosure, before testing the application program to be tested, the test case is written in advance. In the writing stage of the test case, a verification type identifier is set for the target test operation of the target page in advance. The verification type identifier is used to characterize a verification type to which a verification method corresponding to the target test operation belongs, for example, the verification type may include a popup verification type, and the verification method belonging to the popup verification type is used to verify the popup.
In practical application, when a test flow in a test case is executed to a target test operation for a target page, test verification information corresponding to the target test operation can be obtained in response to the target test operation for the target page, where the test verification information includes a verification type identifier and a page identifier of the target page. And the verification type identifier and the page identifier are used for jointly determining a verification method corresponding to the target test operation.
S302: and determining the verification class corresponding to the verification type identifier in a preset verification class set.
The verification class comprises a verification method for testing verification, and the verification method and the page identification have a corresponding relation.
The preset verification class set in the embodiment of the present disclosure includes a plurality of verification classes, each verification class has a corresponding verification type identifier, and each verification class includes a plurality of verification methods.
In the writing stage of the test case, the verification methods are classified according to the verification types to which the verification methods belong, different types of verification methods are packaged in different verification classes, and each verification class is provided with a corresponding verification type identifier.
In practical application, when a test flow in a test case is executed to a target test operation for a target page, a verification type identifier corresponding to the target test operation and a page identifier of the target page may be first obtained, and then a verification class corresponding to the verification type identifier is determined in a preset verification class set. And the verification class is encapsulated with a verification method corresponding to the target test operation.
S303: and in the verification class, calling a verification method corresponding to the page identification of the target page, and verifying an operation result corresponding to the target test operation.
In the embodiment of the disclosure, after the verification class corresponding to the verification type identifier is determined, a verification method corresponding to the target test operation is called based on the page identifier of the target page in the test verification information, and the operation result corresponding to the target test operation is verified. Specifically, the verification method in the verification class has a corresponding relationship with the page identifier.
For example, assuming that the target test operation is a "click to login" operation, the verification method corresponding to the "click to login" operation may include determining whether a "home page" is displayed on the page, and if it is determined that the "home page" is displayed on the page, it indicates that the verification is passed, otherwise, it indicates that the verification is not passed.
In an optional implementation manner, the input parameter of the verification method is a page identifier, and specifically, in the stage of writing the test case, the input parameter is set for each verification method based on the page identifier, so as to determine the verification object of each verification method. That is, each verification method is used to test a page of its own input parameters.
In the embodiment of the disclosure, first, a verification method to which an input parameter matching with a page identifier of a target page belongs is determined from a verification class based on an input parameter dimension of the verification method, and the determined verification method is used as a target verification method. And then, calling the target verification method to verify an operation result corresponding to the target test operation.
In an optional implementation manner, since the verification method is stored in the verification class in the preset verification class set, once the verification method needs to be adjusted, only the verification class in the preset verification class set may be adjusted without adjusting the code of the test stream, thereby achieving decoupling of the test stream and the result verification logic.
Specifically, first, a modification request for a target verification method is received; wherein, the modification request carries the verification type identification and the page identification. Then, in the preset verification class set, a verification class corresponding to the verification type identifier is determined, and in the verification class, a verification method corresponding to the page identifier is determined as the target verification method. And receiving modification operation aiming at the target verification method, and realizing logic update of the target verification method in a preset verification class set. In the page testing method provided by the embodiment of the present disclosure, in response to a target testing operation for a target page, test verification information corresponding to the target testing operation is obtained. The test verification information comprises a verification type identifier and a page identifier of the target page. Then, in a preset verification class set, determining a verification class corresponding to the verification type identifier, wherein the verification class comprises a verification method for testing verification, and the verification method has a corresponding relation with the page identifier. And then, in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation. According to the page testing method and device, the page testing is achieved based on the verification method in the preset verification class set, the testing flow is decoupled from the verification method, even if the verification logic changes, only the verification method in the preset verification class set needs to be adjusted, the code of the page testing method does not need to be adjusted, and the code maintenance cost is reduced.
On the basis of the above embodiments, the embodiments of the present disclosure further provide an embodiment of a page testing method, and refer to fig. 4, which is a flowchart of another page testing method provided in the embodiments of the present disclosure. The method comprises the following steps:
s401: and responding to the target test operation aiming at the target page, and acquiring test verification information corresponding to the target test operation.
The test verification information comprises a verification type identifier and a page identifier of the target page.
S402: and acquiring the verification type identification and the page identification of the target page from the test verification information.
S403: and transmitting the verification type identification and the page identification of the target page to a verification method caller.
In the embodiment of the disclosure, a verification method corresponding to the target test operation is called by using a verification method caller. Specifically, when a target test operation for a target page is received, a verification type identifier corresponding to the target test operation and a page identifier of the target page are obtained first, where the verification type identifier is, for example, Action1, and the page identifier of the target page is, for example, OP 1. The authentication type identifier and the page identifier are then passed to an authentication method invoker as input parameters.
In practical application, the verification method invoker is used for invoking a corresponding verification method based on an input parameter. S404: and determining the verification class corresponding to the verification type identifier from a preset verification class set by using the verification method invoker as a target verification class.
S405: and determining a verification method corresponding to the page identifier of the target page from the target verification class by using the verification method invoker, and invoking the verification method to verify an operation result corresponding to the target test operation.
In the embodiment of the disclosure, after the input parameter is transferred to the verification method invoker, the verification method invoker determines, based on the verification type identifier, a verification class corresponding to the verification type identifier from a preset verification class set as a target verification class, then determines, from the target verification class, a verification method corresponding to the page identifier, and invokes the verification method to verify an operation result corresponding to the target test operation.
For convenience of understanding, the embodiment of the present disclosure provides an execution process schematic diagram of a page testing method. Fig. 5 includes a part of a test flow in a test case, where the test flow includes jumps of 3 pages. Specifically, when a target test operation for the target page PO1 is received, the verification type identifier Action1 and the page identifier PO1 corresponding to the target test operation are used as input parameters to be transmitted to a verification method invoker, such as the Action invoker in fig. 5.
At the writing stage of the test case, the verification methods corresponding to PO1, PO2, and PO3 are respectively encapsulated in different Action classes, for example, Action (PO1) is encapsulated in Action1 class, and Action (PO2) is encapsulated in Action2 class, because PO3 has multiple verification methods, different verification methods corresponding to PO3 can be respectively encapsulated in different Action classes based on verification types, for example, Action (PO3) is encapsulated in Action1 class, and Action (PO3) is also encapsulated in Action2 class. The verification method comprises an assertion step and a self-defining step, wherein the assertion is used for verifying the operation result, and the self-defining step is used for assisting the assertion in verifying. For example, when the operation result of the login operation is verified, the login home page may be in a buffer state, that is, the display of the login page is not realized.
It is worth noting that the verification methods encapsulated in different Action classes correspond to different verification types, so that the verification logic implemented by actions (PO3) respectively encapsulated in Action1 class and Action2 class is different due to different corresponding verification types.
In practical application, after the Action invoker receives the verification type identifier corresponding to the target test operation of the PO1 and the PO1, the Action1 class is determined based on the verification type identifier, where the verification type identifier may be Action1, then a verification method with an input parameter of PO1, that is, Action (PO1), is determined in the Action1 class, and the operation result corresponding to the target test operation of the PO1 is verified based on the Action (PO 1).
Similarly, when a target behavior operation of the PO2 is received, the verification type identifier corresponding to the target test operation and the PO2 are used as input parameters and are transmitted to the Action invoker, the Action invoker determines the Action2 class based on the verification type identifier Action2, then, the verification method with the input parameter of PO2, namely the Action (PO2), is determined in the Action2 class, and the operation result corresponding to the target test operation of the PO2 is verified based on the Action (PO 2).
When the test flow is executed to the PO3, a target test operation of the PO3 is received, and the verification type identifier corresponding to the target test operation and the PO3 are passed to the Action invoker as input parameters. It is noted that the verification type identifier corresponding to the target test operation of PO3 includes two identifiers, Action1 and Action2, and Action1 and Action2 may be stored by using a type identifier array ActionList. The Action invoker traverses the Action list to sequentially acquire Action1 and Action2, determines a corresponding Action1 class aiming at Action1, and then invokes a verification method with input parameters of PO3, namely Action (PO3) in the Action1 class. For Action2, a corresponding Action2 class is determined, and then a verification method with an input parameter of PO3, namely Action (PO3), is called in the Action2 class. Based on Action1 class and Action (PO3) verification methods in Action2 class, the operation result corresponding to the target test operation of PO3 is verified.
In an alternative implementation, as shown in fig. 6, an execution process of another page testing method provided by the embodiment of the present disclosure is schematically illustrated, where the Action invoker receives two input parameters, namely, PageObject and ActionList, and represents the two input parameters by Invoke (PageObject, ActionList), where the PageObject is a type of a page object, and the ActionList is an array of custom actions, and may include an Action1 class, an Action2 class, and the like. And the Action caller circularly traverses the ActionList array to search the verification method with the function name of Action and the parameter type of PageObject, and if the verification method, namely the Action (PageObject) method is found, the Action (PageObject) method is called for verifying the operation result. And if the verification method with the function name of Action and the parameter type of PageObject is not found, continuing to traverse the ActionList array until the ActionList array is determined to be empty, indicating that the traversal is finished, and ending the process.
In the page testing method provided by the embodiment of the disclosure, the decoupling of the test flow and the result verification logic in the test case is realized based on the Action invoker and the Action mechanism of the Action class, so that the code maintenance cost is reduced.
On the basis of the above embodiments, in order to improve reusability of codes, in the writing stage of the test case, the common verification method corresponding to the verification type may be determined based on the same verification logic in the verification methods of the same verification type in the embodiments of the present disclosure.
For example, the verification method Action (PO1) and Action (PO3) in Action1 class in fig. 5 have the same popup verification logic, and thus, a corresponding common verification method may be generated based on the same popup verification logic and stored in Action1 class. When any of the authentication methods in Action1 class is invoked, the common authentication method is invoked by default.
In the embodiment of the present disclosure, after the verification class corresponding to the verification type identifier is determined, in the verification class, a verification method corresponding to the page identifier of the target page and the common verification method are called, and the operation result corresponding to the target test operation is verified.
In the page test method provided by the embodiment of the disclosure, the common verification method is generated based on the same verification logic in the verification methods belonging to the same verification type. In the page testing process, when each verification method in the same verification class is called, a common verification method in the verification class is called by default, and code multiplexing is achieved.
Based on the above method embodiment, the present disclosure further provides a page testing apparatus, and referring to fig. 7, the page testing apparatus according to the embodiment of the present disclosure is schematically configured, where the apparatus includes:
a first obtaining module 701, configured to respond to a target test operation for a target page, and obtain test verification information corresponding to the target test operation; the test verification information comprises a verification type identifier and a page identifier of the target page;
a first determining module 702, configured to determine, in a preset verification class set, a verification class corresponding to the verification type identifier; the verification method is used for testing and verifying, and the verification method and the page identifier have a corresponding relation;
the invoking module 703 is configured to invoke, in the verification class, a verification method corresponding to the page identifier of the target page, and verify the operation result corresponding to the target test operation.
In an optional implementation manner, the page identifier belongs to an input parameter of a verification method having a corresponding relationship with the page identifier, and the invoking module includes:
the determining submodule is used for determining a verification method to which the input parameter matched with the page identifier of the target page belongs from the verification class based on the dimension of the input parameter of the verification method, and taking the determined verification method as the target verification method;
and the calling submodule is used for calling the target verification method and verifying the operation result corresponding to the target test operation.
In an alternative embodiment, the apparatus further comprises:
the second obtaining module is used for obtaining the verification type identifier and the page identifier of the target page from the test verification information;
the transfer module is used for transferring the verification type identifier and the page identifier of the target page to a verification method caller; wherein the verification method invoker is configured to determine a verification method based on the verification type identifier and the page identifier;
correspondingly, the first determining module is specifically configured to:
determining a verification class corresponding to the verification type identifier from a preset verification class set by using the verification method caller as a target verification class;
the calling module is specifically configured to:
and determining a verification method corresponding to the page identifier of the target page from the target verification class by using the verification method invoker, and invoking the verification method to verify an operation result corresponding to the target test operation.
In an optional embodiment, the verification class includes a common verification method, and the common verification method is determined based on the same verification logic in each verification method in the verification class;
the calling module is specifically configured to:
and in the verification class, calling a verification method corresponding to the page identifier of the target page and the common verification method, and verifying an operation result corresponding to the target test operation.
In an alternative embodiment, the apparatus further comprises:
a first receiving module, configured to receive a modification request for a target verification method; wherein, the modification request carries an authentication type identifier and a page identifier;
a second determining module, configured to determine, in the preset verification class set, a verification class corresponding to the verification type identifier, and determine, in the verification class, a verification method corresponding to the page identifier as the target verification method;
a second receiving module for receiving a modification operation for the target verification method.
In the page testing device provided by the embodiment of the disclosure, in response to a target testing operation for a target page, test verification information corresponding to the target testing operation is acquired. The test verification information comprises a verification type identifier and a page identifier of the target page. Then, in a preset verification class set, determining a verification class corresponding to the verification type identifier, wherein the verification class comprises a verification method for testing verification, and the verification method has a corresponding relation with the page identifier. And then, in the verification class, calling a verification method corresponding to the page identifier of the target page, and verifying an operation result corresponding to the target test operation. According to the page testing method and device, the page testing is achieved based on the verification method in the preset verification class set, the testing flow is decoupled from the verification method, even if the verification logic changes, only the verification method in the preset verification class set needs to be adjusted, the code of the page testing method does not need to be adjusted, and the code maintenance cost is reduced.
In addition to the method and the apparatus, an embodiment of the present disclosure further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on a terminal device, the terminal device is enabled to implement the page testing method according to the embodiment of the present disclosure.
The embodiment of the present disclosure further provides a computer program product, which includes a computer program/instruction, and is characterized in that the computer program/instruction, when executed by a processor, implements the page testing method according to the embodiment of the present disclosure.
In addition, an embodiment of the present disclosure further provides a page testing device, as shown in fig. 8, which may include:
a processor 801, a memory 802, an input device 803, and an output device 804. The number of the processors 801 in the page test apparatus may be one or more, and one processor is taken as an example in fig. 8. In some embodiments of the present disclosure, the processor 801, the memory 802, the input device 803, and the output device 804 may be connected by a bus or other means, wherein the connection by the bus is exemplified in fig. 8.
The memory 802 may be used to store software programs and modules, and the processor 801 executes various functional applications and data processing of the page test apparatus by operating the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like. Further, the memory 802 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. The input device 803 may be used to receive input numeric or character information and generate signal inputs related to user settings and functional control of the page test apparatus.
Specifically, in this embodiment, the processor 801 loads an executable file corresponding to a process of one or more application programs into the memory 802 according to the following instructions, and the processor 801 runs the application programs stored in the memory 802, thereby implementing various functions of the page test apparatus.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:界面测试方法、装置、电子设备及存储介质