CN109002389B - Method and device for automatically testing page - Google Patents

Method and device for automatically testing page Download PDF

Info

Publication number
CN109002389B
CN109002389B CN201710422503.1A CN201710422503A CN109002389B CN 109002389 B CN109002389 B CN 109002389B CN 201710422503 A CN201710422503 A CN 201710422503A CN 109002389 B CN109002389 B CN 109002389B
Authority
CN
China
Prior art keywords
page
application program
response
application server
version change
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
CN201710422503.1A
Other languages
Chinese (zh)
Other versions
CN109002389A (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 Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710422503.1A priority Critical patent/CN109002389B/en
Publication of CN109002389A publication Critical patent/CN109002389A/en
Application granted granted Critical
Publication of CN109002389B publication Critical patent/CN109002389B/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
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method and a device for automatically testing a page, which can ensure that the automatic page test does not depend on page elements for assertion any more, after the page is changed, the original automatic test case does not need to be maintained again, only a configuration file needs to be modified to shield the changed page structure part, and the old structure can still return, thereby realizing the automatic page test with high efficiency, wide application range and low maintenance cost. The method comprises the following steps: configuring a specified network request of a page to be tested; respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change; and receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, comparing, wherein if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed.

Description

Method and device for automatically testing page
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for automatically testing a page.
Background
Selenium is the open source automation tool that is the longest used in the current page automation test, and Selenium is the page automation test tool developed by ThoughtWorks corporation. The system can be operated on various platforms such as WINDOWS, LINUX, MAC and the like, can be constructed by various programming languages such as Java, C #, PERL, PHP and the like, and supports the test of a plurality of browsers.
In the technical scheme of the page automation test in the prior art, Selenium + Python or Selenium + Java is mostly used as a frame for page automation. The element is searched through the path or the attribute of the page element, and the existence and the correctness of the page element are predicated through the expected value of the configuration test case. Generally, a test case is used to assert an element of a page.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
1. at present, a Selenium + Python or Selenium + Java frame has high requirements on the construction of a page in a way of searching elements through the path or the attribute of the page element, and if the page is slightly adjusted or reconstructed, the specified element cannot be found by using the originally configured path and attribute. Therefore, the test case has high maintenance frequency, high maintenance cost and low flexibility;
2. if a plurality of elements of one page are verified, a plurality of test cases need to be configured, and the cost for compiling the test cases is high;
3. the page automation framework is not suitable for Web application version changing tests, and when the page automation framework meets the project, all cases need to be redone, but the request and the server end of the page are not changed, so that the waste of human resources can be caused.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for page automation test, so that the page automation test does not rely on page elements to make assertions, after a page is modified, an original automation test case does not need to be maintained again, only a configuration file needs to be modified to shield a modified page structure portion, and an old structure can still return, thereby implementing a page automation test with high efficiency, a wide application range, and a low maintenance cost.
To achieve the above object, according to an aspect of the embodiments of the present invention, a method for page automation test is provided.
The method for automatically testing the page comprises the following steps: configuring a specified network request of a page to be tested; respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change; and receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, comparing, wherein if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed.
Optionally, the method comprises: configuring a specified network request of a page to be tested by using Java codes; and calling the Java httpclient tool class to respectively send the specified network requests to the application server of the application program before the revision and the application server of the application program after the revision.
Optionally, the page to be tested includes one or more of the following: interface upgrading page, structure adjusting page and new function page.
Optionally, after receiving a reference response returned by the application server of the pre-revision application and a response to be compared returned by the application server of the post-revision application, the method further includes: and shielding newly added and/or changed parts in the page of the corresponding application program after version change, which are related in the response to be compared.
Optionally, the method further comprises: and shielding newly added and/or changed parts in the page of the corresponding re-versioned application program related in the response to be compared in a regular matching mode.
To achieve the above object, according to another aspect of the embodiments of the present invention, an apparatus for page automation test is provided.
The device for automatically testing the page provided by the embodiment of the invention comprises: the configuration module is used for configuring the specified network request of the page to be tested; the sending module is used for respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change; and the comparison module is used for receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, and comparing the reference response and the response to be compared, wherein if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed.
Optionally, the apparatus wherein: the configuration module is also used for configuring the specified network request of the page to be tested by using the Java code; and the sending module is also used for calling a Java httpclient tool class to respectively send the specified network request to the application server of the application program before the version change and the application server of the application program after the version change.
Optionally, the page to be tested includes one or more of the following: interface upgrading page, structure adjusting page and new function page.
Optionally, the apparatus further comprises: and the shielding module is used for shielding newly added and/or changed parts in the page of the corresponding application program after the version-changing, which are related in the response to be compared, after receiving the reference response returned by the application server of the application program before the version-changing and the response to be compared returned by the application server of the application program after the version-changing.
Optionally, the shielding module is further configured to: and shielding newly added and/or changed parts in the page of the corresponding re-versioned application program related in the response to be compared in a regular matching mode.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the method for testing the page automation of the embodiment of the invention.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements the method for automated testing of pages of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: because the technical means that the response of the application page before the edition modification is acquired through configuring the specified network request is directly used as a reference test case and the response of the page to be tested after the edition modification is compared is adopted, the technical problem that the specified element cannot be found by utilizing the originally configured path and attribute if the page is slightly adjusted or reconstructed is overcome, and further, the page automatic test does not depend on the page element to make assertion any more, even if the page element is modified, only the configuration file needs to be modified to shield the modified page structure part, the page automatic test can still return to the old structure, and the technical effect of large time maintenance does not need to be wasted; in addition, by using the technical scheme of the embodiment of the invention, a plurality of elements of one page are verified, even all elements and structures of the whole page are verified, and each element is not required to compile a test case, so that the flexibility of the test case is improved, the maintenance and compiling cost of the test case is reduced, and human resources are released; by using Java code to grab the appointed network request, the subsequent test of the page to be tested can be conveniently realized; after the response to be compared is obtained through the page to be tested with the adjusted structure or the added function, the response corresponding to the new function or the changed position of the page is shielded, so that whether the old function part of the page after the version change is tested successfully can be accurately determined; the corresponding response content is shielded by using a regular expression matching mode, so that response comparison is accurately realized, and regression testing is completed.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a method for automated testing of pages according to an embodiment of the invention;
FIG. 2 is a flowchart illustrating an exemplary method for automated testing of a page according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main modules of an apparatus for page automation testing according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The embodiment of the invention provides a technical scheme for the efficient and low-maintenance-cost page automation test of a Web application program, which can ensure that the page automation test does not depend on page elements to make assertion. After the page is modified, the original automatic Test Case (Test Case, i.e. Test Case, is a group of Test input, execution conditions and expected results compiled for a special target so as to Test a certain program path or verify whether a certain specific requirement is met) does not need to be maintained again, only the configuration file needs to be modified to shield the modified page structure part, and the regression Test can still be realized for the old structure; the technical scheme of the embodiment of the invention can also be suitable for checking a plurality of elements of one page, even checking all elements and structures of the whole page, thereby improving the flexibility of the test case, reducing the maintenance and compiling cost of the test case and releasing human resources.
Fig. 1 is a schematic diagram of main steps of a method for page automation testing according to an embodiment of the present invention.
As shown in fig. 1, a method for page automation test according to an embodiment of the present invention mainly includes the following steps:
step S101: and configuring the specified network request of the page to be tested. In the embodiment of the present invention, the page to be tested may include one or more of the following: interface upgrading page, structure adjusting page and new function page. By configuring the specified network request, the automatic test of the page after the edition change can be carried out according to the page test requirement. In the embodiment of the invention, the specified network configuration request can be a specified network request for configuring the page to be tested by using Java codes.
After the configuration of the specified network request is completed at step S101, the test is started from step S102.
Step S102: and respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change. As described above, in the embodiment of the present invention, the designated network request of the page to be tested may be configured by using Java code, and the sending of the designated network request may be separately sent to the application server of the application program before the version change and the application server of the application program after the version change by calling the httpparent tool class of Java.
Step S103: and receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, comparing, wherein if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed.
In the embodiment of the invention, by configuring the specified request of the page to be tested and respectively sending the specified network request (test input) to the application servers of the application programs before and after the version change, the reference response returned by the application server of the application program before the version change and the response to be compared (execution condition) returned by the application server of the application program after the version change are received and compared, if the response to be compared is consistent with the reference response (expected result), the test case is successful, and if the response to be compared is inconsistent with the reference response (expected result), the test case is failed.
It should be noted that, after receiving the reference response returned by the application server of the pre-versioning application program and the response to be compared returned by the application server of the post-versioning application program, the method for testing the page automation of the embodiment of the present invention may further include: and shielding newly added and/or changed parts in the page of the corresponding application program after version change, which are related in the response to be compared. The purpose of this step is that there may be newly added or changed places in the Web application page after the revision, and the changed places can be shielded when the Response is asserted, and only the old function and page before are asserted, so that the regression test can be accurately implemented.
In the embodiment of the invention, the changed place is shielded when the Response is asserted, and the newly added and/or changed part in the page of the corresponding modified application program related in the Response to be compared can be shielded in a regular matching mode.
Fig. 2 is a schematic flowchart of a method for testing page automation according to an embodiment of the present invention.
As shown in fig. 2, the specific process of the method for automatically testing a page according to the embodiment of the present invention is as follows:
first, a specified network request, such as a get request and/or a post request, to be fetched in a page to be tested is configured in a program (in an embodiment of the present invention, a program written by using Java code may be, but is not limited to this), where the specified network request is to be fetched in the page to be tested (generally, there may be many requests to access a Web application page). In the embodiment of the invention, the general test case is divided in such a way that one request of one page is taken as one test case, each page is taken as a base class, and all test cases in the class are executed circularly.
And then respectively sending configured get and/or post requests to two application servers where the Web application program before the edition and the Web application program after the edition are located through the httpparent tool class which can but is not limited to call Java, and capturing Response responses returned by the two application servers.
And finally comparing Response responses of the requests returned by the two application servers, and using the Response of the request returned before the edition change as a reference to assert whether the Response of the request returned after the edition change is correct or not.
If the test is only the test of the page interface upgrading class and does not relate to the page structure change, Response responses of the requests returned by the two application servers are completely consistent, the test case is calculated to be successful, otherwise the test case fails; if the test belongs to the test of the page structure adjustment class or the test of the page newly added function class, because the page structure may have adjustment, some Response responses returned by the request for obtaining the page structure may not be completely compared and consistent, but this may not be exactly the error, and at this time, some inconsistent conditions in the Response responses need to be shielded, so that the Response responses do not participate in the comparison (whether some results in the Response responses need to be shielded, so that the Response does not participate in the comparison, which can be realized through configuration or not), some parts of the test cases which are changed aiming at the new functions and/or parts of the structure change class are shielded through configuration, and only the regression test of the original functions corresponding to the application program before the change is performed. In the embodiment of the invention, the newly changed part in Response can be shielded through regular expression matching, the rest original energy parts corresponding to the application program before the edition change are compared and must be completely consistent to calculate that the test case is successful, otherwise, the test case fails to be executed.
According to the method for the page automatic test, disclosed by the embodiment of the invention, the technical means that the response of the application page before the edition modification is acquired through the configuration of the specified network request is directly used as a reference test case and the response of the page to be tested after the edition modification is compared is adopted, so that the technical problem that the specified element cannot be found by utilizing the originally configured path and attribute if the page is slightly adjusted or reconstructed is overcome, the page automatic test is not dependent on the page element for assertion, even if the page element is modified, only the configuration file is required to be modified to shield the modified page structure part, the old structure can still return, and a great amount of time is not wasted; in addition, by using the technical scheme of the embodiment of the invention, a plurality of elements of one page are verified, even all elements and structures of the whole page are verified, and each element is not required to compile a test case, so that the flexibility of the test case is improved, the maintenance and compiling cost of the test case is reduced, and human resources are released; by using Java code to grab the appointed network request, the subsequent test of the page to be tested can be conveniently realized; after the response to be compared is obtained through the page to be tested with the adjusted structure or the added function, the response corresponding to the new function or the changed position of the page is shielded, so that whether the old function part of the page after the version change is tested successfully can be accurately determined; the corresponding response content is shielded by using a regular expression matching mode, so that response comparison is accurately realized, and regression testing is completed.
Fig. 3 is a schematic diagram of main modules of an apparatus for page automation test according to an embodiment of the present invention.
As shown in fig. 3, the apparatus 300 for page automatic testing according to the embodiment of the present invention mainly includes the following modules: a configuration module 301, a sending module 302, and a comparison module 303.
The configuration module 301 is configured to configure a specified network request of a page to be tested; the sending module 302 is configured to send the specified network request to an application server of the pre-versioning application program and an application server of the post-versioning application program respectively; the comparison module 303 is configured to receive a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, and compare the reference response and the response to be compared, where if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed.
In the apparatus 300: the configuration module 301 can also be used for configuring the specified network request of the page to be tested by using the Java code; and the sending module 302 may be further configured to call a Java httpclient tool class to send the specified network request to the application server of the pre-versioned application and the application server of the post-versioned application, respectively.
In the embodiment of the invention, the page to be detected comprises one or more of the following: interface upgrading page, structure adjusting page and new function page.
Furthermore, the apparatus 300 may further comprise: and a shielding module (not shown in the figure), configured to shield, after receiving the reference response returned by the application server of the pre-revision application and the to-be-compared response returned by the application server of the post-revision application, a newly added and/or changed part in the page of the corresponding post-revision application related to the to-be-compared response.
It should be noted that the shielding module may also be used to: and shielding newly added and/or changed parts in the page of the corresponding re-versioned application program related in the response to be compared in a regular matching mode.
From the above description, it can be seen that, because the technical means of obtaining the response of the application page before the revision directly as the reference test case by configuring the specified network request and comparing the response of the page to be tested after the revision is adopted, the technical problem that the specified element cannot be found by using the originally configured path and attribute if the page is slightly adjusted or reconstructed is overcome, and further the page automation test is not dependent on the page element for assertion, even if the page element is changed, only the configuration file needs to be modified to shield the changed page structure part, the old structure can still return without wasting a lot of time for maintenance; in addition, by using the technical scheme of the embodiment of the invention, a plurality of elements of one page are verified, even all elements and structures of the whole page are verified, and each element is not required to compile a test case, so that the flexibility of the test case is improved, the maintenance and compiling cost of the test case is reduced, and human resources are released; by using Java code to grab the appointed network request, the subsequent test of the page to be tested can be conveniently realized; after the response to be compared is obtained through the page to be tested with the adjusted structure or the added function, the response corresponding to the new function or the changed position of the page is shielded, so that whether the old function part of the page after the version change is tested successfully can be accurately determined; the corresponding response content is shielded by using a regular expression matching mode, so that response comparison is accurately realized, and regression testing is completed.
Fig. 4 illustrates an exemplary system architecture 400 of a page automation test method or a page automation test apparatus to which embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 401, 402, 403. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for testing the page automation provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the device for testing the page automation is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a configuration module, a sending module, and a comparison module. The names of these modules do not in some cases form a limitation on the module itself, for example, a configuration module may also be described as a "module that configures a specific network request of a page to be tested".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: configuring a specified network request of a page to be tested; respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change; and receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, and comparing.
According to the technical scheme of the embodiment of the invention, because the technical means that the response of the application page before the edition modification is acquired through the configuration of the specified network request is directly used as the reference test case and the response of the page to be tested after the edition modification is compared is adopted, the technical problem that the specified element cannot be found by using the originally configured path and attribute if the page is slightly adjusted or reconstructed is overcome, and further the technical effects that the page automatic test does not depend on the page element to make the assertion any more, even if the page element is modified, only the configuration file needs to be modified to shield the modified page structure part, the old structure can still return, and a large amount of time is not wasted in maintenance are achieved; in addition, by using the technical scheme of the embodiment of the invention, a plurality of elements of one page are verified, even all elements and structures of the whole page are verified, and each element is not required to compile a test case, so that the flexibility of the test case is improved, the maintenance and compiling cost of the test case is reduced, and human resources are released; by using Java code to grab the appointed network request, the subsequent test of the page to be tested can be conveniently realized; after the response to be compared is obtained through the page to be tested with the adjusted structure or the added function, the response corresponding to the new function or the changed position of the page is shielded, so that whether the old function part of the page after the version change is tested successfully can be accurately determined; the corresponding response content is shielded by using a regular expression matching mode, so that response comparison is accurately realized, and regression testing is completed.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for page automation test is characterized by comprising the following steps:
configuring a specified network request of a page to be tested;
respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change;
receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, comparing, wherein if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed;
after receiving a reference response returned by the application server of the application program before the revision and a response to be compared returned by the application server of the application program after the revision, the method further comprises the following steps: and shielding newly added and/or changed parts in the page of the corresponding application program after version change, which are related in the response to be compared.
2. The method according to claim 1, characterized in that it comprises:
configuring a specified network request of a page to be tested by using Java codes; and
and calling the Java httpclient tool class to respectively send the specified network requests to the application server of the application program before the revision and the application server of the application program after the revision.
3. The method according to claim 1, wherein the page to be tested comprises one or more of the following: interface upgrading page, structure adjusting page and new function page.
4. The method of claim 1, further comprising: and shielding newly added and/or changed parts in the page of the corresponding re-versioned application program related in the response to be compared in a regular matching mode.
5. An apparatus for automated testing of pages, comprising:
the configuration module is used for configuring the specified network request of the page to be tested;
the sending module is used for respectively sending the specified network requests to an application server of the application program before the version change and an application server of the application program after the version change;
the comparison module is used for receiving a reference response returned by the application server of the application program before the version change and a response to be compared returned by the application server of the application program after the version change, comparing the reference response and the response, if the responses are consistent, the test case is successful, and if the responses are inconsistent, the test case is failed;
and the shielding module is used for shielding newly added and/or changed parts in the page of the corresponding application program after the version-changing, which are related in the response to be compared, after receiving the reference response returned by the application server of the application program before the version-changing and the response to be compared returned by the application server of the application program after the version-changing.
6. The apparatus of claim 5, wherein:
the configuration module is also used for configuring the specified network request of the page to be tested by using the Java code; and
the sending module is also used for calling a Java httpclient tool class to respectively send the specified network request to the application server of the application program before the version change and the application server of the application program after the version change.
7. The apparatus of claim 5, wherein the page to be tested comprises one or more of the following: interface upgrading page, structure adjusting page and new function page.
8. The apparatus of claim 5, wherein the shielding module is further configured to: and shielding newly added and/or changed parts in the page of the corresponding re-versioned application program related in the response to be compared in a regular matching mode.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201710422503.1A 2017-06-07 2017-06-07 Method and device for automatically testing page Active CN109002389B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710422503.1A CN109002389B (en) 2017-06-07 2017-06-07 Method and device for automatically testing page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710422503.1A CN109002389B (en) 2017-06-07 2017-06-07 Method and device for automatically testing page

Publications (2)

Publication Number Publication Date
CN109002389A CN109002389A (en) 2018-12-14
CN109002389B true CN109002389B (en) 2022-03-04

Family

ID=64573929

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710422503.1A Active CN109002389B (en) 2017-06-07 2017-06-07 Method and device for automatically testing page

Country Status (1)

Country Link
CN (1) CN109002389B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109889402B (en) * 2019-01-23 2021-03-12 北京字节跳动网络技术有限公司 Method and apparatus for generating information
CN110086692A (en) * 2019-05-14 2019-08-02 广州云智易物联网有限公司 A kind of automated testing method based on Internet of Things, device and computer equipment
CN110597585A (en) * 2019-08-19 2019-12-20 深圳壹账通智能科技有限公司 Application program page display method and device, computer equipment and storage medium
CN112579425B (en) * 2019-09-27 2024-05-10 腾讯科技(深圳)有限公司 Method, device and medium for testing applet method interface
CN112650682B (en) * 2020-12-28 2024-06-11 广州品唯软件有限公司 Page test processing method and device, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1658158A (en) * 2004-01-28 2005-08-24 微软公司 Method and system for masking dynamic regions in a user interface to enable testing of user interface consistency
CN101526916A (en) * 2008-03-03 2009-09-09 阿里巴巴集团控股有限公司 Method and system for using page-based object flow verification in regression test
CN102902619A (en) * 2011-07-29 2013-01-30 阿里巴巴集团控股有限公司 Method and device for regression testing of Web application programs
CN102932197A (en) * 2011-08-11 2013-02-13 阿里巴巴集团控股有限公司 Testing method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10001975B2 (en) * 2015-09-21 2018-06-19 Shridhar V. Bharthulwar Integrated system for software application development

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1658158A (en) * 2004-01-28 2005-08-24 微软公司 Method and system for masking dynamic regions in a user interface to enable testing of user interface consistency
CN101526916A (en) * 2008-03-03 2009-09-09 阿里巴巴集团控股有限公司 Method and system for using page-based object flow verification in regression test
CN102902619A (en) * 2011-07-29 2013-01-30 阿里巴巴集团控股有限公司 Method and device for regression testing of Web application programs
CN102932197A (en) * 2011-08-11 2013-02-13 阿里巴巴集团控股有限公司 Testing method and system

Also Published As

Publication number Publication date
CN109002389A (en) 2018-12-14

Similar Documents

Publication Publication Date Title
CN109002389B (en) Method and device for automatically testing page
CN109683998B (en) Internationalization realization method, device and system
CN110442524B (en) Method and device for testing web service interface with authentication authorization
CN109062563B (en) Method and device for generating page
CN109871311B (en) Method and device for recommending test cases
CN110895471A (en) Installation package generation method, device, medium and electronic equipment
CN110795331A (en) Software testing method and device
CN110928571A (en) Business program development method and device
CN112988583A (en) Method and device for testing syntax compatibility of database
CN110795328A (en) Interface testing method and device
CN110716956A (en) Data request intercepting method and device
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN111831536A (en) Automatic testing method and device
CN110443034B (en) Risk program file identification method and device, computing equipment and medium
CN112579151A (en) Method and device for generating model file
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN107247661B (en) Method and system for supporting automatic verification of installation package of application
CN113779122B (en) Method and device for exporting data
CN107766386B (en) Solr data migration method and device
CN110806967A (en) Unit testing method and device
CN111026629A (en) Method and device for automatically generating test script
CN112783903B (en) Method and device for generating update log
CN113448602A (en) Version updating method and device
CN113448652A (en) Request processing method and device
CN111176718A (en) Script online method and device, storage medium and electronic equipment

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