I was recently talking with someone about their testing strategy and process when I noticed they were trying to build overly-detailed test scripts (procedures). It didn’t take them long to realize specifying to such detail often left them bored (writing became redundant) and so each test became less and less detailed. I offered to take a look at their tests to see if I could help improve things and as I saw, what I consider to be, their “typical” scripted tests with each line having a step and expected result I started thinking of something Pete Walen once said:
…and nothing else funny happened.
Peter Walen, STPCon
Pete Walen dropped this gem at STPCon in San Diego a few years ago during Matt Heusser’s talk Where do Bugs Come From? Matt had just shown the Moonwalking Bear video:
I’d guesstimate at least half of the packed room hadn’t seen this. The discussion turned to scripted testing and the inherent problem of in-attentional blindness. Pete shared a past experience where he told some testers he was working with to include the phrase in the expected results of their scripted tests. It’s a kind-of-heuristic to help someone remember, even though they are focusing on one thing at depth, they need to be aware of the potentially many other things going on so that “nothing else funny happens”.
It was such a simple, powerful idea it continues to stick with me, especially when I see someone trying to specify “most everything” in their scripted tests.
As it happens, this post coincides with STPCon 2015 back in San Diego right now. There looks like a lot of awesome speakers (Matt Heusser, Michael Larsen, and Smita Mishra) but I’m particularly intrigued by Andy Tinkham’s High Volume Automation in Practice and Dave Haeffner’s Using Selenium Successfully. I wonder, is anyone live blogging?
The ChromeDriver getting started guide isn’t super helpful if you are unfamiliar with including the ChromeDriver location in your PATH environment variable. (The PATH variable helps Chrome find the downloaded ChromeDriver exe). Also it’s a lot of work for something so common. Never fear, here is a better way:
Installing on macOS:
Listed in order of easiest to hardest install, these are the best ways to install ChromeDriver on a Mac:
The easiest way to install ChromeDriver is to use your package manager such as brew or npm to install the driver.
In your terminal window with the Homebrew package manager:
Install ChromeDriver with brew install caskchromedriver
Confirm it was installed using chromedriver --version and seeing it returns a version. If it errors it wasn’t installed
Other package managers like npm have similar commands npm install chromedriver
Run Chrome & ChromeDriver in a container using Docker. Simply download the combined container, start it and point your code at the right address.
Specify it in your Selenium setup code and check it into source control like any other configuration detail. If you go this route, you can include additional drivers like GeckoDriver (aka Firefox) as well.
The ChromeDriver getting started guide isn’t super helpful if you are unfamiliar with including the ChromeDriver location in your PATH environment variable. The PATH variable helps Chrome find the downloaded ChromeDriver exe. Don’t get me wrong, I’ve updated PATH variables on Windows for years but never on a Mac, until now:
System PATH Setup
The following instructions will help you create your own PATH to a unique folder on your Mac or copy the file to an existing PATH directory for ChromeDriver.
Now we need to tell Selenium where it is and for that we have a few choices.To do this:
Open up Terminal
Run sudo nano /etc/paths
Enter your password
Go to the bottom of the file and enter the path you wish to add
My PATH looks like: /Users/myname/Documents/WebDriver
Control-x to quit
Y to save
Press enter to confirm
To double check, quit Terminal and relaunch it. Run echo $PATH. You should see your newly added path in the stream of other paths already there.
Finally, update your tests to run using Chrome and run your tests!
After running your tests, if your PATH isn’t set up correctly you get this helpful message:
Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver.
Did this work for you? Did it solve your problem? Please leave a comment below.