December 31, 2019

A Beginner’s Guide to Automated Testing

Automated testing has become a must for any large modern system, much like how boots are a must for any girl’s wardrobe. But we must not be in a hurry to jump on the automation bandwagon. We need to first decide if it is required for our system. There are cases when we would fare better with the age old method of manual testing.

Some examples of when NOT to opt for Automated Testing

  • When we have a rapidly changing system that has not yet had time to understand its true purpose in life.

  • When we have a system so complex that only the human brain could tackle it.

Some examples of when to opt for Automated Testing

  • When testing involves repeated execution of the same test cases that would put the poor tester in a coma if he/she continued for another minute.

  • Regression and Smoke testing where you need to check that you have not broken any currently working stuff (and likely get chewed out by your boss) before going live with your new features or fixes.

So once we decide to jump on the automation bandwagon, the next step is to actually automate the testing. It is one thing to say “yes, it is absolutely necessary”, but it is another to completely implement it. We hear words like Selenium (isn’t that a medicine?), E2E testing, Protractor (the semi circle thing in out geometry box?), Jasmine (flower? perfume?), Mocha , Chai (Coffee or tea?) etc. Now how hard could it be to come up with their own words instead of stealing words that mean something else? So anyway, unless we know about the who’s who of the automated testing world, we cannot proceed.

Who’s Who of Automated Testing

Selenium: Selenium is the ruling king of automated testing tools. Strictly speaking, it is a group of tools that helps to automate the testing of web applications. The reason for Selenium’s popularity is not just because it is open source (and hence free). It does have many other advantages over other currently available tools. A few of which are its support for several languages and frameworks, its cross browser compatibility, its record and playback functionality and a great community base and support.

We can download Selenium tools and learn more about it at https://selenium.dev/

E2E Testing: End to End testing is a method of testing that makes sure that your system will actually work in the real world and you don’t get any unwanted surprises once the system is live. It makes sure to test not only the software of the system, but also how it integrates with external interfaces. So when we plan to automate the testing, we must also make sure we test the system from start to finish.

Protractor: Protractor is an open source E2E testing framework that is used to test web applications. It is built on top of Selenium. Protractor is also immensely popular and has several advantages like its extensibility, support for parallel execution, support for cross browser testing and multiple browser and multiple platform testing, etc.

We can find out how to setup and Protractor and learn more about it at its official website https://www.protractortest.org/#/

TypeScript: So now we come to the actual business of writing the automated scripts. TypeScript is one of the scripting languages that can be used to write your tests. It is again open source, easy to read and understand and a popular choice.

We can download TypeScript and read more about it at https://www.typescriptlang.org/

Jasmine: It is an open source JavaScript testing framework. Jasmine follows what is called BDD, or Behaviour Driven Development, which allows the user to describe the tests in a simple and easily understandable way. It is the default framework that comes with Protractor.

You can get started with Jasmine at https://jasmine.github.io/

Mocha and Chai: Mocha is another JavaScript testing framework used for unit testing and Chai is a library commonly used with it.

Learn more about Mocha here : https://mochajs.org/
Learn more about Chai here : https://www.chaijs.com/

Visual Studio Code: We will also need an editor to write/edit/view our automation scripts. There are several editors available, with Visual Studio Code being the people’s choice; and it is, of course, free. It provides an excellent IntelliSense for typescript with intelligent code completion and other features that generally make our lives much easier.

We can download Visual Studio code and learn more about its features here: https://code.visualstudio.com/

You should have learned at least one thing by now: that the free tools are much more widely used and loved than the ones you have to pay for.

All the best, beginners! You have been introduced to the who’s who of automated testing. You are now ready to venture into this brave new world.

Group 9
Group 9