Testing in Production: A Detailed Guide

July 2024 · 6 minute read

Let’s start with the obvious question.

Table of Contents

What is Testing in Production?

Always be clear on this: testing in production is not releasing untested code in the hope that it works and/or waiting for the bugs to be detected once it is being used by end-users.

Testing is production basically lets a DevOps team prepare for possible bugs. It is common for bugs to end up in production. If the team is prepared to handle such bugs, then they can be resolved much quicker via continuous monitoring. This is what testing in production aims to accomplish.

Production testing can also be important for analyzing user experience. A/B testing is an important tool employed at this stage, which helps monitor how a new or recently updated feature is being received by the target users.

Why Test on Production when you can test on Staging?

  •  The fact that the staging cluster is usually much smaller than the production cluster means that configuration options for almost every service are going to be different. This applies to configurations of queues, databases, load balancers, etc. In case these configurations are stored in a database or a key value (Consul, Zookeeper), then auxiliary systems also need to be established in the staging environment to ensure that it interacts with these systems in the same way as the production environment.
  • Inadequate monitoring of the staging environment. Even if monitoring is enough, staging monitoring signals could be inaccurate since one has to monitor a completely different environment from the production environment.
  • How to test in production?

    Production testing can be conducted in two major ways:

    1. A/B Testing: One way to test in production is to implement A/B testing. This basically means that two versions of a website or app or feature are released to gauge if users prefer one over the other.

    For example, let’s say that some changes have been made to the “Cart” feature of an e-commerce website. To gauge if the changes lead to higher checkout rates, A/B testing is needed. It would involve releasing two versions of the site. Version A would be the original – with no changes to the Cart. Version B would be released with the changes.

    Now the A/B test mechanism would record the checkout rates for both versions. If more users checkout on Version B of the site, then it is proved to provide a better user experience.

    Since A/B testing can only be successful with real users, it is not possible to perform it outside the production environment. When done effectively, it provides much-needed feedback for developers/testers/other stakeholders.

    2. Continuous Monitoring: By continuous monitoring of a prod environment after software deployment, teams can identify issues with the software that could only occur in prod. For example, identifying slow loading pages in a web application becomes completely different in prod. This is because a page may load easily in staging with a smaller data set and less traffic. In production, it is a whole other story.

    Monitoring the time it takes for a web server to process requests will give real-world data about what users will face while using the site. Needless to say, slow page loading is quite disruptive to user experience and needs to be fixed as quickly as possible.

    Best Practices for Testing in Production

    Testing in production is quickly becoming a non-negotiable part of the testing pipeline. With millions of users accessing a single piece of software from thousands of different devices, browsers, browser versions, and operating systems, it is impossible to predict and solve all bugs without real user experience. Production testing provides unique benefits to DevOps aligned developers and organizations. By allowing devs to be better prepared for dealing with anomalies, it contributes to creating better user experiences, brand credibility, and higher revenue. Undoubtedly, it is an essential aspect of software development in the current age.

    ncG1vNJzZmivp6x7o77OsKqeqqOprqS3jZympmeXqralsY6tnKysmaO0brXNZqerp5SqsLW1zqc%3D