The Decalogue for Good Testing – What you have to learn to become a tester. Part 2

From the first part of the Decalogue for Good Testing you have learned about the basics of a tester’s work. I told you about web technologies, browsers and terminology. I mentioned a few testing tools and the most important rules of writing automated tests. 

It’s time for part two of the Decalogue now, a more technical one. Today you will learn about design patterns − what they are and which of them you should know. We will also take a look at programming languages. I will tell you which of them are worth learning. 

5# Design patterns 

A design pattern is a ready-to-use solution of a recurrent problem. If you use a design pattern you can be sure the solution you suggest is proven and universal. As a result, people who will have to deal with your code will immediately know what you wanted to do. 

Design patterns let you show dependencies and connections between classes and objects in a clear and readable way. They let you look after your code and modify it when needed. You have to remember, however, a design pattern is only a description of a solution, not its implementation. 

What do testers need design patters for? Application testing is a burdensome task. Developers tend to add more and more functions to apps, which makes you more alert and aware of the fact that you have to test them over and over again. Apps become bigger and bigger so regression tests last longer and longer. In such cases automated testing would be the best option. But what am I to do when software keeps changing? That’s when patters come in handy, as they let you write code that can easily be modified. 

Below you will find descriptions of the two most popular design patterns used by testers at Goyello. 

  • Page Object Pattern – every Web app tester (almost) always has to deal with many different pages of an app that is being developed. Page Object is the best solution in such situations. It lets you have an exact representation of the tested page in code. What’s even more important, all the elements of the page are mapped in one fragment of code only. In  practice it means that if an object is modified on a page you are testing, code must be modified in one place only. You don’t have to change your test scenarios or write your code from scratch. You can also implement Page Object with the Selenium framework. 

To sum up, Page Object: 

  • is a class that serves as a page interface, 
  • reduces code duplication, 
  • makes your testing more permanent and clear, 
  • adds logical structure to code. 
  • Data Driven Testing – Let’s take a look at another design pattern that may facilitate your work. It lets you perform tests based on data saved in external files. You can keep input data there, e.g. test users’ data or names and prices of products. You can also save output data there, the ones you want to validate, e.g. the expected result, the final amount for the shopping cart or the list of error messages. The external files may be: data bases, spreadsheets, XML files, etc. Of course, you’d better ask an experienced developer for help when implementing the data. You need to work out the best way of loading them. The most important thing is to keep it consistent throughout the project. 

To sum up: 

  • Test data can be saved in files that can easily be modified. 
  • Data are not hardcoded.  


#6 Programming languages – where should I start? 

Plenty of readers may be surprised to learn that programming is not about knowing languages. Programming is a way of thinking. In theory learning of a programming language is not a difficult task. If you want to learn it, you will. A more difficult one is to start using analytical thinking and break every problem down to the smallest bits possible. You also have to be aware of the way computers understand commands we humans give them. All that knowledge comes with time, experience and the number of problems you have to solve. 

At the beginning of your programming journey you need to ask yourself a question:”What language should I learn?” When I was at the university, I started with C++. I had an ambitious lecturer so I also managed to learn a little bit of Asembler. I was so much keen on studying Java then! Eventually, I ended up in a commercial .NET project. 

It doesn’t really matter what language you will choose. First, you need to develop habits that will help you effectively avoid obstacles and mistakes while writing your code. You have to teach your brain abstract thinking because you are going to need it in your everyday work. 

What should you pay attention to? 

  • Break your tasks down to the smallest bits possible – You get a large task and you throw up your hands not knowing where to start? Break the problem down to smaller bits which, dealt with one by one, will eventually let you deal with the entire big issue. 
  • Think first. Then code – Never do the opposite. 90% of success is proper planning and thinking out your solution carefully. If you don’t know what to do or you are not sure if you are thinking in the correct direction, ask a more experienced person. Discussing and analysing your code is a way of learning new things as well. 
  • Be systematic – the more you know, the more… you know. 😉 When you start your programming education, you may sometimes get a feeling that “it’s simply too much, I will never learn all that stuff”. That’s true, in a way. Programming covers a really vast area and it is most probably impossible to learn everything. If you are systematic, though, you will soon notice results of your work. The more information and experience you gather, the better you will understand what programming is all about. And that’s because you will start noticing more and more connections between separate issues and realize programming is a coherent whole.   

Now when you know you want to follow this path and you have learned the basics, let’s focus on the languages you can study. You have the following options: 

  • Java – It’s a multi-platform language, easy to integrate with mobile solutions so Java developers are really wanted. Java lets you develop ready to use apps and system software. 
  • C# – It is similar to Java but based on a Windows platform and it uses .NET libraries. 
  • C i C++ – These are basic languages if you want to deal with system low-level programming.  
  • PHP – It’s a server-side scripting language, used mainly to develop large and dynamic websites.  
  • Python – One of the easiest ones to learn. It has a clear syntax and is used as a scripting language. 

And if you have already learned to code, don’t forget about the following important issues: 

  • Pay attention to naming conventions – Every programming language has its set of rules related to text formatting. If you follow the rules your code is readable and clear. Classes, functions, variables – all these elements have their characteristic formatting guidelines that you should always follow.   
  • Apply ready to use solutions – Don’t reinvent the wheel. You can be 99% sure a problem you are trying to solve has already been solved by someone and you will find the solution somewhere on the Internet. 
  • Use tools – Every language has a set of tools that will come in handy in your everyday work. Learn how to use them effectively.  

That’s not the end of the Decalogue (yet). More topics – coming very soon. Meanwhile, do spare a while to study on your own. It will also be great to learn about your experience with testing tools – leave a comment below.