Automated Implementation of user experience testing-check the size of interface elements

Source: Internet
Author: User
Note: This article was first published in the ninth part of 51 testing world

Check the size of the Interface ElementIn User Experience and interface standardization tests, you also need to check whether the size of the interface elements meets certain specifications. For example, check whether the button size in all the dialog boxes is consistent, and check whether the length and height ratio of the control are appropriate. These can be checked in an automated way, as long as the length and width of the control can be obtained for automatic comparison. In qtp, you can use the getroproperty method to obtain the height and width attributes of the test object, as shown in the following Script: Height = Window ("Notepad "). getroproperty ("height") width = Window ("Notepad "). in general interface specifications, getroproperty ("width") may refer to aesthetic and coordination principles: the length and height are close to the ratio of the Golden Point, avoid out of proportion, or the height exceeds the length. Note: The golden section is the section of a line segment or the proportion of a geometric chart, especially in art design, the ratio of a small measurement to a large measurement and a large measurement to the whole is equal. The approximate ratio between two measurements is 3. : 5 .Based on this interface specification, you can use the following script to automate the check: 'defines the golden split ratio const goldensection = 0.6 window ("Notepad "). activate 'get the height of the test object Height = Window ("Notepad "). getroproperty ("height") 'obtains the width of the test object. width = Window ("Notepad "). getroproperty ("width") 'calculates the scale = height/width if scale> 1 then reporter. reportevent micfail, "the control height exceeds the length! "," Height: "& Height &", Length: "& widthend ifif scale = goldensection then reporter. reportevent micpass, "golden section", "The ratio of height to length of the control fully complies with the golden ratio! "End ifif scale> goldensection then reporter. reportevent micwarning, "golden section", "the ratio of the control height to the length is" & scale & ". The control height is too large and the length is too small, we recommend that you adjust it to meet the golden splitting ratio. "End ifif scale <goldensection then reporter. reportevent micwarning, "golden section", "the ratio of the control height to the length is" & scale & ". The control height is too small and the length is too large, we recommend that you adjust it to meet the golden splitting ratio. "The end if script design considers that if the height of the control is greater than its length, it is an error because it is not properly designed. If the ratio of height to length is equal to the Golden split ratio, it is checked. Of course, it is impossible to fully match the golden split ratio when designing the interface. Therefore, an error range can be defined. As long as the golden split ratio is basically met, this error range can be set when the interface specification is defined. For example, set the maximum value to 0.75 and the minimum value to 0.5. You can modify the script as follows: window ("Notepad "). activateset testobject = Window ("Notepad") 'Call the code checkgoldensection (testobject) 'to check the golden split ratio and encapsulate the code into the function checkgoldensection (testobject) 'optimum golden split ratio const goldensection = 100' maximum golden split ratio const goldensectionmax = 100' minimum value of the Golden split ratio const goldensectionmin = 100' get the height of the test object Height = testobject. getroproperty ("height") 'gets the width of the test object. width = testobject. getroproperty ("width ") 'Calculated scale = height/width if scale> 1 then reporter. reportevent micfail, "the control height exceeds the length! "," Height: "& Height &", Length: "& width exit function end if scale = goldensection then reporter. reportevent micpass, "golden section", "The ratio of height to length of the control fully complies with the golden ratio! "Exit function end if scale <= goldensectionmax and scale> = goldensectionmin then reporter. reportevent micpass," golden section "," the ratio of the control height to length is basically in prime proportion! "End if scale> goldensectionmax then reporter. reportevent micwarning, "golden section", "the ratio of the control height to the length is" & scale & ". The control height is too large and the length is too small, we recommend that you adjust it to meet the golden splitting ratio. "End if scale <goldensectionmin then reporter. reportevent micwarning, "golden section", "the ratio of the control height to the length is" & scale & ". The control height is too small and the length is too large, we recommend that you adjust it to meet the golden splitting ratio. "End ifend Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.