WEB smart positioning software elements of automated testing tools

 Rivers and lakes has been so famously said, " martial arts world, only the fast is not broken ." So in the field of software testing, we naturally think of software test automation. Implement automated software testing tool for automated testing software is inseparable from nature. Software test automation software automation tools are carriers only through the tool, we can achieve. Martial arts is the same, to become martial guise, in addition to the secret martial arts, but also in accordance with the Sword, Tulong Dao.

    Saying software development models are: waterfall model, incremental development, spiral development, agile development. Early software industry development model based mainly in the waterfall model, then gradually specifically for agile development. Software development efficiency and change the frequency changes with the development model of change, gifted it to the agile development model. Some traditional automated testing tool shows powerless, it is difficult to cope with rapid change and iterative software development, leading some companies to carry out automated testing, to no avail. The main reasons are: building automation patients with slow to keep up with new content software; software changes frequently lead to huge cost to maintain the use cases; the high cost of learning. All these are the main reason for automated testing software industry in China is difficult achievements.

     Automated software testing tools Workflow: New use cases -> debug use cases -> use case line execution -> results -> Output Report -> Maintenance use cases. Where: New use cases and use case maintenance is consuming the largest amount of work. The introduction of agile development model, resulting in maintenance work is greatly improved, even once there are more than the workload of the new trends in the use case, which has been plagued by a headache for software test automation.

    Automated maintenance session, the positioning element failure is a major cause of the use cases. Here we look at some of the common elements of automation tools positioning principle:

1, selenium sample positioning element

 Python + selenium following is a sample use case, the operation of the elements of the element's id-based

 from selenium import webdriver
 url = "http://10.98.110.44/egov-portal/egov/shIndex.html"
 # Open the browser, the browser is maximized
 driver = webdriver.Chrome()
 driver.get( url )
 driver.implicitly_wait( 10 )
 driver.maximize_window()
 #Enter the account number
 driver.find_element_by_id("username").send_keys(“zhangsan")
 #enter password
 driver.find_element_by_id("password").send_keys("ww1234")
 Click the Login button #
 driver.find_element_by_id("submitButton").click()

 2, robotFramwork + seleniuLibrary sample positioning element

3, UFT positioning the tool element method Sample

Dialog("Login").WinEdit("AgentName:").Set "mercury"
Dialog("Login_2").WinButton("Help").Click
Dialog("Login_2").Dialog("FlightReservations").Static("The password is 'MERCURY'").CheckCheckPoint("The password is 'MERCURY'")
Dialog("Login_2").Dialog("FlightReservations").WinButton("确定").Click
Dialog("Login").WinButton("OK").Click
Window("FlightReservation").Activate
Window("FlightReservation").ActiveX("MaskEdBox").Type "102715"
# Select Date
Window("Flight Reservation").WinComboBox("FlyFrom:").Select "Frankfurt"

 I see from the above information, the positioning elements are positioning element through the property, element attributes are the following eight species:

  1、id定位: driver.find_element_by_id("kw")

 2、name定位: driver.find_element_by_name("wd")

 3、class定位: driver.find_element_by_class_name("s_ipt")

 4、tag定位:driver.find_element_by_tag_name("input")

 5, link positioning: driver.find_element_by_link_text ( "News")

 6、partial_link定位:driver.find_element_by_partial_link_text()

 7、xpath定位: driver.find_element_by_xpath("/html/body/div[2]/div/form/div/input")

 8, CSS positioning: driver.find_element_by_css_selector

In conventional automated software which are positioned in a way that eight of positioning elements. Now that calm realistic test environment is often not our imagination. id, name, tag duplicate many pages appear. Perhaps we write use cases are not repeated, after a revised version is likely to become repeat. xpath is least likely to fail, but often because of changes in the parent node and lead to failure is common. So automation designers weighed down for maintenance cases, the workload is very great.

4, intelligent positioning elements

 kylinTOP software, support smart positioning elements, I went to study a little more interested in the software use cases primarily generated by recording, recording generate some visual script as follows:

 The figure is the button steps, the steps recorded in a number of properties of the button: title | alt, src, border , alt, xpath information and its children. Some properties are not unique positioning elements (there are duplicate page), such as: border. kylinTOP record all the identity information button elements. When I try to modify the title page code | alt value of the title page | alt values are repeated. When the script playback, it can still operate normally. Recovery title | alt value, repeat the above steps amend, modify other attribute values one by one, still does not affect the script. By testing found that the Modify button does not affect any property script execution.

   By reading the information on the official website, said positioning elements are targeted based on a series of attributes of the element, does not rely on a certain property, take an element of intelligent positioning algorithm. In the field of software test automation, positioning elements kylinTOP indeed a breed apart, greatly improving the stability automated execution cases, saving maintenance costs use cases. Official website: www.70testing.com

 

Guess you like

Origin www.cnblogs.com/kylinTOP/p/12490442.html