Java for QA Automation engineers: how to learn?

First e4developer “guest blog post” brought to you by John Selawsky from https://medium.com/@johnythecoder

Last winter I got an unusual task from my management. I was assigned to organize training for a small group of manual testers so that the best of them could turn into QA Automation. However, I didn’t receive any particular instructions except for one: I should familiarize the group with Java basics and then later transfer them to the QA automation engineer mentor as soon as possible. The QA mentor should teach them the basics of automation (Selenium Webdriver and so on) even faster. We were allotted a few months so that by April successful students can start their work in a new role.

First I went into a tailspin. Well, I’d never worked with testers or rather I’d never taught testers how to code. The requirements for these guys are definitely different from ones for programmers, so the approach, in theory, should be different!

The very first for me was a clear understanding of what QA Automation Engineer is and what they do.

Who is QA Automation engineer?

QA Automation Engineer is a product quality assurance specialist who creates tests with the help of software tools and verifies execution results.

The main task of the QA-automator is to create automatic scripts that will check the work of the program based on test cases written by QA-manuals. This helps reduce testing time and simplifies its process.

QA Automation Engineer implements the skills of a programmer and the logic of a tester at the same time. Such as manual QA specialists or testers, QA automation monitors the quality of the product at various stages of the development, testing and operation. Such as programmers, QA Automation is engaged in development, but they create a specific product to check the code of programmers.

The customer of a QA Automation Engineer is a manual tester, who needs to have automated some functionalities in the sake of not to repeat the same actions again and again.

Inbetweeners

When I came to my senses after realizing who QA Automation really are, I acted as usual. I opened Google, studied the question, and began to annoy my colleague, the automation mentor, with clarifying questions … After that, my work plan matured in my head, and I started to develop it. Since the course, judging by the results, proved to be successful (I will write about this below), I decided to share my thoughts in this article. So, what is the right way to learn Java for manual testers who want to become automatizers?

Confident knowledge of the language basics

QA Automation should know the syntax and tools really well. Unlike developers, it is not necessary for them being too deep into the architectural features of Java.

They use language as a tool and just need to be good at it. You may also apply this to some groups of developers, but if they know how the language works from inside, they also know how to solve the problem optimally with its help.

The main task of QA Automation specialists is to check someone else’s code with their own. Their code shouldn’t be the best and optimal. More important for them is to write code quickly and confidently. I don’t mean in a bad way, but quickly and confidently. Therefore, for QA automation engineers it is especially important to know the syntax really well and to do simple actions without delays and hesitations. To make it happen, they need to solve a lot of coding tasks right from the very first days of their learning. The coding tasks can be quite simple, as long as there are really a lot of them!

Once I collected such problems for future programmers, and I decided to use the first part of the collection for testers as well. However, these tasks were not always enough, and I was looking for some new on the internet. As well as for developers, I recommend every beginner of QA automation to look for such tasks. I did it for my students and found CodeGym, a site includes Java course for beginners to intermediate level. This site contains a huge number of coding tasks that cover all Java Core topics. The best thing about it is an automatic verification of the solution, so I as a mentor shouldn’t check all these tasks every time.

The second site is GeeksForGeeks. There is a good Java course and separately a collection of coding tasks. To be honest with you most of these tasks are more complicated and more about programming itself than about language. Anyway, they are really beneficial for those automation engineers who want to understand programming more deeply.

QA Automation should read someone else’s code

… and do it quickly enough.

Once a week I asked my students to solve several easy tasks right in the classroom. The solution of tasks (from 3 to 5) was allotted up to 20-30 minutes. If a student did not know how to solve some of them, or something went wrong, they moved on to the next task leaving the tough one.

The second part of the lesson lasted for 1.5 hours. Everyone got the work of the other student and was asked to test the solution and make suggestions on how to fix the code. At the last stage, the code with recommendations was given to their authors so they tried to correct the work according to the recommendations of the reviewer. The result of such exercises surprised even me.

My students themselves began to give clarify names of the variables, their code began to correspond better to the Code Convention, and much more intelligible comments appeared in their works. In the same way, Bug Reports improved right before my eyes.

