Improve Your Automation Skills Part 3: Selenium WebDriver
Companies are embracing automation at an increasing rate and are encouraging employees to cultivate and increase their automation skills.
Since IT demand is growing rapidly and new tools are being developed, some teams are considering eliminating manual testing entirely and hiring only testing professionals with automation skills. This is especially true of fast paced Agile teams where continuous integration is the norm.
Teams are moving to Agile development which is affecting whole teams’ approaches to quality and test automation with continuous integration. Regression testing through test scripts that are automated is helping tremendously; therefore, as a team they will save time and effort. Since there are many tools for automation, teams should be open to learning new skills and willing to grow and change as new tools become available.
Common Automation Tools
Expedited task completion is key, which is why there are so many automation tools available that help us achieve our goals faster.
An important factor is deciding whether to use an open source (free) tool. Most companies are looking for cost saving alternatives, and since they are hiring professionals to use these technologies, they aren’t typically willing to pay for the tools. At the same time, some companies are creating a budget for this purpose. Some companies don’t budget for automation tools however, in which case open source tools can be a good solution for their development and organization.
Selenium is one of the most popular open source automated testing suites. There are Selenium IDE, Selenium RC, WebDriver, Selenium Grid, each with a different functionality. Selenium WebDriver helps to access browser applications such as Firefox, Google Chrome, Internet Explorer, Safari, and Microsoft Edge. Automation code that takes advantage of Selenium WebDriver can be built in many different programming languages like Java, Python, Ruby, and C#. When using Selenium WebDriver, you can implement Cucumber (BDD Framework) for JAVA, or you can use SpecFlow (BDD Framework) for C#. There are a variety of approach and frameworks that participate in a full test automation practice.
When Selenium WebDriver is used in conjunction with Selenium Grid this allows you to also do cross browser testing. Each test execution will be run using the same automation code, but on different configurations in serial or in parallel. Not only can you test your application with Chrome web browser, you can also use and test Firefox, IE, Safari etc. at the same time.
Selenium IDE helps to record, edit, and debug functional tests. Selenium IDE attempts to simplify the test automation approach by providing end users with tools, and some automation workflows can be accomplished solely with Selenium IDE. When you’ve reached the limits of the tool you can then move your code into a larger test automation framework using more standardized Selenium WebDriver.
You can also use POM (Page Object Model), an object design pattern in Selenium. Web pages are represented as classes, and elements on the page are defined as variables on the class, so user interactions can then be implemented as methods on the classes.
- Using POM: Page Object Model is a design pattern which helps with reusability and readability. It will save time when coding, especially when we are mapping Java classes and pages of applications, and storing web elements.
How Can We Improve Our Automation Skills by Using Selenium?
One of the best practices for Selenium test automation is to test often and early, as much as possible. Before starting to test, we need to work on some coding – that way, it will be easy to understand concept of Selenium.
- Requirements Gathering and Test Case Authoring are a great starting point for automation testers. Identifying which test cases to automate will be helpful in starting the automation process; repetitive test cases will be difficult for functional testing, so running those test cases with automation scripts will be a timesaver. Since we cannot automate 100%, identifying the test cases will help in this instance.
- BDD Framework is one of the most popular automation frameworks. It is written in plain language so that non-technical people on the team can understand what is going on in the testing phase of development and simplifies explanation to stakeholders. Cucumber is a great BDD Framework tool to use, and setup of selenium test automation reports is useful for tracking testing performance and progress.
- Creating a Framework is essential for automation, as without a framework your automation project won’t be complete. Preparing your framework and deciding which IDE will you use for your automation, maven, or page object model is important to consider.
This concludes my series on Improving Your Automation Skills – please check out my first and second articles for more on the importance of automation, and where to begin in building your automation skill set.