Front End Testing Using Selenium

So I’m sitting down at the local technology hub in downtown aka the Barn Light ready for the Code for America meetup and I find I have a moment to write up a short bit about doing front end testing. This seems to be the last kind of testing anyone ever makes it to. Most people get to the unit testing in their application but the testing from the user side in is often overlooked.

So what is front end testing web applications? This means testing it from the user’s perspective in the browser. Loading the content, clicking the buttons, widgets or other interactive material and then asserting that a certain behavior or result will occur. Its the same as back end testing, but in the browser.

So lets start with a really simple test – we’re going to load the main page – we’re then going to load the about page – and then if “about” is on the page – it passes.

If the test is green (which this one is) then its success.. If its a failure then it would be red.
We can use this in more advanced tests to test deep functionality.

This next test goes from the main page and searches for “on linux” then clicks on the first post and looks to see if a known phrase is in the first page. This is testing submitting the form to the search and getting a result on a known datasource.