End to End testing with Selenium — Retrospective

John Nolette
Sep 18, 2018 · 7 min read

What is Selenium?

First hurdle — writing reusable code

class HomePage:  def __init__(self, webdriver):
self.wd = webdriver
@property
def notification_box(self):
return self.wd.find_element_by_css_selector('div.notif')
from unittest import TestCase
from selenium import webdriver
from products.barfoo.pages import UserPage
from pages.foobar import HomePage
class AppTests(TestCase): def setUp(self):
self.webdriver = webdriver.Chrome()
def tearDown(self):
self.webdriver.exit()

def test_user_page(self):
home_page = HomePage(self.webdriver)
user_page = UserPage(self.webdriver)
home_page.user_profile.click()
self.assertEqual(user_page.username.text, "john")

Growing pains

Infrastructure

Decreasing lead time

Maintenance and cost

Key takeaways

John Nolette

Written by

The master of none; I drink and I know things.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade