What programming language should you choose for your test automation?
In most instances, for test automation, choose the same programming language as your development team. Choosing the same programming language opens up opportunities for collaboration, opens opportunities for stable locator strategies, and makes it easier for DevOps to help you with your CI pipelines.
The one situation where it might be acceptable to choose a different programming language than your dev team is when they are using a very obscure language that isn’t well supported by the community. For example, PHP or Pearl or COBOL, to name a few.
Choose the same programming language as your dev team
Every decision in test automation either makes your life harder or easier. When you choose the same programming language for test automation that your developers use, you drastically increase your chance of success.
1. Same programming language fosters collaboration between Dev + QA
Although I studied Java in college, my first experience with test automation came in the form of QTP aka UFT.
At that time, it was a horrible programming language called VBScript.
At one point, I transitioned jobs and was forced to learn C# because that’s what our whole team was using.
Although it was frustrating initially to learn a new programming language, it ended up being one of the best decisions I have ever made for my career.
Regardless of all the doors that this opened, this allowed me the capability to work closely with the developers to create the best possible test automation.
As a team, we worked closely together to create the most optimal automation strategy.
We worked together to tackle unit and integration tests.
It gets better:
When I needed help from the developers and the architects, they could easily help with their decades of C# development experience.
They would help me to create cleaner code that was better architected.
Ultimately, we all ended up winning as an organization and a team.
2. Same programming language opens opportunities for better locators
If you are using the same programming language as your developers, you can ask them if they will let you add data attributes to the software that you’re testing.
This would look something like this:
<div data-test="shopping_cart_container" class="shopping_cart_container"></div>
These are special attributes that can be used specifically to help with test automation. They will not be modified and will ensure that your locators aren’t brittle.
This is beneficial because it removes your dependency on the developers to provide you unique attributes.👏
It also reduces the workload for the devs since you won’t be asking them to provide you unique locators 👏
3. Same programming language makes software procurement and setup easier
I think you will agree with me when I say that the developers are regarded as the most important players in most organizations. Usually, if developers want some tool, they can get it procured.
As automation engineers, it’s much easier for us to simply ask for a copy of the tools that management has already paid for. Asking for the same IDE, the same CI server, the same development environments.
This is much easier than asking for a special IDE and all other software that you need to do your automation work. Now, we are causing more work for other people.
Furthermore, many organizations have separate DevOps engineers that help to create CI pipelines and procure the VMs to make those pipelines work.
If you have a random toolset that they’re not familiar with, you now introduced even more roadblocks to your automation success.
What if your dev team uses a programming language that isn’t widely supported?
It’s also really important that as automation engineers we are capable of doing our job. Hence, we need to think about the community support for our test automation tools as well.
Choosing something like PHP or Pearl will leave us lonely when we need help with our test automation efforts.
Here’s what to do:
Consider picking a programming language that is simpler
Again, every decision in test automation is one that can keep you in the valley of success or force you out of it. So think wisely about the programming language that you pick.
Do you have excellent programming experience? For example, do you know SOLID? Do you know what it means to prefer composition over inheritance?
Consider picking one of the more popular programming languages
When picking a programming language for test automation, it’s also important to consider your future job opportunities.
Hence, I recommend that you read this article on The Best Programming Languages
This article will help you to decide which programming language has the most potential.
Here’s a table summary:
In 99% of cases, it’s most appropriate to pick the same programming language for your test automation as your developers.
What do you think is the best programming language for test automation?