Back to Resources

Blog

Posted February 5, 2014

Getting Started with Selenium Testing - 1st in a Series

quote

This post is the first in a series of "Getting Started with Selenium Testing" posts from Dave Haeffner, a noted expert on Selenium and automated testing, and a frequent contributor to the Sauce blog and Selenium community. This series is for those who are brand new to test automation with Selenium and a new chapter will be posted every Tuesday for the next two months.

The First Thing You Need To Know

Selenium is a software robot sent from the future to help us test web applications. But keep in mind that it's not one of those fancy shape-shifting robots than can run really fast. Instead it's more like one of those really strong robots that's not very fast and is best suited for accomplishing a certain objective. That is to say -- Selenium is really good at a specific set of things. If you know what those are and stick to them then you will be able to easily write reliable, scalable, and maintainable tests that you and your team can trust. But before we go too much further, there are a few things you'll want to get sorted prior to writing your first test.

Define a Test Strategy

A great way to increase your chances of automated web testing success is to focus your efforts by mapping out a testing strategy. The best way to do that is to answer four questions: 1. How does your business make money (or generate value for the end-user)? 2. How do your users use your application? 3. What browsers are your users using? 4. What things have broken in the application before?

After answering these, you should have an understanding of the functionality and browsers that matter most for the application you are testing. This will help you narrow down your efforts to the things that matter most. After answering these questions, you should also be able to build a prioritized backlog of critical business functionality, a short list of browsers to focus on, and an understanding of the risky parts of your application to watch out for. With it, you should be able to make sure you are on the right track -focusing on things that matter for the business and its users.

Pick a Programming Language

In order to work well with Selenium, you need to choose a programming language to write your acceptance tests in. Conventional wisdom will tell you to choose the same language as what the application is written in. That way if you get stuck you can ask the developers on your team for help. But if you're not proficient in this language (or new to development), then your progress will be slow and you'll likely end up asking for more developer help than they have time for -- hindering your automation efforts and setting you up for failure.

A great way to determine which language to go with is to answer one simple question: Who will own the automated tests?

As you are considering which language to go with, consider what open source frameworks already exist for the languages you are eyeing. Going with one will save you a lot of time and give you a host of functionality out of the box that you would otherwise have to build and maintain yourself -- and it's FREE. Here's a short list of open source Selenium WebDriver frameworks and their respective languages (sorted alphabetically):

Choosing a programming language for automated testing is not a decision that should be taken lightly. If you're just starting out (or looking to port your tests) then considering and discussing these things will help position you for greater success.

Choose an Editor

In order to write code, you will need to use some kind of an editor (e.g., text editor, or integrated development environment). There are plenty to choose from. Here are some of the more popular ones I've run into:

It's important to pick an editor that works for you and makes you productive. So if you're new to programming and text editors, then it's probably best to go with something more intuitive like Sublime Text or IntelliJ. 

Dave is the author of Elemental Selenium (a free, once weekly Selenium tip newsletter that is read by hundreds of testing professionals) as well as a new book, The Selenium Guidebook. He is also the creator and maintainer of ChemistryKit (an open-source Selenium framework). He has helped numerous companies successfully implement automated acceptance testing; including The Motley Fool, ManTech International, Sittercity, and Animoto. He is a founder and co-organizer of the Selenium Hangout and has spoken at numerous conferences and meetups about acceptance testing.

Published:
Feb 5, 2014
Share this post
Copy Share Link
© 2023 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.