What to learn first: Selenium UI Automation or API Test Automation? If you are a QA Analyst (manual testing) with some coding skills, and want to learn Test Automation
The Short Answer:
Start with API Test Automation training
Note that the term API is synonymous with REST API a.k.a. RESTful webservice. For the purpose of this article, we are focusing on REST APIs only. (We won’t mention SOAP based Webservices again!)
Scope of this article or some context around the information provided in here:
At Automation School®, one of the first things QA professionals — usually very experienced at manual testing but with limited coding skills — ask us when they first talk to us is: How can I start learning “Selenium / Java automation”?
What comes out of our ensuing discussion with them and our general advice to them is summarized as follows. (Notice how we advise that they do UI Automation with Selenium as Step 2 not Step 1.)
Note: The information below is not comprehensive and kept at a high level to not delve into too many details, while highlighting the important points on why you should get API Test automation training first before you dive deep into Selenium/UI Automation.
- Learn the basics of how a REST API works
- Gain hands-on working knowledge of writing automated API tests until you feel confident in your automation skills
Step 2: Gradually get into UI Test Automation (Selenium-based) with Java
UI Test Automation is notoriously unreliable, so if you are going to do it, you must do it right! Some suggestions:
- Since there are many languages you can use to do UI Automation with Selenium, we suggest you start by learning a classic Object Oriented (OO) language like Java.
- (Later, you can apply the OO principles you learned with Java to a different language for UI automation e.g. C#/Selenium or Python/Selenium, if you need to switch languages. This is why you need to learn the fundamentals of Java/OO well, so it’s easy to switch later to a different language or tool!)
- Gain medium-level or higher hands-on proficiency in the core aspects of Java / OO
- Learn how to do Selenium / Java automation using the Page Object Model pattern, with configurable “smart” timeouts (definitely don’t use Thread sleep!) and with configurable browser types for a clean design
- Using the OO principles and general software engineering best practices, practice writing maintainable and reusable UI Automation code
- Once again, if you can’t do UI Automation well, don’t bother doing it! Because the UI automated tests will keep failing (not because the underlying application under test is failing!) and you will give up due to the maintenance nightmare. Happens all the time!
Step 3 : Mobile Test Automation, Continuous Integration (CICD) etc.
We will skip the details on this for now as our focus is on Steps 1 and 2.
Why prioritize API Test Automation?
Here are some reasons why, also noted visually in the Test Automation pyramid:
- Development organizations highly value API test automation because you can get a lot of test coverage quickly (compared to UI automation). According to a well-known Test Automation best practice, organizations ought to do more of API test coverage than UI Automation. This is because the Return on Investment (ROI) on API Test Automation is much higher than on UI automation. The classic Test Automation Pyramid (simplified version) illustrates this:
- API Test Automation is relatively easy to learn as there are fewer concepts to grasp, and fewer patterns to “master”, to get up and running than UI Test Automation, resulting in a gentler and higher ROI learning curve. It’s really a win-win road to take.
- One of the key reasons why API testing is more efficient to perform than UI Automation is because API testing deals with the core barebones “data” (e.g. the Response JSON) and not on the superficial aspects of presentation elements in the UI around the core data, which is what UI Automation focuses on.
Do I need to learn Selenium / UI Automation also in addition to API Test Automation? If yes, why?
Test coverage is needed at many tiers of the application. (See the link to the : Practical Test Pyramid in the references below.) Because the main goal of testing is to catch as many bugs at all layers of the application at the lowest cost (the lower the better in the pyramid). But there are cases where you need to automate some critical flows in the UI layer. For example, consider the Login / Registration / Forgot Password flows of a high traffic web email website or the Checkout flows of a high traffic eCommerce website: it’s absolutely critical that these UI flows are always tested after deployment, because of the business risk/impact if they are broken, and hence they make good candidates for UI Automation as they need to be tested frequently without fail!
Conclusion (for now :) )
Bottom line, any well rounded mid-level Automation Engineer should know both API Test Automation and Selenium/UI Automation. Our only advise is that you approach them in that order and not jump directly to UI Automation.
Once you get pretty good at both API and UI Automation, you are primed to build upon it to learn and master Mobile Application Test Automation (e.g. with cross-platform Appium or native libraries), hooking up CICD pipelines with Jenkins, Bamboo etc and perform other more advanced forms of Automation.
We will share more information on this topic in an upcoming post. Until then, best of luck to all of you.
Need more information? Contact us and we will help you out!
Send us your questions. Or please add your comment here.
References / Suggested Reading
Source Code Control Using GIT Variables, Assignment Literals, Operators, Basic Control Flow Advanced Operators, Control…automationschool.com
tags: The test pyramid is a way of thinking about different kinds of automated tests should be used to create a…martinfowler.com
API testing tool s are more important now than ever. As we move towards more Agile shift-left software development…www.joecolantonio.com
Ham is a software developer and consultant at ThoughtWorks in Germany. Being tired of deploying software manually at 3…martinfowler.com