Java for QA Automation Engineers: How to Learn?

[article]
Summary:

If you are a manual tester and want to be a QA automation engineer, learn Java and programming via these 10 steps.

Last winter I received an unusual assignment from management. I was asked to organize training for a small group of manual testers so that the best of them could turn into QA Automation Engineers. 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 would teach them the basics of automation (using tools such as Selenium WebDriver) even faster. We were allotted a few months so that by April successful students could start working 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 the ones for programmers, so the approach, in theory, should be different!

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

Who Is a QA Automation Engineer?

A 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 automation engineer is to create automated scripts that will verify the behavior of the program based on test cases written by manual testers or by themselves. This helps reduce testing time and simplifies its process.

A QA Automation Engineer combines the skills of testers and programmers. Like manual QA specialists or testers, QA automation engineers monitor the quality of the product at various stages of development, testing, and operation. Like programmers, QA Automation Engineers are engaged in development, but they create a specific product to check the code of programmers.

Inbetweeners

When I came to my senses after realizing who QA Automation Engineers 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 (more about that below 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 automators?

Confident Knowledge of the Language Basics

QA Automation Engineers should know the syntax and tools of the language that they are using to automate tests really well. Unlike developers, it is not necessary for them to have a deep understanding of 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. The requirements for QA code quality are often (but not always) lower than those for the code that developers write. 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!

I had once collected such problems for future programmers, and I decided to use the first part of that collection for testers as well. However, these tasks were not always enough, and I was looking for some new ones on the Internet. I recommend that both developers and QA automation beginners look for such tasks. I did this for my students and found CodeGym, a site that includes a 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, didn’t need to 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 knowledge of a particular programming language. Anyway, they are really beneficial for those automation engineers who want to understand programming more deeply.

QA Automation Engineers 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. Students were given 20–30 minutes to complete 3–5 tasks. If a student did not know how to solve some of them or if 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 began to clarify variable names, their code began to better correspond with coding conventions, and much more intelligible comments appeared in their code. In the same way, bug reports improved right before my eyes.

I saw a fascinating effect of 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 go 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. My students tried to solve these problems and demonstrate the results.

Is This Code Good or Bad? A QA Automation Engineer Should Know the Answer

If the QA automation engineer is able to optimize the code, 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 that they read a very good book called Refactoring by Martin Fowler. I prepared several long and confusing examples that students needed to optimize and provide explanations for why they decided to change the code. I proposed that they look for bad code in the same forums for beginners and improve it as homework.

Writing Some Tests

In fact, you could study the 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 unit testing when students have mastered the basics of Java syntax, OOP, and data structures at an acceptable level. By that time, they had been studying for almost two months, and they were about to start classes with their QA mentor on topics such as Selenium WebDriver.

During this period, I told them about the Spring and Maven projects as well as functional, integration, and unit testing. I taught them how to work with the 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 work on a task for three days and pass it on to a partner who optimized and verified the code, covering it 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

  • OOP

  • Collections Framework

  • Lambda Expressions

  • Learning Regex. At these stages, they solve a lot of small tasks.
  • Unit tests. We start to cover our code with such tests. Begin to test someone else’s code. We take the code of classmates and cover it with Unit tests. We also look for code on the Internet and cover it with tests.
  • Design Patterns
  • Refactoring Small Amounts of Code
  • Spring Basics (Introductory Lecture)
  • Working with Gradle
  • Working with Maven
  • Basics of SQL and Working with the Database
  • Basics of Mock Testing: Mockito. I offered small personal code snippets for general projects with bugs that you need to reveal with tests, create tests with mocks for them, and catch as many bugs as possible. I kept assigning them more and more very small projects every day.
  • 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 the automation testing course that covered topics such as Selenium WebDriver, PageObject, PageFactory, Jenkins, and service testing (REST, SOAP) patterns. 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 automation course with Chris, 7 started work as QA Automation engineers and…one became a Java developer. Chris was very pleased with their' programming knowledge.

    Recommendations for Self-Learners

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

    1. Learn Java Core and solve many small coding tasks. You should at least understand syntax, OOP, Collections, and regex.
    2. Use a good IDE (I recommend IntelliJ IDEA).
    3. Learn unit testing.
    4. Verify your code without System.out.println but with your own unit tests.
    5. Read about code refactoring.
    6. Learn SQL at the beginner level.
    7. Learn a little bit about Gradle, Maven, and Spring.
    8. Read, check,and improve the code of other people. Use special forums to find such code.
    9. Work with Mockito (or other mock testing frameworks).
    10. Now learn your testing tools.

    User Comments

    1 comment
    Ahmed Abo Khalifa's picture

    This is really challenging yet impressive. I was wondering how to start with my subordinates to get them started as QA Automation Engineers. I decided to give them some programming tasks and review their work. To ensure their interest, I passed them a mix of both problem-solving programming tasks and some automation work in simple web pages that includes finding elements and interacting with them using selenium web driver. The difference in my story is that I am not a programmer, I am a QA automation engineer with a little knowledge of the language compared to professional Java developers. I found it safer and easier for the team under my supervision to read the basics, solve problems, use the web driver, and so on.

    September 30, 2020 - 5:30am

    About the author

    AgileConnection is a TechWell community.

    Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.