How to advance your test automation skills with source control

public://pictures/ash_winter.jpeg
Ash Winter, Consulting Tester and Speaker, Diagram Industries

If you're a tester and you think you need to get up to speed on coding to become a test automation engineer, you're on the right track. But don't just learn to code. Instead, start by learning about source control, a methodology for tracking and managing changes to your code. 

Not long ago, at an organization where I used to work, the testers were busy creating test automation and tools to manage test data and the application state. All the application code was in source control, but none of the testers' code was. They had zipped and emailed it, copied it to shared file servers, and sent it by instant message, to name a few sharing mechanisms.

As a result, versions diverged wildly, and valuable code was lost or overwritten. That, in turn, led to delayed testing, panic rewrites of tools, and all-around disarray.

Without source control, development teams can end up in a state of chaos. They're often terrified of code changes—as are the test automation engineers. I often meet testers without access to their teams' source control repository. If that's your situation, you won't be able to closely collaborate with your team until you fix this.

You're at a disadvantage as a tester when you can't access or use source control repositories and tools. So you'll need to get up to speed on using source control, rather than just diving into coding.

Here are a few things you need to know to get started and grow as an automation engineer.

World Quality Report 2018-19: The State of QA and Testing

Using source control: Four key advantages

Having access to your team's source control repository will help you in all of these areas. 

1. Collaboration

The source control repository should be your primary collaboration hub. Much communication and collaboration happens within it because it contains a version of your system's and your team's histories.

There are several alternative techniques teams use to collaborate. Usually it's some form of issue-tracking software or a shared wiki page, but in my experience those are the least active.

The truly active oracle for change is the code itself. The most collaborative work takes place there, during code reviews and merges.

2. Risk management 

If you don't know what your team's source control strategy is, you may be unaware of serious risks. Long-lived feature branches might indicate integration problems later on down the line.

If there is an issue on your Kanban board that lasts for a while, for example, there might also be a feature branch that has been alive just as long, and—depending on your release cadence—farther away from your master branch. As a result, code merges might be longer and more difficult, which might even lead to your team having to re-implement sections of code.

3. Quality advocacy

Testers should be strong advocates for quality, and the effective use of source control is one of the leading indicators of quality—not just for code, but for configuration as well. By advocating for more effective use of source control, you'll help your teams achieve better quality outcomes, especially in terms of safety and speed of deployments.

You can advocate for smaller batch sizes for shorter-lived branches and application configuration in source control, and even encourage storing database schema changes.

4. Early testing

Testers often end up having to wait for a build before they can get to work. But instead of waiting for someone to complete a merge and deploy onto a test environment, imagine being able to test the branch that has been created for your new feature straight away. 

Running an application locally or building to an environment from a branch that you could test earlier creates a tighter feedback loop with your team and wider group of stakeholders. Earlier feedback from testing allows product owners to make timely decisions on risks, and developers suffer less context switching, since the testing is in closer cadence.

Use source control as your skills gateway

Learning source control concepts and skills is a gateway to the other technical skills that are valuable for test automation engineers to learn. These include:

Bash 

Although user interfaces exist for popular source control technologies, you will likely be exposed to interactions using the command line, which is where many developers and system administrators spend their time. This then opens the door to bash for UNIX users, with its many commands for teasing out information. Check out Julia Evans' "Wizard Zines" for more helpful information here. 

Establish coding habits

If you have access to application code, you can see the patterns for the code within and learn from them for your own code. Positive behaviors such as striving for single responsibility, appropriate levels of reusability, and sensible abstraction between implementation and test are worth looking out for and adding to your coding toolkit.

The opposite is also true: You can learn from the bad examples within your application code.

Pipeline integration

Without source control, any test automation that you create will be difficult to integrate with your deployment pipeline tooling, where it can add massive post-deployment value. Tools such as Jenkins have built-in source control integration, enabling you to get your test automation code running where it matters. You'll also gain experience adding to your team's pipeline.

[ Webinar: Agile Portfolio Management: Three best practices ]

Where to learn more

My journey into the world of source control began with "The Git Parable" blog post by Tom Preston-Werner. I learn best through storytelling, and this resource teaches concepts with reference to characters and situations that resonate with me. 

If that's not your learning style, check out Pro Git, by Scott Chacon and Ben Straub. Or, if hands-on works best you, try Git-it, which provides a transition to using the command line. For podcast fans, check out allthingsgit. Finally, you can choose from many video courses, but try this one first: It's a bite-sized introduction that assumes very little previous knowledge. 

Get started now

Learning source control is an important step in every test automation engineer's journey. Without it, collaboration with your team, identifying risks, testing early, and advocating for quality will be more challenging.

Source control is also a great gateway to the other skills you'll need to become a highly effective test automation engineer, such as unlocking the potential of the command line, establishing coding habits by recognizing patterns, and integrating your tests with your deployment pipeline. And with the learning resources above, you've got everything you need to get started.

Do you have other great resources you can share to help test engineers get started with source control? Share them in the comments below.