Unlock instant, AI-driven research and patent intelligence for your innovation.

Automatic testing method for page objects

A technology for automated testing and page objects, applied in software testing/debugging, error detection/correction, instrumentation, etc., to solve problems such as inconvenient maintenance and modification, poor readability of test programs, and difficulty in loading

Inactive Publication Date: 2018-06-19
商派软件有限公司
View PDF3 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] At present, when using webdriver for testing, there will be a time to locate the elements of a certain page, and the program lines are filled with id, name, xpath and other methods, which will cause poor readability of the test program and is not convenient for the later stage maintenance and modification
[0003] Although it is possible to make the program easier to understand by adding annotations, it cannot fundamentally solve the problem. At present, more methods are used to avoid direct calls to these methods each time by encapsulating these methods. Although reuse can be achieved, the logical processing of page elements and the independence of test data cannot be achieved through encapsulation
[0004] Constantly adding new tests, while rarely refactoring and using the original tests, Selenium's execution is relatively slow compared to unit tests. As the number of tests gradually increases, the running time will gradually increase to an unbearable level

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0038] In order to make the technical solutions of the present invention clearer and clearer to those skilled in the art, the present invention will be further described in detail below in conjunction with examples, but the embodiments of the present invention are not limited thereto.

[0039] A method for automated testing of page objects provided in this embodiment includes the following steps:

[0040] S1: Design each page as a Class;

[0041] S2: Obtain page elements by calling the page class in the Selenium test page;

[0042] S3: read test instructions from page elements;

[0043] S4: According to the test instruction, call the page code file of the page to be tested, and use the Class that does not perform the page element search operation to create a page object instance;

[0044] S5: call the page operation-related Class specified by the test instruction for testing the page object instance;

[0045] S6: Call the page element in the page operation-related Class to ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses an automatic testing method for page objects, and belongs to the technical field of page testing. The method comprises the steps of designing each page as a Class; acquiring page elements by calling a page class in a Selenium testing page; reading a testing instruction from the page elements; calling a page code file of a page to be tested, searching for an operated Class and creating a page object instance; calling a page operation related Class specified by the testing instruction; calling the page elements in the page operation related Class to find the correspondingpage elements; performing a page operation on the found page elements and obtaining a testing result. According to the method, each page is designed as a Class, the page elements are obtained by calling the page class in the Selenium testing page, and the situation that testing page codes need to be changed when the page element id or position is changed is avoided.

Description

technical field [0001] The invention relates to a page object automatic testing method, which belongs to the technical field of page testing. Background technique [0002] At present, when using webdriver for testing, there will be a time to locate the elements of a certain page, and the program lines are filled with id, name, xpath and other methods, which will cause poor readability of the test program and is not convenient for the later stage maintenance and modification. [0003] Although it is possible to make the program easier to understand by adding annotations, it cannot fundamentally solve the problem. At present, more methods are used to avoid direct calls to these methods each time by encapsulating these methods. Although reuse can be achieved, the logical processing of page elements and the independence of test data cannot be achieved through encapsulation. [0004] Constantly adding new tests, but rarely refactoring and using the original tests, Selenium's ex...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3684
Inventor 陶磊徐唤春裴大鹏
Owner 商派软件有限公司