You are here

Designing your Java and Selenium tests. And your testing framework too (with Maven)

During this tutorial I will show you how to create and customize an automation project (framework) from scratch, using Maven. Java based test design will be the main focus of the tutorial after the project was created: how to avoid repeating code, how to structure your test code, how/when/why to create utility classes and how to run tests. I will show you how to write browser unaware Selenium tests and how to easily switch the browser on which they run. You will learn how to write tests that are environment unaware and how to make them run across your environments. Also you will get an idea of how to easily create tests for translation purposes, when your code runs across localized pages. In addition, I will go over the most useful IntelliJ shortcuts, that will help you be more efficient when writing and structuring code. All of these will be done against real code and real examples.

Key takeaways:

  • How to create a new code project with Maven Understanding your pom.xml file
  • How to import dependencies with Maven
  • How to find what you need in the imported dependencies
  • How to create Maven profiles for running tests based on an xml file
  • Creating the browser instances and browser utilities
  • How to switch browsers in tests and how to write browser unaware tests
  • How to switch environments on which tests run and how to write environment unaware tests
  • How to create one test that can run across all the localized variations of a page
  • How to structure the project (where to place what), how to organize the project IntelliJ shortcuts for common tasks, like: extracting methods from repeating code, extracting variables and field, auto-arrange of the code lines, etc

 

Prerequisites:

The tutorial can be run on any OS that the participants have on their laptops. These are the necessary steps for installing the tools and frameworks that will allow for writing tests.