4. github.com/xrg/behave_manners
4
Web UI need testing
●
Web UIs are all over the place
●
Nobody writes plain (nor clean) HTML
●
Complexity has exploded
(using React, Angular, Ember, etcJS)
●
Front face of product, functionality
●
They're alive!
5. github.com/xrg/behave_manners
5
Python to the rescue
Python is suitable for testing:
●
It is scripted
●
Easy, sugar-free syntax
●
Should be your choice for backend
●
Modular, easy to extend
6. github.com/xrg/behave_manners
6
Behave + ? + Selenium
Behave:
●
BDD, TDD, output formatting
+ parallel ;)
Selenium
●
Standard, industry choice
●
Defines WebDriver, all browsers support
But, middleware?
7. github.com/xrg/behave_manners
7
Example of Selenium on behave
@when('I enter my login details')
def enter_credentials(context):
context.driver.find_element_by_id('username').send_keys('test_user')
context.driver.find_element_by_id('password').send_keys('test123')
@when('I click login')
def click_login(context):
context.driver.find_element_by_xpath('/html/body/div/div/div/div/form/div[3]/button').click()
●
Doesn't scale well
●
DOM mixed with procedural code
●
Need to repeat XPaths all over; cannot test them until that step is called
●
Still broken for dynamic DOM
●
Same in other languages