I saw a fascinating effect from this kind of work, but I just didn’t have time to do this more often than once a week. Therefore, I came up with a daily exercise on reading someone else’s code: I suggested my students going to the CodeRanch forum (section for beginners) and the CodeGym mentioned above (help section). There they found a lot of beginners questions, mostly about what is wrong in their code. So they tried to solve their problems and demonstrated me the results.

Is this code good or bad? QA Automation engineer should know the answer

If the QA automation is able to optimize the code, he/she is literally a gem of a specialist. During the course, I thought of teaching my students the basics of refactoring and optimization. I gave them several lectures on this topic. I recommended them to read a very good book “Refactoring” by Martin Fowler. I prepared several long and confusing examples that students need to optimize and provide explanations why they decided to change the code. I proposed them to look for a bad code in the same forums for beginners and improve it as homework.

Writing some tests

In fact, you could study JUnit library and start covering your code with tests from the very beginning of your programming learning. Perhaps I’ll do this with my next group of manual testers on a trial basis. However, the first time I decided that I’ll talk about these moments when students have mastered the basics of Java syntax, OOP and data structures at an acceptable level. By that time, the guys had been studying for almost two months and they were about to start classes with their QA mentor (Web Selenium driver, etc.).

During this period, I told them about Spring and Maven-projects, functional, integration and unit testing. I taught them working with JUnit and Mockito libraries. At this time, all the tasks that they solved became much more difficult and were combined into a single project. Everyone had to complete some task for three days and pass it on to a partner who optimized and checked his code for operability, covering the code with tests. Well, in the classroom during this period, we discussed the difficulties and learned to overcome them.

Here is an exemplary course schedule:

  1. Learning Java Fundamentals:  Syntax,
  2. OOP,
  3. Collections,
  4. Learning Lambda expressions
  5. Learning Regex; At these stages, they solve a lot of small tasks.
  6. Unit tests; We start to cover our tasks with such tests. Begin to test someone else’s code. We take the tasks of classmates and cover them with Unit tests. Looking for questions on the Internet and cover them with tests
  7. Design Patterns
  8. Refactoring with small tasks
  9. Spring Basics (Introductory lecture)
  10. Working with Gradle
  11. Working with Maven
  12. Basics SQL and work with the database
  13. Basics of Mock Testing: Mockito; I offered a small personal code parts for general projects with bugs that you need to cover with tests, create Mock tests for them and catch as many bugs as possible. Some more very small objects every day.
  14. The final project. Everyone gets a certain part of the program that needs to be tested using the knowledge gained

Results

This course took three months. After that students joined automation testing course (Selenium Webdriver, PageObject and PageFactory, Jenkins, service testing (REST, SOAP) patterns and so on). It took them just a bit of time for all of this, so the Automation testing course mentor Chris and I coped with our tasks. Good knowledge of Java greatly simplifies the transition of a manual tester into QA Automation.

As a result, out of 8 manual engineers who completed my programming course and completed the course of automation with Chris, 7 started work as QA Automation engineers and … one became a Java developer. Chris was very pleased with these guys programming knowledge.

Recommendations for self-learners

So if you are a manual tester and want to be a QA automation, learn Java and programming the same way:

  1. Learn Java Core and Solve many small coding tasks. You should know at least Syntax, OOP, Collections and Regex.
  2. Work in good IDE (I recommend IntelliJ IDEA).
  3. Learn Unit testing.
  4. Check your code results without System.out.println but with your own unit tests.
  5. Read about code refactoring.
  6. Learn SQL at the beginner level.
  7. Find out a little bit about Maven, Spring, Gradle.
  8. Read, check and improve the code of other people. Use special forums to find this.
  9. Work with Mockito (or other mock testing framework).
  10. Now learn your testing tools.
John Selawsky

Author: John Selawsky

John Selawsky is a senior Java developer and Java tutor at Learning Tree International programming courses. Visit his personal Medium blog (https://medium.com/@johnythecoder) to read more Java thoughts and advice.