How To Learn Test Automation From Zero

Manual testers that want to move to test automation should do this gradually by learning one automation skill at a time.

The process of learning test automation is similar with climbing a staircase, one stair at a time.

Each next skill should be just a bit more complex that the previous one.




Many testers don't know how to move from manual testing to test automation.

They don't know either what skills are needed for test automation.

Or how these skills should be learned and in what order.



Where can inspiration be found on how to learn test automation?


Sometimes, inspiration comes from unexpected places.


I have been reading lately Stephen King's book, "On Writing" where he explains the secrets of his creative writing.

Success did not come for him either easy or fast.

Over the years, his works were rejected hundreds of times by the editors of the magazines where he was trying to publish.

Most people, when facing repeated rejections, think of quitting and doing something else, something where they can do better.

Not Stephen King.

Every time he got a rejection note, the note was placed on a nail attached to a wall from his bedroom. The nail and the notes on it were the proof that his writing skills are not good yet and in need of more honing and improvement. 

In time, the number of rejection notes increased so much so nail was replaced by a spike with plenty of additional space for the coming rejections.



And he persevered and wrote more.

Initially, he targeted the 1960 version of blogs.

When his novels were accepted there, he moved to writing for second tier magazines and then for the first tier magazines.

Finally, he published his first novel Carrie after 10 years of writing.

To summarize, Stephen Kings's writing process was supported by 3 main activities:
  • lots of practice; he wrote for 10 years before publishing his first novel
  • driven by honest feedback; the number of rejection notes from the wall's spike showed the true value of his writing
  • challenge himself just barely above his current skill level; as soon as his writings were accepted by a publication, he started writing immediately for better publications, challenging his skills this way

So what can we use from Stephen King's story for test automation?

The last activity was the one that caught my attention: 
challenge himself just barely above his current skill level

I wasn't sure why it stuck in me, why I could not forget about it.

My first intuition was that it may be related to the way that I was approaching learning about testing.

The way I was learning and still do consisted in
  • learning some aspect of testing
  • keeping at it until having a good understanding
  • starting learning another skill that was close to previous one but a bit more difficult

For example, after learning HTML to understand how web pages are build, I continued with CSS (Cascade Style Sheets) on how styling information is getting added to the HTML elements.

And then continued with JavaScript on how dynamic effects come into play in web pages.


Isn't this the same as 
Challenge Yourself  Just Beyond Your Current Skill Level?


How can these ideas be applied for learning test automation?

What skills does someone need to start from zero in automated testing?

How does one get started in automation testing?





Going from manual testing to test automation is similar to walking on a staircase.

At the bottom of the staircase, you have manual testing.

Test automation is at the top of the staircase.

So you start walking, one step at a time:

                                                Test Automation (basic skills)

                                             Learn Page Object Model

                                         Learn Object Oriented Programming in Java
                                      Learn the WebDriver framework

                                 Learn JUNIT                                                            
  
                            Learn the Java basics
                                
                        Learn Eclipse

                     Learn how to create XPATH locators

                 Use browser plugins (Firebug, Firepath, FireCookie)                     

             Learn HTML and CSS
                
         Read how the HTTP protocol works, get and post requests

     Understand how browsers work
            
Manual Testing



A few words below on each stair.




Understand how browsers work

Let's take a specific type of test automation: 
web test automation using Java as the programming language and the Selenium WebDriver framework

Since test automation is all about writing code that interacts with the elements of a site through a browser, it is useful to understand more about
  • the components of a browser
  • the settings that control a browser
  • how cookies works
  • how browser sessions work
  • browser DOM; this is an internal browser structure created from the HTML and CSS code; as soon as a new HTML element is added to the browser DOM, it is displayed on the page in the browser


Read about how the HTTP protocol works

Each page displayed by a browser is part of a website hosted on a web server.

For every page change that happens in the browser, there is communication between the browser and the web server.

This communication happens over the HTTP protocol.

Understanding how HTTP works is useful for test automation as web pages can be requested in a few different ways (get, post requests).


While learning about HTTP, look also into
  • URL parameters
  • parameter coding and decoding  

Learn HTML 

All websites are built using HTML.

In test automation, we interact with elements of a web page and in order to do this, it is important to understand how these elements are created.

Basic HTML knowledge is useful for test automation:
  • common HTML elements: buttons, text boxes, lists, links, etc
  • HTML tags
  • HTML attributes

After going through HTML theory, reading about CSS clarifies how style sheets are added to HTML code so that the end result is good looking web pages.



Use browser plugins (Firebug, Firepath, Chrome Inspector)




The browser plugins are helpful for providing access to information about 
  • HTML source of a page: The HTML source of a page can be viewed through the View Page Source option of any browser; a browser plugin like FireBug shows the same information in an easy to understand tree-like format
  • cookies; some of the browser plugins such as FireBug not only show the cookie information but allow modifying the cookies' values
  • information about the page load; all components of a page are presented, their size, content type and loading time

Learn how to create XPATH locators

Before a test automation script can interact with a web page element, it needs a way of finding the element on the page.

XPATH provides a flexible way of creating locator expressions for finding web page elements.


Learn Eclipse

Test automation is all about writing code in a programming language that interacts with a site in the browser through a test automation framework.

The code development is being done in an application called IDE (integrated development environment).

The IDE used most of the time for Java projects is Eclipse.

Before creating projects in Eclipse, learning about the Eclipse main functionalities is a good idea.


 Learn Java basics

Test automation is 100% programming in a language.

In our case, the language is Java.

So you need to learn the Java language basics such as
  • basic data types (integer, boolean, string)
  • create variables
  • data type operators
  • boolean operators
  • if/else statement
  • switch statement
  • for statement
  • while statement
  • arrays 
  • lists
  • other classes from the Java API

Learn JUNIT

JUNIT is a unit testing framework that is typically being used by developers for creating unit tests that validate the code correctness.

For test automation, JUNIT provides a way of creating independent test scripts.

Some of the fundamental JUNIT concepts for test automation are
  • test scripts
  • assertions
  • annotations
  • test suites

Learn the Selenium WebDriver framework

The test automation scripts interact with elements of a website through the test automation framework, Selenium WebDriver.

Selenium WebDriver framework has lots of classes specialized in 
  • managing the browser (WebDriver class)
  • interacting with common HTML elements (WebElement class)
  • interacting with lists and dropdown lists (Select class)
  • finding elements (WebDriverWait class)
  • using element locators (By class)

Learn Object Oriented Programming in Java

The next level of Java programming is related to the object oriented concepts.

You need to learn about
  • class inheritance
  • polymorphism
  • abstract classes
  • interfaces

All these high level programming concepts will allow you to take your test automation scripts to the next level with the help of ................ Page Object Model



Learn Page Object Model

While learning test automation, your test scripts include WebDriver API commands.

This is ok while learning but these types of scripts are difficult to maintain on the long run.

The WebDriver API commands need to be removed then from the test scripts.

The Page Object Model, together with the Object Oriented Concepts, will help you create your own classes that correspond to site pages.

This way, the WebDriver API commands will be included in the Page Object classes and the test scripts use the Page objects.



Start Practicing Your New Test Automation Skills

Learning about test automation is very important but the automation practice is essential.

Start working on your projects as soon as possible.

Create your first test automation project and continue from there.



Is this the end of the learning?

Do you know test automation at this point?

You reached the basic level of test automation and the end of the first staircase.

The next staircase is waiting for you ................

Share this