Get Started With Test Automation

Published

April 11, 2019

Adriana ‐ Scrum Master

Here at WORTH, we’re dedicated to producing quality products. To that end, the testers are always trying to improve and learn more. To help them we created a list of resources, online trainings and a few assignments.

The theory. Testing and Agile Testing

If you are a tester you may have heard about the testing theory. If you are new to testing, you may say: 'Theory, that’s boring. Why do I need it?'

We think it is important to have an understanding of testing principles on which you can further build your automation skills. A good start is the ISTQB Foundation Syllabus, it covers six main topics: fundamentals of testing, testing in the software life cycle, static techniques, behavioral and structural test design and test management and testing tools.

If you plan to study it in depth and get a certification, or just test your level of knowledge, try an ISTQB Mock Exam.

We work Agile at WORTH, which means that testers are part of a cross-functional and self-organising team and need to support frequent delivery of quality products. The ISTQB Agile Tester Extension will introduce you to the testing techniques applicable to agile methodologies. If you are in a transition to agile development or want to get more inspiration on how to approach agile testing, we recommend the Agile Testing books by Lisa Crispin and Janet Gregory.

HTML & CSS

As we wrote in an earlier blog: “Before starting with test automation, it’s advisable to spend some time getting familiar with the basics of web applications. How are they built? And how does every part communicate with each other?

The best way to learn this is to take an introductory course in HTML and CSS.”

We have a few options to choose from:

  • Freecodecamp

-https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5

-https://learn.freecodecamp.org/responsive-web-design/basic-css

  • Codecademy

-https://www.codecademy.com/learn/learn-html

-https://www.codecademy.com/learn/learn-css

After this, you should be quite comfortable with finding WebElements for your automated tests using the devtools of your browser. Try for example finding elements on the WORTH website with the following css-locators:

Element CSS-locators
Find an element using ID #element
Find an element using class .element'
Find an element using name [name=’element’]
Find a nested element .element .other-element’
Find direct child .element > .child’
Find child using ‘:nth-child()’ .element:nth-child(1)

With this you should have enough understanding to start with a simple record and playback tool like Selenium IDE. Take a look at their Getting Started-guide to see if you can record your first test. But take into account that a tool like Selenium IDE is not a full-fledged automation tool. It’s really meant to help with creating quick bug reproduction scripts. However, it does allow you to really understand the interaction between an automation tool and WebElements.

Learn the Command Line + Git

As soon as you write code, you will also want to be able to share code and maybe work together with other people. To be able to do this fluently, we think a base understanding of Git and the command line is required.

For learning the command line (or shell, or terminal) there are two resources we think will give you a good understanding.

For Git, there are many different resources available. See for example the list that GitHub collected to learn Git. But learning things interactively is always more fun. For that, take a look at Learn Git Branching.

After these courses, you should be able to initialize a repository, branch from it and commit your work. Try it with this small exercise:

  • If you don’t have an account already, create a GitHub or BitBucket account
  • Set up SSH with GitHub. Need a hand? Check this or this guide.
  • Create a new repository
  • Make an initial commit
  • Create a new branch and switch to this branch
  • Commit the file/script with found elements from the earlier assignment
  • In GitHub/BitBucket, create a new Pull Request to merge test file in master branch

Choosing and learning a programming language

Now that you are comfortable with WebElements, Git workflows and your own PC and even a bit of test automation with Selenium IDE, it’s time to take it a step further.

Although it is possible to work with test automation without being able to code, this mostly requires specific test frameworks and the support of dedicated developers for the technical parts. This is not optimal or desirable. Therefore, it’s important to understand the basics of a programming language. This doesn’t mean you should be on the same level as a developer, but in our opinion you should know enough to set up a simple test framework and extend the project when needed.

Choosing a language is not as scary as it sounds, because once you are comfortable with one, switching is way easier. The more popular languages have more online tutorials and will also have more dedicated testing frameworks. For that reason we would suggest to start with either JavaScript or Java. We would suggest JavaScript to get started, because it’s a very popular language with lots of resources online.

Selenium Basic

Often when people talk about test automation through the GUI, they talk about Selenium. Selenium really just does one thing. It automates browsers. This makes it well suited for web applications testing. Furthermore, it has a huge community and is supported by most popular programming languages. That’s why there are a lot of different resources to start with Selenium.

If you want to create robust, browser-based automation tests, we recommend to take a look at Selenium Webdriver and its different implementations in JavaScript. You can choose whatever suits you the best. Or consider the framework recommended for the technology used. For instance, Protractor is the end to end test framework recommended for Angular and Angular JS Applications.

Once you’ve picked a framework, follow the tutorial to create your first Proof of Concept! In case you get stuck, don’t forget to search your problem on StackExchange or check the website/repository from the tool you are using.

Further reading

Yes, you will have situations when you need to wait for an element to be loaded. Some frameworks do it mostly implicitly, some others need an explicit wait. However, you should never use an unconditional wait of x amount of seconds. FreeCodeCamp does a great job explaining why .sleep is so bad.

Furthermore, should we automate everything? It depends, it is always good to have a good regression suite and a good amount of tests for the areas of the application with high risk, but you can also consider the test design considerations from Selenium. Don’t forget the test automation pyramid when making decisions on what needs automation and at what layer.

Now what?

Now that you’ve written your first proof of concept tests, try to use your skills on some other websites. You can use any website, probably easiest is to automate a simple google search or even use the WORTH website to create simple test case for applying for a job. Then commit test to the Git repository you previously setup. Create PR and send for review.

Conclusion

If we have inspired you and you are ready to start your next test automation challenge, share with us the automation test suite you have created for the WORTH website and apply for our new Test Automation position. We would love to have new passionate testers in our team!

Get in touch

We'd love to
hear from you

This field is required
This field is requiredThe email address is invalid.
You must consent to the Privacy Policy

Thank you

We will get back to you as soon as we can.