Today, many projects with complex and diverse functionality are characterized by really short release intervals. In such cases, you often have to perform a large number of repetitive testing (regression tests). Perhaps this fact is the main, although not the only one, driving force behind the active development of test automation. More and more IT companies are deciding to optimize the testing process by reducing time-consuming and costly steps.
At the same time, automation is a fairly young field. Experienced professionals with relevant skills are usually in short supply. Often the task is to train such specialists independently within the company within a reasonable time frame. However, mastering automation makes high demands on the technical knowledge of the tester, since they are required to read and write program code, edit configuration files or read logs. In this article, we will talk about the steps necessary to achieve the required level of technical knowledge of an automation specialist.
I had to master automation “from scratch”, that is, without having an academic education in the field of IT, programming skills, and practice in related “technical” areas (for example, in system administration). Now, already having experience in writing tests in two programming languages (Python and Java) and continuing to improve in the field of automation, I will give recommendations on how to acquire the necessary knowledge and experience.
Before you write anything that works and solves useful problems, you have to read, namely, look through the lines of code and logs and try to figure out what is going wrong when debugging tests. At the same time, the skill of reading code will be universal, since many basic ideas and concepts are common for most modern programming languages: variable declarations, data types (string, integer, boolean values true/false), arrays, and conditions (if/else).
Where to begin? Start from simple things. For example, while browsing another web page, press Ctrl + U and try to study the structure of the HTML code that you see. You don’t need to understand everything. Parse a small snippet, look for the descriptions of the tags.
On the one hand, HTML is a markup language (not a programming language), so it is relatively easy to understand. On the other hand, this is a good preparatory exercise, since when writing automated tests that are executed through a graphical interface in a browser (the most extensive area of automation today and at the same time the easiest to learn), you will often have to look at the HTML code of the page. This is not programming yet, but already reading the code so the eyes are getting used to looking for the desired line and analyzing the structure.
Your next step should be mastering a simple online programming course for beginners, during which you will do the simplest basic operations, accompanied by detailed comments. Today, the selection of training resources is quite extensive. Try searching for “programming for kids”, “online coding courses for beginners”. The Python course I took allowed me to write tests for my first project without any problems. In general, if possible, start by learning Python. It is a serious programming language with all its capabilities, its syntax is not complicated, and the code is well readable.
But don’t be afraid of the “great and terrible” JAVA language! At first, the variety of modifiers (public, protected, private) and strong typology seem scary (you must immediately indicate what exactly is stored in the variable: strings, numbers, etc.). However, if you declare all your test classes and methods public (“no access restrictions”), then most likely NOTHING will change. As far as typology is concerned, you almost always know in your test what you want to get: a string of text or a number, true/false, or something else. So it won’t cause problems either.
There are auxiliary tools for recording tests, so-called recorders (for example, Selenium IDE and Selenium Builder). You can install them, run them before you start recording the test, and then perform the necessary manipulations in the browser. Your actions will be recorded as a sequence of simple commands. You can save this sequence and run it for the browser to repeat your test on its own. Even at this level, routine testing is easily automated and manual work is reduced. The beauty of these tools lies in the fact that you quickly understand that it is more convenient to write code yourself.
After completing the first tests with the recorder, analyze the sequence of the commands received. Try to enter any actions yourself or change existing ones. It’s amazing, but once you have identified frequently used commands and analyzed their typical sequences, it’s immediately easier for you to add them yourself, without resorting to automatic recording.
Your next step is to convert the instructions of the recorded test into a programming language. Selenium IDE and Selenium Builder provide this opportunity. Analyze the generated code. You will find that many pieces of text are very similar to the already familiar and understandable command language of the recorder, they are simply already included in the constructs of the selected programming language. There is a high probability that you will find a few errors and shortcomings in the sequence of actions. This is fine. The conversion engine is not perfect yet. But at the same time, if you find such errors, you will be able to correct them and gain confidence in understanding the code.
Once you have found errors in several tests and managed to fix them, restoring the desired sequence of actions, you do not need a recorder anymore. Thus, you have everything you need to continue writing tests in the programming language, referring to independently prepared code fragments.
This advice applies not only to the process of acquiring knowledge in the field of automation Your efforts must not be wasted on this particular project. Speeding up regression tests is the most common use of automation today, though not the only one. You need to be prepared that the specific goals and tasks that are set for automation specialists are not always clearly formulated at the very beginning of work. It will take time to identify the needs of a particular project but you must do it. Even until the assignment is fully clarified, you can already get useful results by automating regression tests, while continuing to hone your skills. If you can find other areas where automation applies to your project (for example, creating test data, preparing test environments), you will be more useful.
SPIN CAREER Academy offers a QA automation engineer training course and a manual QA tester training course, where a trainer will help you deal with the material. This will save time (both your personal and your project) in those frequent cases when you will be involved in test automation without having the necessary knowledge. Ask if your company will agree to pay for these courses. In any case, the decision is up to your motivation to work independently.
Feel free to ask, communicate with your fellow automation testers regularly and regardless of your level of knowledge. For example, create a general chat, find a forum or a group in social networks. Discuss solutions. You can write tests in different languages or use different test run frameworks for the same language, but algorithmic and architectural decisions will still have a lot in common. Someone will know more than you – they can tell you more. Someone will very likely know less than you and you can help them and once again reinforce your knowledge.
The first code that you get with the conversion will be a simple sequence of elementary commands containing repeated fragments. Over time you will realize that it’s not very understandable. In addition, it is difficult to maintain, because the same change will have to be made in several different places. You will come across the so-called “spaghetti code”, which is poorly structured, inconvenient to work with.
To improve its quality, I recommend following these steps:
Following these guidelines will help you write maintainable code that you and your fellow testers can understand.
In conclusion, I want to note that the most important thing is your motivation to study and find answers on a regular basis. You will often come across new questions, the answers to which have yet to be found, and you will never know enough. There are many pros and cons of test automation. But advantages of automation testing do not interfere with the development in the field of automation and the development of interesting and useful solutions.
Therefore, do not limit yourself in the choice of tasks to those areas that you already know. Choose a new interesting problem and acquire the necessary knowledge in the process of solving it. This approach will allow you to quickly move forward and become a professional in your chosen field.