CN113220587A - Web interface compatibility testing method and device - Google Patents

Web interface compatibility testing method and device Download PDF

Info

Publication number
CN113220587A
CN113220587A CN202110613420.7A CN202110613420A CN113220587A CN 113220587 A CN113220587 A CN 113220587A CN 202110613420 A CN202110613420 A CN 202110613420A CN 113220587 A CN113220587 A CN 113220587A
Authority
CN
China
Prior art keywords
interface
execution result
tested
web
element information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110613420.7A
Other languages
Chinese (zh)
Inventor
伊冰静
张敏
罗学平
侯晓靓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202110613420.7A priority Critical patent/CN113220587A/en
Publication of CN113220587A publication Critical patent/CN113220587A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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

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 application provides a method and a device for testing Web interface compatibility, wherein the method for testing the Web interface comprises the following steps: executing a preset function to obtain an execution result interface of the tested interface and an execution result interface of the reference interface; respectively acquiring interface element information in an execution result interface of a tested interface and an execution result interface of a reference interface; when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring the position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively; and when the deviation of any interface element between the position data of the tested interface and the position data of the reference interface is within a preset deviation range, determining that the compatibility test result of the tested interface is successful. The method and the device can solve the problem of high cost in the existing Web interface compatibility test.

Description

Web interface compatibility testing method and device
Technical Field
The present application relates to testing technologies, and in particular, to a method and an apparatus for testing Web interface compatibility.
Background
The Web interface refers to a Web interface and can be opened directly through a browser. Nowadays, the variety of browsers is increasing, and meanwhile, each browser is continuously upgraded and updated, so that the Web interface needs to be compatible with different browsers. The test of the compatibility of the Web interface is an important process for ensuring that the Web interface can be normally used on various browsers.
The existing Web interface compatibility test method is generally a test method developed by a manual means. That is, the test results of the Web interface compatibility tests performed by each browser are recorded, and algorithm research is performed on a plurality of test results by adopting a manual method to analyze the Web interface compatibility. And the method for testing the compatibility of the Web interface also comprises the steps of storing screenshots of results of executing Web functions under different browsers, comparing and analyzing the screenshots of the browsers and then determining whether the compatibility test of the Web interface passes or not. However, the screenshot analysis method requires that interface elements (such as forms, boxes, radio buttons and the like) under different browsers are completely consistent, and if the interface elements are not consistent, the user experience is judged to be influenced. However, the position deviation of the interface elements on different browsers may not affect the user use, and at this time, manual intervention analysis is still required to remove the analysis result which does not affect the user use.
In summary, the existing methods for testing the compatibility of the Web interface have the problems of high labor cost, high time cost and the like.
Disclosure of Invention
The application provides a method and a device for testing Web interface compatibility, which are used for solving the problems of high labor cost, high time cost and the like of the conventional method for testing the Web interface compatibility.
In one aspect, the present application provides a method for testing compatibility of a Web interface, including:
executing a preset function to obtain an execution result interface of the tested interface and an execution result interface of the reference interface;
respectively acquiring interface element information in an execution result interface of the tested interface and an execution result interface of the reference interface, wherein the interface element information at least comprises names of interface elements;
when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively;
and when the deviation of any interface element between the position data of the interface to be tested and the position data of any interface element in the reference interface is within a preset deviation range, determining that the compatibility test result of the interface to be tested is successful.
In one embodiment, before the obtaining interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface respectively, the method further includes:
obtaining model similarity between a feature vector model of the tested interface and a feature vector model of a reference interface, wherein the feature vector model of the tested interface is established based on an execution result interface of the tested interface, and the feature vector model of the reference interface is established based on the execution result interface of the reference interface;
the step of respectively acquiring interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface comprises the following steps:
when the model similarity is greater than or equal to the preset similarity, respectively acquiring interface element information in an execution result interface of the tested interface and an execution result interface of the reference interface;
and when the model similarity is smaller than the preset similarity, determining that the compatibility test result of the tested interface is failure.
In one embodiment, the model similarity is a cosine similarity between the feature vector model of the measured interface and the feature vector model of the reference interface.
In one embodiment, the method further comprises the following steps:
determining an automatic execution script according to the execution result interface of the reference interface;
acquiring the preset function based on the automatic execution script;
the executing the preset function to obtain the execution result interface of the tested interface and the execution result interface of the reference interface comprises the following steps:
and running the automatic execution script to enable the tested interface to run the preset function to obtain an execution result interface of the tested interface.
In one embodiment, the method further comprises the following steps:
when the interface element information in the execution result interface of the tested interface is different from the interface element information in the execution result interface of the reference interface, or when the deviation between the position data of any one interface element in the tested interface and the position data of any one interface element in the reference interface is not within the preset deviation range;
and determining that the compatibility test result of the interface to be tested is failure.
In one embodiment, the interface element information in the execution result interface of the reference interface and the execution result interface of the tested interface is recorded in a DOM tree form, and the interface element information at least comprises the name of the interface element and the value of the interface element in the DOM tree.
In one embodiment, the measured interface and the reference interface have the same position reference point, and the position data of any one interface element in the measured interface and the reference interface are measured by the position reference point.
On the other hand, the present application provides a Web interface compatibility testing apparatus, including:
the acquisition module is used for executing a preset function to acquire an execution result interface of the tested interface and an execution result interface of the reference interface;
the acquisition module is further configured to acquire interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, respectively, where the interface element information at least includes names of interface elements;
the acquisition module is further configured to acquire position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface;
and the processing module is used for determining that the compatibility test result of the interface to be tested is successful when the deviation of any interface element between the position data of the interface to be tested and the position data of the interface to be tested is within a preset deviation range.
In another aspect, the present application provides a computer device, including a memory, a processor and a transceiver, where the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory, so that the computer device executes the Web interface compatibility testing method according to the first aspect.
In another aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the instructions are executed, the instructions cause a computer to execute the Web interface compatibility testing method according to the first aspect.
In another aspect, the present application provides a computer program product comprising a computer program, which when executed by a processor implements the Web interface compatibility testing method according to the first aspect.
According to the Web interface compatibility testing method, under the condition of no manual intervention, the tested interface and the reference interface are enabled to display the execution result interfaces executing the same preset function, interface element information in the execution result interfaces of the tested interface and the reference interface is obtained respectively, and the interface element information is compared. And if the interface element information is consistent, acquiring the position data of any one interface element or all interface elements in the execution result interface of the tested interface and the execution result interface of the reference interface respectively. And when the deviation of any one interface element or all interface elements between the position data of the tested interface and the position data of all interface elements in the reference interface is within the preset deviation range, determining that the compatibility test of the tested interface is successful. Therefore, the Web interface compatibility test method provided by the application does not need to manually analyze and compare the tested interface and the reference interface, saves a large amount of labor cost and time cost, and improves the efficiency of Web system compatibility test.
In addition, the method for testing the compatibility of the Web interface provided by the application can support a plurality of browsers to be tested to perform compatibility testing in sequence, and when the browsers to be tested perform compatibility testing in sequence, the automatic execution script described above only needs to be run on the browsers in sequence, and then the steps S210 to S240 are executed, so that the compatibility testing results of the interfaces to be tested can be obtained in sequence. Compared with the prior art, the method for testing the compatibility of the Web interface saves a large amount of labor cost and time cost when a plurality of interfaces to be tested are subjected to compatibility testing, and improves the efficiency of the compatibility testing of the Web system.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic view of an application scenario of the Web interface compatibility testing method provided by the present application.
Fig. 2 is a schematic flowchart of a method for testing Web interface compatibility according to an embodiment of the present application.
Fig. 3 is a schematic flowchart of a method for testing Web interface compatibility according to an embodiment of the present application.
Fig. 4 is a schematic flowchart of a Web interface compatibility testing method provided in the second embodiment of the present application.
Fig. 5 is a schematic diagram of a Web interface compatibility testing apparatus provided in the third embodiment of the present application.
Fig. 6 is a schematic diagram of a computer device according to a fourth embodiment of the present application.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terms referred to in this application are explained first:
a Web system: an application accessible via the Web. During access, a user can access the browser only without installing other software. A Web application is composed of various Web components (Web components) that accomplish a pending task, and exposes services to the outside through the Web. In practical application, a Web application is composed of multiple servlets, JSP pages, HTML files, image files, and the like, and all these components coordinate with each other to provide a complete set of services for users.
And (3) Web test: a process for performing functions in a Web system for the purpose of discovering errors in the Web system. The Web test comprises the contents of functionality test, compatibility test, usability test and the like.
And (3) Web compatibility testing: and verifying whether each function in the Web system can normally work under different browsers and different versions of the same browser.
Automated testing: automated testing is a process that translates human-driven test behavior into machine execution.
Automatic test case: an automated test case is automated code that is compiled based on the operational steps of a manual test case.
Web semantics-an information medium that can be understood by a computer and is formed by adding data information to a document to make it an information medium.
Semantic feature vector: a mathematical vector for data calculation is formed by converting the linguistic meaning of a text into a mathematical vector after feature extraction.
Interface elements: elements such as forms, radio buttons, check boxes, list boxes, input boxes, etc., which are shown on pages in the Web system.
Nowadays, the types of browsers on the market are more and more, and simultaneously, the versions used by the same browser in parallel are more and more due to the upgrading and updating of each browser at any time. For example, microsoft's IE browser includes versions of IE9, IE10, IE11, and the like. For a web system supporting a variety of browsers, it is necessary to perform compatibility testing for an increasing number of browsers. When a compatibility test of a Web system is performed, different browsers or different versions of the same browser need to be listed one by one, and then a full coverage test is performed for the same system function. The results of the test may indicate which browsers are supported by the system and which functions in the system have compatibility issues. And if the interface display results of the same system function in the Web system under different browsers are consistent, the compatibility test can be considered to be passed.
The test on the Web system can also be referred to as a test on a Web interface, which refers to a Web page interface of the Web system on a browser. Web systems typically have the same initial interface at different browsers, but may display different execution result interfaces after different browsers perform the same system function. As described above, if the final interface display result (execution result interface display result) is consistent, it can be considered that the Web system or the Web interface passes the compatibility test.
The existing Web interface compatibility test method (Web system compatibility test method) is generally a test method developed by manual means. That is, the test results of the Web interface compatibility tests performed by each browser are recorded, and algorithm research is performed on a plurality of test results by adopting a manual method to analyze the Web interface compatibility.
The development of Web interface compatibility tests using manual means requires the same operations to be performed under a plurality of different browsers. A large number of repetitive manual operations are required to perform the same operations, which are unavoidable even if the browser data set or the like to be tested is reduced by means of different algorithms. This causes the problem that the manual means for performing the Web interface compatibility test has too high labor cost and time cost. These reduced browser data sets are generally considered error-free by default and no longer need to be analyzed, but in practice these reduced browser data sets cannot be determined to be error-free by one hundred percent. This results in the problem that the Web interface compatibility test by manual means is inaccurate in test result.
And the method for testing the compatibility of the Web interface comprises the steps of storing screenshots of execution result interfaces for executing the Web functions under different browsers, and then comparing and analyzing the screenshots of all the browsers so as to analyze the compatibility of the Web interface.
However, the screenshot analysis method requires that interface elements (such as forms, boxes, radio buttons and the like) under different browsers are completely consistent, and if the interface elements are not consistent, the user experience is judged to be influenced. However, the position deviation of the interface elements on different browsers may not affect the user use, and at this time, manual intervention analysis is still required to remove the analysis result which does not affect the user use.
In summary, the existing methods for testing the compatibility of the Web interface have the problems of high labor cost, high time cost and the like.
Based on this, the application provides a method for testing compatibility of a Web interface, so that a reference browser and other browsers execute the same Web function and then display an execution result interface, and then the execution result interfaces of the other browsers are analyzed based on the execution result interface of the reference interface (the interface of the Web system in the reference browser) to determine whether the compatibility of the Web interface is successful or not. Specifically, the computer device analyzes interface elements, positions of the interface elements, and the like of the execution result interfaces of the other browsers based on the execution result interface of the reference interface. And if the interface elements are the same and the positions of the interface elements are not different greatly, determining that the compatibility test of the Web interface on the other browsers is passed. According to the Web interface compatibility testing method, manual intervention is not needed for Web interface compatibility analysis, and all testing programs are completed by a computer, so that a large amount of labor cost and time cost are reduced, and the problems of inaccurate analysis results and the like caused by manual analysis are avoided.
The Web interface compatibility testing method is applied to computer equipment such as a computer, a server, a tablet computer, a mobile phone and the like. Fig. 1 is an application schematic diagram of the Web interface compatibility testing method provided in the present application, where at least two types of browsers or at least two types of browsers with different versions are provided on a computer device. The method includes the steps that a reference browser is arranged in a plurality of browsers on the computer device, the reference browser firstly conducts compatibility test on a certain function of the Web system, and an automatic test case (automatic execution script) is generated after the compatibility test of the certain function is completed. When the automatic execution script is applied to other browsers, the other browsers can also operate aiming at the certain function, and finally an execution result interface corresponding to the certain function is generated.
Referring to fig. 2, an embodiment of the present application provides a method for testing Web interface compatibility, including:
and S210, executing a preset function to obtain an execution result interface of the tested interface and an execution result interface of the reference interface.
The reference interface refers to a display interface of the Web system on a main browser, the main browser is also a reference browser, the tested interface refers to a display interface of the Web system on a tested browser, and the tested browser is a browser which the Web system wants to perform compatibility testing. Assuming that the IE9 browser of the IE browser is the reference browser and it is desired to test the compatibility of the Web system on the IE10 browser, the IE10 browser is the tested browser of this embodiment, and the initial display interface of the Web system on the IE10 is the tested interface.
The Web system includes many system functions, and the preset function may be a system function in the Web system. For example, the Web system is a business processing system used by a bank, the preset function is a user login function, and the reference interface and the tested interface can be understood as a user login interface. At this time, the execution result interface of the reference interface and the execution result interface of the tested interface are user login result interfaces, and interface elements on the user login result interface include a user identity information form, an account information form, a business handling box and the like.
Optionally, the automated execution script may be recorded and stored when the main browser runs a preset function on the Web interface. When the automation execution script is generated, an interface element displayed when the main browser runs a preset function on the Web interface can be selected as a check point of the automation execution script. Through the setting of the check point, the automation execution script can be specified to run so that the tested interface executes the preset function.
That is, when performing the compatibility test of the interface to be tested (the compatibility test of the browser to be tested), the automatic execution script may be determined according to the execution result interface of the reference interface, and the preset function may be obtained based on the automatic execution script. And then the automatic execution script is operated when the reference browser is opened, so that the preset function can be operated on the interface to be tested, and an execution result interface of the interface to be tested is obtained.
And S220, respectively acquiring interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, wherein the interface element information at least comprises the name of an interface element.
As described in step S210, interface elements in the execution result interface of the tested interface and the execution result interface of the reference interface are, for example, a user identity information form, an account information form, a business handling box, and the like. The interface element information includes at least a name of the interface element, such as "user identity information", "account information", "business transaction", and the like.
Optionally, the interface element information in the execution result interface of the reference interface and the execution result interface of the interface to be tested are both recorded in the form of a DOM tree, and at this time, the interface element information at least includes the name of the interface element and the value of the interface element in the DOM tree. The DOM tree used for recording the interface element information in the execution result interface of the reference interface can be called a reference DOM tree or a reference DOM tree, and the DOM tree used for recording the interface element information in the execution result interface of the tested interface is called a tested DOM tree. When the interface element information corresponding to the reference interface is compared with the interface element information corresponding to the detected interface, the interface element information in the reference DOM tree and the interface element information in the detected DOM tree can be compared.
And S230, when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring the position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively.
The interface element information in this step is the same, which means that the information of all interface elements in the execution result interface of the tested interface is the same as the information of all interface elements in the execution result interface of the reference interface. The condition that the interface element information is the same at least comprises that the names of the interface elements are the same. When the interface element information is recorded in a DOM tree form, the interface element information is the same, and at least comprises the same name of the interface element and the same value of the interface element in the DOM tree.
Wherein, the any interface element refers to any interface element in all interface elements in the tested interface. However, in an actual test, in order to obtain a more accurate test result, the position data of all interface elements in the interface to be tested may be obtained, and the position data of all interface elements in the reference interface may be obtained. And comparing the position data of all the interface elements in the tested interface with the position data of all the interface elements in the reference interface, and if the deviation of the position data of all the interface elements in the tested interface and the position data of all the interface elements in the reference interface are within the preset deviation range, determining that the compatibility test result of the tested interface is successful.
And after judging and determining that the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring the position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively. The positional data refers to two-dimensional positional information of the interface element relative to a positional reference point, the measured interface and the reference interface having the same positional reference point. The position data of any interface element in the measured interface and the reference interface are measured by the position datum point. The position data is two-dimensional position data, and the position reference point can be set according to actual needs, which is not limited in the application.
And when the interface element information in the execution result interface of the tested interface is different from the interface element information in the execution result interface of the reference interface, the compatibility test result of the tested interface can be determined to be failure or failure, and the position data of any interface element is not acquired at this time.
Optionally, all interface element position data in the execution result interface of the tested interface and all interface element position data in the execution result interface of the reference interface are recorded in the form of a DOM tree. As described in step S220, all interface element position data in the execution result interface of the reference interface may be recorded in the reference DOM tree, and all interface element position data in the execution result interface of the tested interface may be recorded in the tested DOM tree.
S240, when the deviation of the position data of any interface element in the tested interface and the reference interface is within a preset deviation range, determining that the compatibility test result of the tested interface is successful.
The preset deviation range can be understood as a preset data deviation range and can be set according to actual needs. As described in association with step S230, the position data is two-dimensional position data. For example, the coordinate units of the X-axis and the Y-axis are centimeters (cm) with the X-axis as the horizontal axis and the Y-axis as the vertical axis. The position data of the position reference point may be recorded as (0, 0), the position data of the arbitrary interface element in the execution result interface of the reference interface is, for example, (2, 3), and the position data of the arbitrary interface element in the execution result interface of the tested interface is, for example, (2.2, 3). If the preset deviation range is that the X axis floats up and down by 0.5 cm, the compatibility test result of the Web system on the tested interface can be determined to be successful and passed.
And when the deviation of the position data of any interface element in the tested interface and the reference interface is not within the preset deviation range, determining that the compatibility test result of the tested interface is failure and failure. For example, if the preset deviation range is that the X axis fluctuates by 0.5 cm up and down, the position data of any interface element in the execution result interface of the reference interface is (2, 3), and the position data of any interface element in the execution result interface of the tested interface is (2.7, 3), it may be determined that the compatibility test result of the tested interface is failure or failed.
In summary, in the Web interface compatibility testing method provided in this embodiment, under the condition of no manual intervention, the tested interface and the reference interface are made to display the execution result interfaces executing the same preset function, interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface is respectively obtained, and the interface element information is compared. And if the interface element information is consistent, acquiring the position data of any one interface element or all interface elements in the execution result interface of the tested interface and the execution result interface of the reference interface respectively. And when the deviation of any one interface element or all interface elements between the position data of the tested interface and the position data of all interface elements in the reference interface is within the preset deviation range, determining that the compatibility test of the tested interface is successful. Therefore, the method for testing the compatibility of the Web interface provided by the embodiment does not need to manually analyze and compare the tested interface and the reference interface, saves a large amount of labor cost and time cost, and improves the efficiency of the compatibility test of the Web system. And comparing and analyzing all interface element information and all interface element position data in the tested interface with all interface element information and all interface element position data in the reference interface, so that the result of the compatibility test of the Web system is more accurate, and the problem of large error of the test result caused by manual comparison and analysis is avoided.
In addition, the method for testing compatibility of a Web interface provided in this embodiment may support multiple browsers to be tested to perform compatibility testing in sequence, and when performing compatibility testing in sequence for multiple browsers to be tested, only the above-described automated execution script needs to be run on the multiple browsers in sequence, and then step S210 to step S240 are executed, so that compatibility testing results of multiple interfaces to be tested may be obtained in sequence. Compared with the prior art, the method for testing the compatibility of the Web interface provided by the embodiment saves a large amount of labor cost and time cost when a plurality of interfaces to be tested are subjected to compatibility testing, and improves the efficiency of the compatibility testing of the Web system.
Referring to fig. 3, in an alternative embodiment, when the interface element information and the position data of the interface element are both stored in the form of a DOM tree, after the execution result interfaces of the tested interface and the reference interface are obtained in step S210, steps S220 to S240 may be replaced by the following steps:
s310, acquiring an interface element i in the reference DOM tree.
As described in the first embodiment, the reference DOM tree is the DOM tree corresponding to the reference interface. The interface element i is an interface element in the execution result interface of the reference interface.
S320, judging whether the interface element i exists in the DOM tree to be tested, and determining that the compatibility test result of the interface to be tested is failure when the interface element i does not exist in the DOM tree to be tested.
As described in the first embodiment, the DOM tree under test is the DOM tree corresponding to the interface under test, and determining whether the interface element i exists in the DOM tree under test is to determine whether the interface element in the interface under test is the same as the interface element in the reference interface.
S330, when the interface element i exists in the detected DOM tree, determining the interface element i existing in the DOM tree as an interface element j.
That is, the interface element i and the interface element j are interface elements with the same content, the interface element i exists in the reference DOM tree, and the interface element j exists in the measured DOM tree.
S340, judging whether the value of the interface element i is equal to the value of the interface element j.
The value of the interface element i refers to the value of the interface element i in the reference DOM tree, and the value of the interface element j refers to the value of the interface element j in the measured DOM tree.
And S350, when the value of the interface element i is equal to the value of the interface element j, judging whether the position data of the interface element i is equal to the position data of the interface element j, and when the position data of the interface element i is equal to the position data of the interface element j, determining that the compatibility test of the tested interface is successful.
For the related description of the position data, reference may be made to the related description in the first embodiment, and details are not repeated here.
S360, when the position data of the interface element i is not equal to the position data of the interface element j, judging whether the difference between the position data of the interface element i and the position data of the interface element j is within a preset deviation range, and when the difference between the position data of the interface element i and the position data of the interface element j is within the preset deviation range, determining that the compatibility test of the tested interface is successful.
The description related to step S360 may refer to the description related to step S240 in the embodiment. The interface element i may refer to any one interface element in the execution result interface of the reference interface, or may refer to all interface elements in the execution result interface of the reference interface. Preferably, when the interface element i refers to all interface elements in the execution result interface of the reference interface, the compatibility test result for the interface to be tested is more accurate.
Referring to fig. 4, a second embodiment of the present application provides a method for testing Web interface compatibility, including:
s410, obtaining model similarity between a feature vector model of the tested interface and a feature vector model of a reference interface, wherein the feature vector model of the tested interface is established based on an execution result interface of the tested interface, and the feature vector model of the reference interface is established based on the execution result interface of the reference interface.
When the feature vector model of the tested interface and the feature vector model of the reference interface are established, the feature vector model can be established by extracting the feature words of the interface. The interface feature words may be feature words having a title (title), a button (btn), a text box (input), and texts (h 1-h 5, div) as contents. However, the interface feature word does not include script (script) content, because the script content often appears in various interfaces, which affects the judgment of the similarity of the model.
When the feature vector model of the tested interface is established, if a certain interface feature word, such as a text box, appears in the execution result interface of the tested interface, the feature value of the interface feature word of the text box is 1, and if the text box does not appear, the feature value of the interface feature word of the text box is 0. Similarly, when the feature vector model of the reference interface is established, if an interface feature word, such as a text box, appears in the execution result interface of the reference interface, the feature value of the interface feature word of the text box is 1, and if no text box appears, the feature value of the interface feature word of the text box is 0. The feature vector model can also be understood as a model established based on semantic feature vectors of Web semantics, and the similarity of the model can also be understood as the similarity of Web semantics.
S420, when the model similarity is greater than or equal to the preset similarity, executing the step S430.
Optionally, the model similarity may be a cosine similarity between the feature vector model of the measured interface and the feature vector model of the reference interface, and may also be understood as a cosine similarity between the Web semantics of the measured interface and the Web semantics of the reference interface.
OptionalCan be according to a formula
Figure BDA0003096517740000111
The model similarity is determined. Wherein Sim (X, Y) represents the model similarity, Cos (X, Y) represents the cosine similarity, c (X) represents the feature vector model of the measured interface, and c (Y) represents the feature vector model of the reference interface.
The value of the model similarity can be set according to actual needs, and the method is not limited in the application. And when the model similarity is smaller than the preset similarity, determining that the compatibility test result of the tested interface is failed or failed.
And S430, respectively acquiring interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, wherein the interface element information at least comprises names of interface elements.
And S440, when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring the position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively.
S450, when the deviation of the position data of any interface element in the tested interface and the reference interface is within a preset deviation range, determining that the compatibility test result of the tested interface is successful.
For the related description of step S430 to step S450, reference may be made to the related description of step S220 to step S240 in the first embodiment, and details are not repeated here.
Compared with the method for testing the compatibility of the Web interface provided in the first embodiment, the method for testing the compatibility of the Web interface provided in the first embodiment increases model similarity calculation of the feature vector models of the tested interface and the reference interface when testing the compatibility of the Web interface. If the model similarity is greater than or equal to the preset similarity, the interface element information and the interface element position data of the detected interface and the reference interface can be further compared. Compared with the method for testing the compatibility of the Web interface provided in the first embodiment, the method for testing the compatibility of the Web interface provided in the first embodiment can further improve the accuracy of the compatibility test of the Web interface.
Referring to fig. 5, a third embodiment of the present application further provides a Web interface compatibility testing apparatus 10, including:
the acquisition module 11 is configured to execute a preset function to acquire an execution result interface of the interface to be tested and an execution result interface of the reference interface;
the obtaining module 11 is further configured to obtain interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, respectively, where the interface element information at least includes names of interface elements;
optionally, the interface element information in the execution result interface of the reference interface and the execution result interface of the tested interface is recorded in a DOM tree form, and the interface element information at least includes the name of the interface element and the value of the interface element in the DOM tree.
The obtaining module 11 is further configured to obtain, when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface, respectively;
optionally, the measured interface and the reference interface have the same position reference point, and the position data of any one interface element in the measured interface and the reference interface are measured by the position reference point.
And the processing module 12 is configured to determine that the compatibility test result of the interface under test is successful when a deviation between the position data of the any interface element in the interface under test and the position data of the any interface element in the reference interface is within a preset deviation range.
The obtaining module 11 is further configured to obtain a model similarity between a feature vector model of the tested interface and a feature vector model of a reference interface, where the feature vector model of the tested interface is established based on the execution result interface of the tested interface, and the feature vector model of the reference interface is established based on the execution result interface of the reference interface.
The obtaining module 11 is further configured to obtain interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface respectively when the model similarity is greater than or equal to the preset similarity.
The processing module 12 is further configured to determine that the compatibility test result of the interface to be tested is a failure when the model similarity is smaller than the preset similarity.
The model similarity is a cosine similarity between the feature vector model of the measured interface and the feature vector model of the reference interface.
The processing module 12 is further configured to determine an automated execution script according to the execution result interface of the reference interface.
The obtaining module 11 is further configured to obtain the preset function based on the automation execution script.
The Web interface compatibility testing apparatus 10 further includes:
and the running module 13 is configured to run the automatic execution script, so that the interface to be tested runs the preset function, and an execution result interface of the interface to be tested is obtained.
The processing module 11 is further configured to, when the interface element information in the execution result interface of the tested interface is different from the interface element information in the execution result interface of the reference interface, or when the deviation between the position data of the any one interface element in the tested interface and the position data of the any one interface element in the reference interface is not within the preset deviation range; and determining that the compatibility test result of the interface to be tested is failure.
Referring to fig. 6, a fourth embodiment of the present application further provides a computer device 20, which includes a memory 21, a processor 22 and a transceiver 23, where the memory 21 is used to store instructions, the transceiver 23 is used to communicate with other devices, and the processor 22 is used to execute the instructions stored in the memory 21, so that the terminal device 20 executes the Web interface compatibility testing method provided in the first embodiment to the second embodiment.
The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the instructions are executed, the computer-executable instructions are executed by a processor to implement the Web interface compatibility testing method provided in any one of the above embodiments.
The computer-readable storage medium may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a magnetic Random Access Memory (FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical Disc, or a Compact Disc Read-Only Memory (CD-ROM). And may be various electronic devices such as mobile phones, computers, tablet devices, personal digital assistants, etc., including one or any combination of the above-mentioned memories.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method described in the embodiments of the present application.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (11)

1. A Web interface compatibility testing method is characterized by comprising the following steps:
executing a preset function to obtain an execution result interface of the tested interface and an execution result interface of the reference interface;
respectively acquiring interface element information in an execution result interface of the tested interface and an execution result interface of the reference interface, wherein the interface element information at least comprises names of interface elements;
when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface, acquiring position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively;
and when the deviation of any interface element between the position data of the interface to be tested and the position data of any interface element in the reference interface is within a preset deviation range, determining that the compatibility test result of the interface to be tested is successful.
2. The method according to claim 1, wherein before the obtaining interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, respectively, further comprises:
obtaining model similarity between a feature vector model of the tested interface and a feature vector model of a reference interface, wherein the feature vector model of the tested interface is established based on an execution result interface of the tested interface, and the feature vector model of the reference interface is established based on the execution result interface of the reference interface;
the step of respectively acquiring interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface comprises the following steps:
when the model similarity is greater than or equal to the preset similarity, respectively acquiring interface element information in an execution result interface of the tested interface and an execution result interface of the reference interface;
and when the model similarity is smaller than the preset similarity, determining that the compatibility test result of the tested interface is failure.
3. The method of claim 2, wherein the model similarity is a cosine similarity between the feature vector model of the measured interface and the feature vector model of the reference interface.
4. The method of claim 1, further comprising:
determining an automatic execution script according to the execution result interface of the reference interface;
acquiring the preset function based on the automatic execution script;
the executing the preset function to obtain the execution result interface of the tested interface and the execution result interface of the reference interface comprises the following steps:
and running the automatic execution script to enable the tested interface to run the preset function to obtain an execution result interface of the tested interface.
5. The method of any of claims 1 to 4, further comprising:
when the interface element information in the execution result interface of the tested interface is different from the interface element information in the execution result interface of the reference interface, or when the deviation between the position data of any one interface element in the tested interface and the position data of any one interface element in the reference interface is not within the preset deviation range;
and determining that the compatibility test result of the interface to be tested is failure.
6. The method according to any one of claims 1 to 4, wherein interface element information in the execution result interface of the reference interface and the execution result interface of the tested interface are both recorded in a DOM tree form, and the interface element information at least includes names of interface elements and values of the interface elements in the DOM tree.
7. The method according to any one of claims 1 to 4, wherein the measured interface and the reference interface have the same position reference point, and the position data of any one interface element in the measured interface and the reference interface are measured by the position reference point.
8. A Web interface compatibility testing device is characterized by comprising:
the acquisition module is used for executing a preset function to acquire an execution result interface of the tested interface and an execution result interface of the reference interface;
the acquisition module is further configured to acquire interface element information in the execution result interface of the tested interface and the execution result interface of the reference interface, respectively, where the interface element information at least includes names of interface elements;
the acquisition module is further configured to acquire position data of any one interface element in the execution result interface of the tested interface and the execution result interface of the reference interface respectively when the interface element information in the execution result interface of the tested interface is the same as the interface element information in the execution result interface of the reference interface;
and the processing module is used for determining that the compatibility test result of the interface to be tested is successful when the deviation of any interface element between the position data of the interface to be tested and the position data of the interface to be tested is within a preset deviation range.
9. A computer device comprising a memory for storing instructions, a processor and a transceiver for communicating with other devices, the processor being configured to execute the instructions stored in the memory to cause the computer device to perform the Web interface compatibility testing method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored therein, which when executed, cause a computer to perform the Web interface compatibility testing method of any one of claims 1-7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, carries out the Web interface compatibility testing method according to any one of claims 1 to 7.
CN202110613420.7A 2021-06-02 2021-06-02 Web interface compatibility testing method and device Pending CN113220587A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110613420.7A CN113220587A (en) 2021-06-02 2021-06-02 Web interface compatibility testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110613420.7A CN113220587A (en) 2021-06-02 2021-06-02 Web interface compatibility testing method and device

Publications (1)

Publication Number Publication Date
CN113220587A true CN113220587A (en) 2021-08-06

Family

ID=77082829

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110613420.7A Pending CN113220587A (en) 2021-06-02 2021-06-02 Web interface compatibility testing method and device

Country Status (1)

Country Link
CN (1) CN113220587A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528297A (en) * 2016-01-29 2016-04-27 广州酷狗计算机科技有限公司 Method and device for testing web page
CN107678937A (en) * 2017-07-26 2018-02-09 上海壹账通金融科技有限公司 Page compatibility detection method, device, server and medium
CN108536597A (en) * 2018-04-11 2018-09-14 上海达梦数据库有限公司 A kind of terminal test method, device, terminal device and storage medium
CN108829583A (en) * 2018-05-24 2018-11-16 广东睿江云计算股份有限公司 A kind of page compatibility test method and device based on Selenium
CN112286821A (en) * 2020-11-03 2021-01-29 深圳壹账通智能科技有限公司 HTML5 page compatibility testing method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528297A (en) * 2016-01-29 2016-04-27 广州酷狗计算机科技有限公司 Method and device for testing web page
CN107678937A (en) * 2017-07-26 2018-02-09 上海壹账通金融科技有限公司 Page compatibility detection method, device, server and medium
CN108536597A (en) * 2018-04-11 2018-09-14 上海达梦数据库有限公司 A kind of terminal test method, device, terminal device and storage medium
CN108829583A (en) * 2018-05-24 2018-11-16 广东睿江云计算股份有限公司 A kind of page compatibility test method and device based on Selenium
CN112286821A (en) * 2020-11-03 2021-01-29 深圳壹账通智能科技有限公司 HTML5 page compatibility testing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110851351A (en) Deployment environment testing method and device, computer equipment and storage medium
CN110866258A (en) Method for quickly positioning bug, electronic device and storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN116245074A (en) Chip verification method, device and storage medium
CN110096442B (en) Code debugging method, user equipment, storage medium and device
CN114121153A (en) Gene mutation site detection method, device, electronic equipment and storage medium
CN113434395A (en) Automatic generation method, device, equipment and medium of test case
CN112905451A (en) Automatic testing method and device for application program
CN112216337A (en) Firmware parameter detection method and device and firmware setting method
CN109684205B (en) System testing method, device, electronic equipment and storage medium
CN113220587A (en) Web interface compatibility testing method and device
CN109426702B (en) iOS platform file reading protection method, storage medium, electronic device and system
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
CN115543816A (en) Software regression test result verification method, device, equipment and storage medium
CN115563008A (en) Code coverage rate detection system, method, device and storage medium
CN110968500A (en) Test case execution method and device
CN111400245B (en) Art resource migration method and device
CN110633204B (en) Program defect detection method and device
CN112667502A (en) Page testing method, device and medium
CN112463630A (en) Version difference testing method and device, computer equipment and storage medium
CN110704483A (en) User routing process positioning method, device, storage medium and device
CN113836037B (en) Interface interaction testing method, device, equipment and storage medium
CN111813757B (en) Characteristic information storage method, device, equipment and readable storage medium
CN111611153B (en) Method and device for detecting overdrawing of user interface
JPWO2020065804A1 (en) Eligibility automatic judgment system

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