CN111522749B - Page testing method and device, readable storage medium and electronic equipment - Google Patents

Page testing method and device, readable storage medium and electronic equipment Download PDF

Info

Publication number
CN111522749B
CN111522749B CN202010340656.3A CN202010340656A CN111522749B CN 111522749 B CN111522749 B CN 111522749B CN 202010340656 A CN202010340656 A CN 202010340656A CN 111522749 B CN111522749 B CN 111522749B
Authority
CN
China
Prior art keywords
page
operation behavior
response content
information
tested
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.)
Active
Application number
CN202010340656.3A
Other languages
Chinese (zh)
Other versions
CN111522749A (en
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202010340656.3A priority Critical patent/CN111522749B/en
Publication of CN111522749A publication Critical patent/CN111522749A/en
Application granted granted Critical
Publication of CN111522749B publication Critical patent/CN111522749B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • 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
    • 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/3692Test management for test results analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 disclosure relates to a page testing method and device, a readable storage medium and electronic equipment. The method comprises the following steps: recording the operation behavior of the page to be tested and the initial configuration information of the client before the operation behavior is executed; recording page characteristic information of a first page generated based on the operation behavior; setting the current configuration information of the client to initial configuration information in response to the obtained playback request; after the setting is successful, playing back the recorded operation behavior aiming at the page to be tested; determining page characteristic information of a second page generated based on the played back operation behavior; and obtaining a test result of the page to be tested according to the page characteristic information of the second page and the page characteristic information of the first page. Therefore, the current configuration information of the client is set as the initial configuration information before the playback operation behavior, so that the defect of page error test caused by different configuration information of the client is overcome, and the accuracy of the page test is improved.

Description

Page testing method and device, readable storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a page testing method and apparatus, a readable storage medium, and an electronic device.
Background
With the rapid development of the internet, the web engineering application volume is larger and larger, the requirement on the web page quality is higher and higher, and the testing of the web page is a necessary means for guaranteeing the web page quality. In the prior art, a software developer needs to compile a test case for a page or a page element to be tested, and the page or the page element to be tested is tested through the test case.
However, the existing page test methods generally cause the following problems: (1) Due to the fact that a test case needs to be manually compiled, functional modules used by a user can be omitted, and the requirement of high coverage of a user functional scene is difficult to achieve; (2) Because web application develops rapidly, page function iteration is fast, timeliness of test cases easily loses value along with version iteration, and generally manual maintenance is needed to determine which test case is effective and which test case is ineffective, so that a large amount of manpower is spent on case maintenance; (3) Because the test case needs to be manually compiled, the page can not be detected in a full-automatic way, so that the intelligent degree of the page test is low; (4) The recording process and the playback process may have a problem of inconsistent page states, which may easily cause a failure in the execution of the test case. For example, the test case is an order in a deleted page, the order exists in the page during recording, but the order does not exist in the page after the test case is executed, so that a playback failure result is obtained due to the fact that the order does not exist during re-execution of the test case in the playback process, namely the page is mistakenly considered to be abnormal. Therefore, the accuracy and the intelligence degree of the existing page testing method are low.
Disclosure of Invention
The disclosure aims to provide a page testing method, a page testing device, a readable storage medium and an electronic device, so as to improve the accuracy of page testing and the intelligent degree of page testing.
In order to achieve the above object, a first aspect of the present disclosure provides a page testing method, where the method includes:
recording an operation behavior aiming at a page to be tested and initial configuration information of a client before the operation behavior is executed;
recording page characteristic information of a first page generated based on the operation behavior;
setting the current configuration information of the client to the initial configuration information in response to acquiring the playback request;
after the setting is successful, playing back the recorded operation behavior aiming at the page to be tested;
determining page characteristic information of a second page generated based on the played back operation behavior;
and obtaining a test result of the page to be tested according to the page characteristic information of the second page and the page characteristic information of the first page.
Optionally, the method further comprises:
recording page characteristic information of the page to be tested before the operation behavior is executed;
determining page characteristic information of a third page before the operation behavior is played back;
and under the condition that the page characteristic information of the third page is matched with the page characteristic information of the page to be detected, the step of determining the page characteristic information of the second page generated based on the played back operation behavior is executed again.
Optionally, the page characteristic information includes at least one of: the target page element comprises a tag type of the target page element, a style of the target page element, a child element characteristic value of the target page element and a parent element characteristic value of the target page element, wherein the target page element at least comprises a page element corresponding to the operation behavior.
Optionally, the operational behavior is multiple; the recording of the operation behavior aiming at the page to be tested comprises the following steps:
sequentially recording a plurality of operation behaviors aiming at the page to be tested according to the sequence of the operation behaviors;
the playing back the recorded operation behavior aiming at the page to be tested comprises the following steps:
and sequentially playing back the recorded multiple operation behaviors aiming at the page to be tested according to the sequence.
Optionally, before the recording the page feature information of the first page generated based on the operation behavior, the method further includes:
determining whether response content corresponding to the operation behavior needs to be acquired from a server or not according to the operation behavior;
under the condition that the response content needs to be acquired from the server, sending a request corresponding to the operation behavior to the server so as to acquire the response content corresponding to the operation behavior from the server;
when the response content is acquired, recording the response content;
prior to the determining page characteristic information of the second page generated based on the played back operation behavior, the method further includes:
acquiring the recorded response content corresponding to the played back operation behavior;
and generating the second page according to the response content.
Optionally, when the response content is acquired, recording the response content includes:
when the response content is acquired, correlating and recording a request corresponding to the operation behavior sent to the server and response content returned by the server for the request;
the obtaining the recorded response content corresponding to the played back operation behavior comprises:
generating a target request corresponding to the played back operation behavior;
and obtaining target response content associated with the target request from the request of the associated record and response content returned aiming at the request, and taking the target response content as response content corresponding to the played back operation behavior.
Optionally, the configuration information comprises at least one of: the state data of the page to be tested, the memory information of the client, the environment information of the container and the system state information of the client.
Optionally, the obtaining a test result of the page to be tested according to the page feature information of the second page and the page feature information of the first page includes:
determining whether the page feature information of the second page is matched with the page feature information of the first page;
obtaining a test result of the page to be tested according to the matching result;
wherein, under the condition of matching, the obtained test result is normal; in case of no match, the test result obtained is abnormal.
A second aspect of the present disclosure provides a page testing apparatus, the apparatus including:
the system comprises a first recording module, a second recording module and a third recording module, wherein the first recording module is used for recording operation behaviors aiming at a page to be tested and initial configuration information of a client before the operation behaviors are executed;
a second recording module configured to record page feature information of the first page generated based on the operation behavior;
a setting module configured to set current configuration information of the client to the initial configuration information in response to acquiring the playback request;
the playback module is configured to play back the recorded operation behavior aiming at the page to be tested after the setting is successful;
a first determination module configured to determine page characteristic information of a second page generated based on the played back operation behavior;
the first obtaining module is configured to obtain a test result of the page to be tested according to the page feature information of the second page and the page feature information of the first page.
Optionally, the apparatus further comprises:
a third recording module configured to record page feature information of the page to be tested before the operation behavior is executed;
a second determination module configured to determine page characteristic information of a third page prior to playback of the operational behavior;
a driving module configured to drive the first determining module to perform the step of determining the page feature information of the second page generated based on the played back operation behavior if the page feature information of the third page matches the page feature information of the page to be tested.
Optionally, the page feature information includes at least one of: the target page element comprises a tag type of the target page element, a style of the target page element, a child element characteristic value of the target page element and a parent element characteristic value of the target page element, wherein the target page element at least comprises a page element corresponding to the operation behavior.
Optionally, the operational behavior is multiple; the first recording module is configured to: sequentially recording a plurality of operation behaviors aiming at the page to be tested according to the sequence of the operation behaviors;
the playback module is configured to: and sequentially playing back the recorded multiple operation behaviors aiming at the page to be tested according to the sequence.
Optionally, the apparatus further comprises:
a third determining module, configured to determine, according to the operation behavior, whether response content corresponding to the operation behavior needs to be acquired from a server;
a sending module configured to send a request corresponding to the operation behavior to the server to obtain response content corresponding to the operation behavior from the server if the response content needs to be obtained from the server;
a fourth recording module configured to record the response content when the response content is acquired;
the device further comprises:
a second obtaining module configured to obtain the recorded response content corresponding to the played back operation behavior;
a generating module configured to generate the second page according to the response content.
Optionally, the fourth recording module is configured to: when the response content is acquired, correlating and recording a request corresponding to the operation behavior sent to the server and response content returned by the server for the request;
the second acquisition module includes:
a generation submodule configured to generate a target request corresponding to the played back operation behavior;
and the first obtaining sub-module is configured to obtain target response content associated with the target request from the request of the associated record and response content returned for the request, and take the target response content as response content corresponding to the played back operation behavior.
Optionally, the configuration information comprises at least one of: the state data of the page to be tested, the memory information of the client, the environment information of the container and the system state information of the client.
Optionally, the first obtaining module includes:
a determining sub-module configured to determine whether the page characteristic information of the second page matches the page characteristic information of the first page;
the second obtaining sub-module is configured to obtain a test result of the page to be tested according to the matching result;
wherein, under the condition of matching, the obtained test result is normal; in case of mismatch, the test result obtained is abnormal.
A third aspect of the present disclosure provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method provided by the first aspect of the present disclosure.
A fourth aspect of the present disclosure provides an electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method provided by the first aspect of the present disclosure.
According to the technical scheme, the operation behavior of the page to be tested and the page characteristic information of the first page generated based on the operation behavior are recorded, the initial configuration information of the client before the operation behavior is executed can be recorded, the operation behavior is played back after the current configuration information of the client is set as the initial configuration information, and the test result of the page to be tested is obtained according to the page characteristic information of the second page and the page characteristic information of the first page after the operation behavior is played back. Therefore, the current configuration information of the client is set as the initial configuration information before the operation behavior is played back, so that the defect of error testing of the page due to different configuration information of the client is overcome, and the accuracy of the page testing is improved. In addition, the operation behavior is automatically recorded, and the page characteristic information of the first page after the operation behavior is executed is automatically recorded, so that the defect of manually writing a test case is avoided, the requirement of high coverage of a user function scene is met, and the intelligent degree of page testing is improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a flow diagram illustrating a method of page testing in accordance with an exemplary embodiment.
Fig. 2A is a flowchart illustrating a recording process in a page testing method according to an exemplary embodiment.
FIG. 2B is a flow diagram illustrating a playback process in a method of page testing, according to an exemplary embodiment.
FIG. 3 is a block diagram illustrating a page test apparatus in accordance with an exemplary embodiment.
FIG. 4 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
In consideration of the defects of manual writing of test cases, the page test method for automatically generating the test cases is provided. Generally, when a page is tested, the recorded operation behavior is mainly played back, and the page is tested according to the page characteristic information of the page after the operation behavior is played back and the recorded page characteristic information of the page after the operation behavior is executed, so that the test accuracy is low, because the page states are not completely consistent in the recording process and the playback process, and the inconsistency of the page states may affect the test result of the page. Therefore, based on the above analysis, the present disclosure provides a page testing method, device, readable storage medium and electronic device.
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
FIG. 1 is a flow diagram illustrating a method of page testing that may be applied at a client, according to an example embodiment. The client may be a browser, which may be, for example, an IE browser, a Safari browser, a Chrome browser, a 360 browser, and the like, and the client runs in an electronic device with a display function, such as an electronic device like a mobile phone, a computer, and the like, and may be used to display a page to a user on a display interface, so that the user performs an operation on the page. As shown in fig. 1, the method may include the following steps.
In step 11, the operation behavior for the page to be tested and the initial configuration information of the client before the operation behavior is executed are recorded.
It should be noted that a recording script is preset in the client executing the method, and when the operation behavior of the user for the page to be detected is detected, the recording script may be loaded to implement recording through the recording script. The page to be tested can be any page in the client.
Specifically, the recording script may record an operation behavior for the page to be tested. The operation behavior may be any operation behavior of a user on any page element in the page to be tested, or may also be any operation behavior of the client on any page element in the page to be tested automatically (for example, the client may automatically trigger a "submit" button in the page to be tested at regular time, etc.). The operation behavior may be an operation behavior of editing, adding, or deleting a table in the page to be detected, an operation behavior of clicking a button in the page to be detected, an operation behavior of editing a text box in the page to be detected, or the like. The operation behavior may be recorded by the recording script according to the related art, which is not illustrated or limited herein.
In addition, the inventor considers that in the recording and playback processes, if the page states are different, the page can be subjected to error test. For example, different accounts may typically have different access rights. If the user logs in an account in the client in the recording process, the account has a function of deleting the order A in the page, and after the user performs an operation of deleting the order A, the client can present a page after deleting the order A. However, in the playback process, if the user does not log in the account or logs in another account without the authority to delete the order a, when the operation behavior of deleting the order a is played back, since the user does not have the authority to delete the order a, the page after deleting the order a cannot be presented, so that the detection result of the page is determined to be abnormal by mistake, and the test accuracy is low. Therefore, in the present disclosure, in addition to recording the operation behavior for the page to be tested, the initial configuration information of the client before executing the operation behavior may also be recorded. The configuration information of the client may be at least one of state data of the page to be tested, memory information of the client, environment information of the container, and system state information of the client.
As described above, in the present disclosure, in consideration that different users have different access rights, in the recording process, the recorded configuration information of the client may include state data of the page to be tested and/or memory information of the client. For example, the state information of the page to be tested may be data recorded in the client, such as localStorage, sessionStorage, cookie, and the like. It should be noted that, localStorage, sessionStorage, and cookies may be all used to store the identity information of the user using the browser, and the corresponding rights information thereof. The memory information of the client may be some variable data stored locally at the client, for example, under the front window object. Wherein, some variable data under the front-end window object can also represent the authority information of the user.
In addition, the compatibility problem of the browsers is considered, namely, a certain page can only be opened in the IE browser and cannot be opened in other browsers. For example, during recording, the user operates the page in an IE browser. If the 360-degree browser performs playback in the playback process, the 360-degree browser cannot open the page, so that the playback fails, and therefore the test result of the page is mistakenly considered to be abnormal. Therefore, in the present disclosure, during the recording process, the recorded configuration information of the client may further include environment information of a container for characterizing the browser identifier, and the environment information of the container may characterize the browser identifier. For example, the environment information of the container may include url (uniform resource Locator) of the client, user agent (user agent) of the client, and width and height information of the client.
In addition, some operational behaviors may be clock-like operational behaviors, i.e., timing-triggered operational behaviors. For example, the "submit" button provided in the 12. During the playback, if the operation behavior of clicking the "submit" button is not played back at 12. Therefore, in the present disclosure, during the recording process, the recorded configuration information of the client may further include system state information. The system status information may include a system time or date, etc.
It should be noted that, in the present disclosure, it is described that the configuration information includes at least one of the state data of the page to be tested, the memory information of the client, the environment information of the container, and the system state information of the client, which is only an example, and the configuration information of the client may further include other information related to the page state displayed by the client, and the disclosure does not specifically limit this.
In step 12, page characteristic information of the first page generated based on the operation behavior is recorded.
The recording script records an operation behavior and initial configuration information of the client, and also records page feature information of a page after the operation behavior is executed, so that whether the client presents an expected page after playing back a certain operation behavior is determined according to the recorded page feature information and the determined page feature information in the playback process. Therefore, in the present disclosure, page feature information of the first page generated based on the operation behavior needs to be recorded. In an example, after detecting an operation behavior for a page to be tested, a client automatically generates or acquires response content corresponding to the operation behavior from a server, and generates a first page according to the response content, where the first page is a page generated based on the operation behavior, and then a recording script may record page feature information of the first page, so that the page feature information of the first page may be subsequently used as reference page feature information, so as to determine a test result of the page to be tested according to the page feature information of the page after the operation behavior is played back and the reference page feature information.
In step 13, in response to acquiring the playback request, the current configuration information of the client is set as the initial configuration information.
In the disclosure, the playback request may be input to the client by a user, or may be periodically generated by an automated testing tool Webdriver in the client. When the client side obtains the playback request, in order to ensure that the page states in the recording and playback processes are consistent, the current configuration information of the client side is set as the initial configuration information.
In step 14, after the setting is successful, the recorded operation behavior for the page to be tested is played back.
In step 15, page characteristic information of the second page generated based on the played back operation behavior is determined.
And after the setting is successful, the page state in the playback process is consistent with the page state in the recording process, and at the moment, the recorded operation behavior aiming at the page to be detected is played back. After the operation behavior is played back, response content corresponding to the operation behavior is obtained, a second page is generated according to the response content, and then page characteristic information of the second page is determined.
In step 16, a test result of the page to be tested is obtained according to the page feature information of the second page and the page feature information of the first page.
Specifically, determining whether the page feature information of the second page is matched with the page feature information of the first page; according to the matching result, obtaining a test result of the page to be tested; wherein, under the condition of matching, the obtained test result is normal; in case of mismatch, the obtained test result is abnormal. It should be noted that, in the present disclosure, in the case of determining that a page is abnormal, it may be further positioned that a function of a page element corresponding to an operation behavior in the page to be tested is abnormal.
For example, the page feature information of the second page and the page feature information of the first page may be subjected to matching degree calculation to obtain matching degree information, which may be expressed in the form of percentage, for example. If the matching degree information is greater than or equal to a preset matching degree threshold value, the fact that the matching degree of the page characteristic information of the second page and the page characteristic information of the first page is high is indicated, and the page to be detected is not abnormal; if the matching degree information is smaller than a preset matching degree threshold value, it is indicated that the page to be detected may be abnormal.
According to the technical scheme, the operation behavior of the page to be tested and the page characteristic information of the first page generated based on the operation behavior are recorded, the initial configuration information of the client before the operation behavior is executed can be recorded, the operation behavior is played back after the current configuration information of the client is set as the initial configuration information, and the test result of the page to be tested is obtained according to the page characteristic information of the second page and the page characteristic information of the first page after the operation behavior is played back. Therefore, the current configuration information of the client is set as the initial configuration information before the operation behavior is played back, so that the defect of error testing of the page due to different configuration information of the client is overcome, and the accuracy of the page testing is improved. In addition, the operation behavior is automatically recorded, and the page characteristic information of the first page after the operation behavior is executed is automatically recorded, so that the defect of manually writing a test case is avoided, the requirement of high coverage of a user function scene is met, and the intelligent degree of page testing is improved.
It should be noted that the page feature information may be a screenshot image obtained by performing screenshot processing on a preset area of the page, may also be a pixel of the page, and may also be information determined based on attribute information of a page element. In consideration of that when the page feature information is a screenshot image, on one hand, a larger storage space needs to be occupied to store image data, and on the other hand, it is determined by using an image recognition technology whether the page screenshot of the second page matches the page screenshot of the first page, accuracy of a matching result is low, and when the page feature information of the page is a pixel of the page, it cannot be accurately reflected whether a function of the page after an execution or playback operation behavior is abnormal, and therefore, in a preferred embodiment, the page feature information may be information determined based on attribute information of a page element.
Illustratively, the page feature information may be determined based on the attribute information of the page element by:
and acquiring attribute information of a target page element in the page to obtain a feature vector of the target page element. And determining page characteristic information according to the characteristic vector of the target page element. For example, a hash calculation may be performed on the feature vector of the target page element, and the calculation result after the hash calculation may be used as the page feature information. And the target page element at least comprises a page element corresponding to the operation behavior. For example, if the operation behavior is to click a "submit" button, the page element corresponding to the operation behavior is the "submit" button. The target page element may only include a page element corresponding to the operation behavior, may also include a preset number of page elements, and may also include all page elements in the page. The present disclosure does not specifically limit this.
The attribute information of the target page element includes at least one of: the tag type of the target page element, the style of the target page element, the child element characteristic value of the target page element, and the parent element characteristic value of the target page element. The tag type may include a button type, an input box type, a text type, a selection box type, a drop-down box type, and the like. The Style of the target page element is a CSS (Cascading Style Sheets) Style of the target page element. The sub-element feature value may be its text, the length of the sub-element, etc. The parent element feature value may be its text, the length of the parent element, etc. Therefore, the page characteristic information is determined according to the attribute information of the target page element, so that the determined page characteristic information can represent the state of the page more accurately, and the accuracy of page testing is further improved.
In an embodiment, if the page states before the operation behavior is executed in the playback and recording processes are inconsistent, the page feature information of the page after the operation behavior is executed in the playback and recording processes may also be inconsistent, thereby causing a problem of performing a false test on the page to be tested. Specifically, the page testing method may further include:
recording page characteristic information of a page to be tested before executing operation behaviors;
determining page characteristic information of a third page before the playback operation behavior;
and under the condition that the page characteristic information of the third page is matched with the page characteristic information of the page to be detected, determining the page characteristic information of the second page generated based on the played back operation behavior.
Illustratively, fig. 2A is a flow chart illustrating a recording process in a page test method according to an exemplary embodiment. As shown in fig. 2A, in the recording process, when the user accesses the page to be tested through the operation on the page to be tested, the client may load the recording script. After the loading is successful, the recording script of the client can monitor and record the operation behavior on one hand, and on the other hand, can record the initial configuration information of the client before the operation behavior is executed, and record the page feature information of the page to be tested before the operation behavior is executed, and then the client executes the operation behavior and records the page feature information of the first page after the operation behavior is executed. It should be noted that the recording script may record the operation behavior, the initial configuration information of the client before executing the operation behavior, and the page feature information of the first page after executing the operation behavior in a loop.
FIG. 2B is a flow diagram illustrating a playback process in a method of page testing according to an exemplary embodiment. As shown in fig. 2B, in the playback process, when the Webdriver in the client accesses the page to be tested, the client may load a playback script. After the loading is successful, the playback script of the client may set the current configuration information of the client to the initial configuration information, and after the setting is successful, trigger the operation behavior, and determine the page feature information of the third page before executing the operation behavior, so as to determine whether the page feature information of the third page matches with the page feature information of the page to be tested, and in the case of matching, execute the operation behavior, and determine the page feature information of the second page after executing the operation behavior, so as to test the page to be tested according to the page feature information of the second page and the page feature information of the first page. Likewise, the playback script may loop back the recorded operational behavior.
By adopting the technical scheme, under the condition that the page characteristic information of the third page is matched with the page characteristic information of the page to be tested, the page characteristic information of the second page generated based on the played back operation behavior is determined, so that the defect of error test on the page to be tested caused by inconsistent page states before the operation behavior is executed in the playing back and recording processes can be avoided, and the accuracy of the page test is further improved.
In an embodiment, in a general case, a page includes multiple page elements, and if the multiple page elements in the page need to be tested, operation behaviors for different page elements need to be recorded, that is, there are multiple operation behaviors that need to be recorded. In this case, in order to solve the problem of low test accuracy caused by different time sequences of execution of the operation behaviors in the playback and recording processes, in the present disclosure, recording the operation behavior for the page to be tested may specifically include: sequentially recording a plurality of operation behaviors aiming at the page to be tested according to the sequence of the operation behaviors; correspondingly, playing back the recorded operation behavior for the page to be tested may also specifically include: and sequentially playing back the recorded multiple operation behaviors aiming at the page to be detected according to the sequence. Therefore, the time sequence of the playback operation behavior in the playback process is the same as the time sequence of the execution operation behavior in the recording process, and the accuracy of the page test is further improved.
It should be understood that before generating a page according to an operation behavior, a client needs to acquire response content corresponding to the operation behavior, and then render the response content to obtain the page generated based on the operation behavior. The inventor considers that if the client needs to acquire the response content from the server, the client needs to communicate with the server, and the network speeds may be different at different times, that is, the network speeds when the client communicates with the server may be different greatly in the recording process and the playback process, which may result in the same time interval and the complete response content that cannot be acquired from the server in the playback process, so that some page elements in the page are not completely loaded. For example, during recording, after 2 seconds of sending a request, the client may acquire complete response content from the server, and during playback, because the network speed is slow, after 2 seconds of sending the request, part of page elements in the acquired response content are not completely loaded, so that the page feature information of the page generated during playback is not matched with the page generated during recording, which results in an inaccurate test result of the page to be tested.
Therefore, in order to solve the above problem, before recording the page feature information of the first page generated based on the operation behavior, the page testing method may further include:
determining whether response content corresponding to the operation behavior needs to be acquired from the server or not according to the operation behavior;
under the condition that the response content needs to be acquired from the server, sending a request corresponding to an operation behavior to the server so as to acquire the response content corresponding to the operation behavior from the server;
and recording the response content when the response content is acquired.
In this embodiment, the client may determine whether response content corresponding to the operation behavior needs to be acquired from the server according to the operation behavior. Specifically, the client may determine whether to acquire response content corresponding to the operation behavior from the server or to generate response content corresponding to the operation behavior by itself by using a related technology. And sending a request corresponding to the operation behavior to the server under the condition that the response content needs to be obtained from the server, so that the server can determine the response content corresponding to the operation behavior after receiving the request and send the response content to the client, so that the client obtains the response content and records the response content.
Correspondingly, if the recording script records the response content corresponding to the operation behavior returned by the server in the recording process, in the playback process, after the playback script plays back the operation behavior, the recorded response content corresponding to the played back operation behavior can be obtained, a second page is generated based on the response content, and then the page characteristic information of the second page is determined, so that the test result of the page to be tested is obtained through the page characteristic information of the second page and the page characteristic information of the first page.
Illustratively, the recording script determines whether response content needs to be acquired from the server when the operation behavior is monitored, and records the response content in case that the response content needs to be acquired from the server. Correspondingly, in the playback process, when the playback script plays back the operation behavior, whether response content corresponding to the operation behavior needs to be obtained from the server or not is determined according to the operation behavior, if yes, the recorded response content corresponding to the played back operation behavior is obtained, and a second page is generated according to the response content.
It should be noted that, if the response content does not need to be obtained from the server, that is, the client does not need to communicate with the server, the network speed does not affect the page, and therefore, in this case, the response content does not need to be recorded, so as to reduce the storage space.
In addition, in an actual application process, one test case includes a plurality of operation behaviors, if each of the plurality of operation behaviors needs to obtain its corresponding response content from the server, the client (recording script) needs to record a plurality of response contents, and in order to accurately obtain the response content corresponding to the currently played back operation behavior in a playback process, in the present disclosure, when obtaining the response content, a specific implementation manner of recording the response content may be: when the response content is acquired, the request corresponding to the operation behavior sent to the server and the response content returned by the server for the request are recorded in an associated manner. That is, the client records not only the response content but also the request sent by the client to the server, and associates the request with the response content returned by the server for the request. Accordingly, during the playback, the specific implementation manner of obtaining the recorded response content corresponding to the played back operation behavior may be: generating a target request corresponding to the played back operation behavior; and obtaining target response content associated with the target request from the request of the associated record and the response content returned aiming at the request, and taking the target response content as the response content corresponding to the played back operation behavior. Therefore, the client side can conveniently acquire the response content corresponding to the currently played back operation behavior.
By adopting the technical scheme, aiming at the operation behavior of the response content required to be obtained from the server, the response content corresponding to the operation behavior can be recorded during recording, so that the response content corresponding to the played back operation behavior can be directly obtained from the recorded response content during playback, communication with the server again during playback is not required, the influence on the accuracy of a page test result due to different network speeds during recording and playback is avoided, and the accuracy of the page test is further improved. Moreover, because the response contents acquired in the playback and recording processes are the same, if the page feature information of the second page is not matched with the page feature information of the first page, it can be considered that the GUI (Graphical User Interface) function is abnormal, otherwise, it is considered that the GUI function is normal. Therefore, the GUI function can be further tested by adopting the scheme.
Based on the same inventive concept, the disclosure also provides a page testing device. FIG. 3 is a block diagram illustrating a page test apparatus in accordance with an exemplary embodiment. As shown in fig. 3, the apparatus 30 may include:
a first recording module 301, configured to record an operation behavior for a page to be tested and initial configuration information of a client before the operation behavior is executed;
a second recording module 302 configured to record page feature information of the first page generated based on the operation behavior;
a setting module 303, configured to set current configuration information of the client to the initial configuration information in response to acquiring the playback request;
a playback module 304, configured to play back the recorded operation behavior for the page to be tested after the setting is successful;
a first determining module 305 configured to determine page characteristic information of a second page generated based on the played back operation behavior;
the first obtaining module 306 is configured to obtain a test result of the page to be tested according to the page feature information of the second page and the page feature information of the first page.
According to the technical scheme, the operation behavior of the page to be tested and the page characteristic information of the first page generated based on the operation behavior are recorded, the initial configuration information of the client before the operation behavior is executed can be recorded, the operation behavior is played back after the current configuration information of the client is set as the initial configuration information, and the test result of the page to be tested is obtained according to the page characteristic information of the second page and the page characteristic information of the first page after the operation behavior is played back. Therefore, the current configuration information of the client is set as the initial configuration information before the playback operation behavior, so that the defect of page error test caused by different configuration information of the client is overcome, and the accuracy of the page test is improved. In addition, the operation behavior is automatically recorded, and the page characteristic information of the first page after the operation behavior is executed is automatically recorded, so that the defect of manually writing a test case is avoided, the requirement of high coverage of a user function scene is met, and the intelligent degree of page testing is improved.
Optionally, the apparatus may further include:
a third recording module configured to record page feature information of the page to be tested before the operation behavior is executed;
a second determination module configured to determine page characteristic information of a third page before playback of the operation behavior;
a driving module configured to drive the first determining module to perform the step of determining the page feature information of the second page generated based on the played back operation behavior if the page feature information of the third page matches the page feature information of the page to be tested.
Optionally, the page feature information includes at least one of: the target page element comprises a tag type of the target page element, a style of the target page element, a child element characteristic value of the target page element and a parent element characteristic value of the target page element, wherein the target page element at least comprises a page element corresponding to the operation behavior.
Optionally, the operational behavior is multiple; the first recording module is further configured to: sequentially recording a plurality of operation behaviors aiming at the page to be tested according to the sequence of the operation behaviors;
the playback module is further configured to: and sequentially playing back the recorded multiple operation behaviors aiming at the page to be tested according to the sequence.
Optionally, the apparatus may further include:
a third determining module, configured to determine, according to the operation behavior, whether response content corresponding to the operation behavior needs to be acquired from a server;
a sending module configured to send a request corresponding to the operation behavior to the server to obtain the response content corresponding to the operation behavior from the server if the response content needs to be obtained from the server;
a fourth recording module configured to record the response content when the response content is acquired;
the apparatus may further include:
a second obtaining module configured to obtain the recorded response content corresponding to the played back operation behavior;
a generating module configured to generate the second page according to the response content.
Optionally, the fourth recording module is further configured to: when the response content is acquired, correlating and recording a request corresponding to the operation behavior sent to the server and response content returned by the server for the request;
the second obtaining module may include:
a generation submodule configured to generate a target request corresponding to the played back operation behavior;
and the first acquisition sub-module is configured to acquire target response content associated with the target request from the request of the associated record and response content returned for the request, and take the target response content as response content corresponding to the played back operation behavior.
Optionally, the configuration information comprises at least one of: the state data of the page to be tested, the memory information of the client, the environment information of the container and the system state information of the client.
Optionally, the first obtaining module may include:
a determining sub-module configured to determine whether the page characteristic information of the second page matches the page characteristic information of the first page;
the second obtaining submodule is configured to obtain a test result of the page to be tested according to the matching result;
wherein, under the condition of matching, the obtained test result is normal; in case of mismatch, the test result obtained is abnormal.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 4 is a block diagram illustrating an electronic device in accordance with an example embodiment. As shown in fig. 4, the electronic device 400 may include: a processor 401 and a memory 402. The electronic device 400 may also include one or more of a multimedia component 403, an input/output (I/O) interface 404, and a communications component 405.
The processor 401 is configured to control the overall operation of the electronic device 400, so as to complete all or part of the steps in the page testing method. The memory 402 is used to store various types of data to support operation at the electronic device 400, such as instructions for any application or method operating on the electronic device 400 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and so forth. The Memory 402 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically Erasable Programmable Read-Only Memory (EEPROM), erasable Programmable Read-Only Memory (EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia components 403 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 402 or transmitted through the communication component 405. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 404 provides an interface between the processor 401 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 405 is used for wired or wireless communication between the electronic device 400 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, near Field Communication (NFC for short), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 405 may therefore include: wi-Fi module, bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic Device 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described page test method.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the page test method described above is also provided. For example, the computer readable storage medium may be the memory 402 described above including program instructions that are executable by the processor 401 of the electronic device 400 to perform the page test method described above.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned page test method when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details in the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. In order to avoid unnecessary repetition, various possible combinations will not be separately described in this disclosure.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (9)

1. A page testing method is characterized by comprising the following steps:
recording an operation behavior aiming at a page to be tested and initial configuration information of a client before the operation behavior is executed;
recording page characteristic information of a first page generated based on the operation behavior;
setting the current configuration information of the client to the initial configuration information in response to acquiring the playback request;
after the setting is successful, playing back the recorded operation behavior aiming at the page to be tested;
determining page characteristic information of a second page generated based on the played back operation behavior;
obtaining a test result of the page to be tested according to the page characteristic information of the second page and the page characteristic information of the first page;
wherein before the recording page feature information of the first page generated based on the operation behavior, the method further comprises:
determining whether response content corresponding to the operation behavior needs to be acquired from a server or not according to the operation behavior;
under the condition that the response content needs to be acquired from the server, sending a request corresponding to the operation behavior to the server so as to acquire the response content corresponding to the operation behavior from the server;
when the response content is acquired, recording the response content;
prior to the determining page characteristic information of the second page generated based on the played back operation behavior, the method further includes:
acquiring the recorded response content corresponding to the played back operation behavior;
and generating the second page according to the response content.
2. The method of claim 1, further comprising:
recording page characteristic information of the page to be tested before the operation behavior is executed;
determining page characteristic information of a third page before the operation behavior is played back;
and under the condition that the page characteristic information of the third page is matched with the page characteristic information of the page to be detected, the step of determining the page characteristic information of the second page generated based on the played back operation behavior is executed again.
3. The method of claim 2, wherein the page characteristic information comprises at least one of: the target page element comprises a tag type of the target page element, a style of the target page element, a child element characteristic value of the target page element and a parent element characteristic value of the target page element, wherein the target page element at least comprises a page element corresponding to the operation behavior.
4. The method of claim 1, wherein the operational behavior is a plurality; the recording of the operation behavior aiming at the page to be tested comprises the following steps:
sequentially recording a plurality of operation behaviors aiming at the page to be tested according to the sequence of the operation behaviors;
the playing back the recorded operation behavior aiming at the page to be tested comprises the following steps:
and sequentially playing back the recorded multiple operation behaviors aiming at the page to be tested according to the sequence.
5. The method according to claim 1, wherein the recording the response content when the response content is obtained comprises:
when the response content is acquired, correlating and recording a request corresponding to the operation behavior sent to the server and response content returned by the server for the request;
the obtaining the recorded response content corresponding to the played back operation behavior comprises:
generating a target request corresponding to the played back operation behavior;
and obtaining target response content associated with the target request from the request of the associated record and response content returned aiming at the request, and taking the target response content as response content corresponding to the played back operation behavior.
6. The method of claim 1, wherein the configuration information comprises at least one of: the state data of the page to be tested, the memory information of the client, the environment information of the container and the system state information of the client.
7. The method according to any one of claims 1 to 6, wherein the obtaining the test result of the page to be tested according to the page feature information of the second page and the page feature information of the first page comprises:
determining whether the page characteristic information of the second page is matched with the page characteristic information of the first page;
obtaining a test result of the page to be tested according to the matching result;
wherein, under the condition of matching, the obtained test result is normal; in case of no match, the test result obtained is abnormal.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
9. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of claims 1-7.
CN202010340656.3A 2020-04-26 2020-04-26 Page testing method and device, readable storage medium and electronic equipment Active CN111522749B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010340656.3A CN111522749B (en) 2020-04-26 2020-04-26 Page testing method and device, readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010340656.3A CN111522749B (en) 2020-04-26 2020-04-26 Page testing method and device, readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111522749A CN111522749A (en) 2020-08-11
CN111522749B true CN111522749B (en) 2023-04-11

Family

ID=71904645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010340656.3A Active CN111522749B (en) 2020-04-26 2020-04-26 Page testing method and device, readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111522749B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076243B (en) * 2021-03-26 2024-05-17 成都安恒信息技术有限公司 Method for optimizing automatic testing cost of image recognition
CN113139111A (en) * 2021-04-23 2021-07-20 北京锐安科技有限公司 Page state detection method, device, equipment and medium
CN113238949A (en) * 2021-05-19 2021-08-10 北京仁科互动网络技术有限公司 Test method, test device, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079744A (en) * 2007-07-04 2007-11-28 中兴通讯股份有限公司 An implementation method for configuring digital user line
CN102325046A (en) * 2011-09-08 2012-01-18 杭州华三通信技术有限公司 Method for triggering network equipment to recover default configuration and device
CN103051692A (en) * 2012-12-11 2013-04-17 中国能源建设集团广东省电力设计研究院 Mobile operation system working platform supporting extreme network environment
CN103678105A (en) * 2012-09-17 2014-03-26 百度在线网络技术(北京)有限公司 Page code testing method and device
CN106649092A (en) * 2016-10-21 2017-05-10 郑州云海信息技术有限公司 Test script generation method, web page testing method, device and system
CN106681919A (en) * 2016-12-22 2017-05-17 上海斐讯数据通信技术有限公司 User interface automatic test method and system
CN106681926A (en) * 2017-01-05 2017-05-17 网易(杭州)网络有限公司 Method and device for testing webpage performances
CN110275834A (en) * 2019-06-25 2019-09-24 中国工商银行股份有限公司 User interface automatization test system and method
CN110597733A (en) * 2019-09-23 2019-12-20 神州数码融信软件有限公司 Method and device for testing stability of automatic front end and storage medium
CN110944037A (en) * 2019-10-25 2020-03-31 浙江大华技术股份有限公司 Method, computer device and storage medium for client cache change configuration
CN111046283A (en) * 2019-12-04 2020-04-21 深圳前海微众银行股份有限公司 Feature selection method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7231606B2 (en) * 2000-10-31 2007-06-12 Software Research, Inc. Method and system for testing websites
US10382386B2 (en) * 2016-10-27 2019-08-13 Ranorex GmbH Functional webpage testing tool

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079744A (en) * 2007-07-04 2007-11-28 中兴通讯股份有限公司 An implementation method for configuring digital user line
CN102325046A (en) * 2011-09-08 2012-01-18 杭州华三通信技术有限公司 Method for triggering network equipment to recover default configuration and device
CN103678105A (en) * 2012-09-17 2014-03-26 百度在线网络技术(北京)有限公司 Page code testing method and device
CN103051692A (en) * 2012-12-11 2013-04-17 中国能源建设集团广东省电力设计研究院 Mobile operation system working platform supporting extreme network environment
CN106649092A (en) * 2016-10-21 2017-05-10 郑州云海信息技术有限公司 Test script generation method, web page testing method, device and system
CN106681919A (en) * 2016-12-22 2017-05-17 上海斐讯数据通信技术有限公司 User interface automatic test method and system
CN106681926A (en) * 2017-01-05 2017-05-17 网易(杭州)网络有限公司 Method and device for testing webpage performances
CN110275834A (en) * 2019-06-25 2019-09-24 中国工商银行股份有限公司 User interface automatization test system and method
CN110597733A (en) * 2019-09-23 2019-12-20 神州数码融信软件有限公司 Method and device for testing stability of automatic front end and storage medium
CN110944037A (en) * 2019-10-25 2020-03-31 浙江大华技术股份有限公司 Method, computer device and storage medium for client cache change configuration
CN111046283A (en) * 2019-12-04 2020-04-21 深圳前海微众银行股份有限公司 Feature selection method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111522749A (en) 2020-08-11

Similar Documents

Publication Publication Date Title
US10929266B1 (en) Real-time visual playback with synchronous textual analysis log display and event/time indexing
CN111522749B (en) Page testing method and device, readable storage medium and electronic equipment
US10853232B2 (en) Adaptive system for mobile device testing
US10243679B2 (en) Vulnerability detection
CN108959068B (en) Software interface testing method, device and storage medium
US20170337122A1 (en) Synthetic test recorder installed inline with a web portal
US7617486B2 (en) Method and system to automate software testing using sniffer side and browser side recording and a toolbar interface
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
US10176079B2 (en) Identification of elements of currently-executing component script
WO2018059393A1 (en) Test method for mobile application program, server, terminal and storage medium
CN110013672B (en) Method, device, apparatus and computer-readable storage medium for automated testing of machine-run games
CN109815119B (en) APP link channel testing method and device
US20210385245A1 (en) Security system for detecting malicious actor's observation
CN110716853A (en) Test script recording method, application program testing method and related device
CN111190827A (en) Interface automation test method and device, storage medium and electronic equipment
CN110879781A (en) Program debugging method and device, electronic equipment and computer readable storage medium
CN110806965A (en) Automatic test method, device, equipment and medium
CN111654495B (en) Method, apparatus, device and storage medium for determining traffic generation source
CN114546881B (en) Application software testing method, electronic device and computer readable storage medium
CN106844219B (en) Application detection method and application detection device
CN116841865A (en) Visual test method and device, electronic equipment and storage medium
CN111694550A (en) Page display control method, device and system
CN114647572A (en) Method and system for software application component testing
CN111143650B (en) Method, device, medium and electronic equipment for acquiring page data
CN111414309A (en) Automatic test method of application program, computer equipment and storage medium

Legal Events

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