Testing in production to most might sound like a recipe for disaster. Not to mention, testing in production already has a bad reputation due to the disasters that tend to occur when this is done in a haphazard fashion.
Like every other industry, as the software industry is evolving, many big names have started adopting this mode of testing as a part of their QA process. Let’s see how testing in production can add value to your QA efforts when done correctly.
What does one mean by testing in production?
How you interpret the phrase ‘testing in production‘ makes all the difference. You might think that testing in production is reckless and meant to go south. That will be the case if you release untested code directly into production with the hope that testing it now in production will be right. Precisely, this is why testers shudder at the thought of testing in production.
Luckily, this is different from what modern QA strategies do when opting for testing in production. Over here, testing in production refers to strategically releasing code that has already been vetted in test environments to a live environment like production in a controlled fashion. This helps gauge the true sentiment of the audience when using the features in real-time.
How is testing in production done?
Now that we understand that testing in production is not a reckless approach but rather a carefully orchestrated way to check pre-tested code in real-world conditions. Here is the best approach to test in production.
Let’s look at the different strategies you can adopt to devise a plan to test effectively in production.
A/B testing is a technique where you compare two versions of a feature or user experience to determine which performs better. In a production environment, you can serve different versions to subsets of your user base and measure the outcomes to make data-driven decisions.
Example: An e-commerce website wants to test two different checkout page designs to see which one results in higher conversion rates. They serve one design to a random subset of users and the other design to another subset. They then analyze user behavior to determine the more effective design.
Canary releases involve deploying a new software version to a small subset of users or servers in the production environment before rolling it out to the entire user base. This helps in the early detection of issues and reduces the blast radius if problems arise. Though similar to A/B testing, it varies in what it intends to do. Canary releases focus on issue mitigation, whereas A/B testing focuses on the reception of the new version within the user base.
Example: A social media app releases a new feature to 5% of its user base before a full rollout. This limited release helps identify any unexpected issues or bugs with a narrow user base before it reaches all users.
Feature toggles/feature flags
Feature toggles or flags allow you to turn specific features or functionality on or off in a production environment without redeploying the software. This enables controlled feature testing and rapid feature rollback if issues occur.
Example: A software application introduces a new payment gateway. Instead of deploying it to all users at once, they use a feature flag to enable it for a small group of users first. If problems arise, they can quickly disable the feature without needing full software redeployment, saving effort, cost, and time.
In a blue-green deployment, two production environments (blue and green) are maintained. When a new version is ready, it is deployed to the inactive environment (e.g., green). After thorough testing, traffic is switched from the old environment (blue) to the new one (green).
Example: An online banking platform maintains two identical production environments labeled “blue” and “green.” A new version is deployed to the “green” environment when it is ready. After rigorous testing, the traffic is seamlessly switched from “blue” to “green,” ensuring minimal downtime and the ability to roll back if needed.
Shadow traffic testing
In shadow traffic testing, a small percentage of production traffic is duplicated and sent to a testing environment where you can evaluate the impact of changes without affecting the primary user experience.
Example: A streaming service duplicates a small percentage of user requests and sends them to a test environment. They use this shadow traffic to assess the performance and reliability of new streaming algorithms without affecting the primary user experience.
Load testing in production involves simulating heavy traffic or load conditions on the live system to assess its performance under stress. This helps in identifying bottlenecks and scalability issues.
Example: An e-commerce platform conducts load testing during peak shopping seasons to simulate heavy traffic. This helps to be sure that its website can handle increased user loads without crashing or slowing down.
Security testing involves scanning the production environment for vulnerabilities, conducting penetration tests, and monitoring suspicious activity to identify and address security issues.
Example: A bank regularly scans its production environment for vulnerabilities, conducts penetration tests, and monitors for suspicious activity to safeguard customer data and financial transactions.
Chaos engineering is the deliberate introduction of controlled failures and chaos into a production system to test its resilience and discover vulnerabilities. This helps make systems more robust and fault-tolerant.
Example: An online marketplace intentionally introduces network failures or server outages in their production environment. It is carried out to assess how well their systems can withstand such disruptions and proactively fix any weaknesses.
Performance monitoring and optimization
Continuously monitoring production systems for performance metrics and optimizing them based on real-world usage data is a form of ongoing testing in production.
Example: A cloud service provider continuously monitors server performance metrics, such as CPU usage and response times. This helps to identify and address performance bottlenecks based on real-world usage patterns.
User acceptance testing (UAT)
UAT can be conducted in a production environment, involving real users or stakeholders who provide feedback and validate that the software meets their requirements.
Example: A healthcare software company conducts user acceptance testing in a production-like environment, allowing healthcare professionals to interact with the system and provide feedback to make sure it meets their clinical requirements.
Compliance and auditing
Production environments often need to adhere to various regulatory and compliance standards. Testing in production includes auditing and verifying compliance with these standards. Here is an informative article about how to build an ADA-compliant app.
Example: A bank conducts regular audits and tests in production to ensure compliance with regulatory requirements, such as KYC (Know Your Customer) and AML(Anti Money Laundering) standards.
Rollback and incident response testing
Testing the ability to roll back to a previous version or respond to incidents in a production environment is crucial for maintaining system stability and minimizing downtime.
Example: A cloud infrastructure provider periodically tests its ability to roll back system updates and responds to simulated incidents (e.g., server failures) in a controlled manner to minimize service disruption.
Data validation and integrity checks
In a production environment, ongoing validation of data integrity and consistency is vital to ensure that data remains accurate and secure.
Example: An online data storage service continuously verifies the integrity and consistency of user data, employing checksums and validation algorithms to prevent data corruption.
Benefits of testing in production
While traditional QA methods primarily rely on pre-production testing environments, testing in production complements these practices by addressing the unique challenges and benefits associated with testing in a real-world production environment.
Realistic testing environment
Production environments mirror the actual conditions in which software operates. This includes real data, configurations, and user interactions. Testing in such an environment provides a more accurate assessment of how software behaves in the real world.
Testing in production also helps identify issues that may not be apparent in pre-production testing environments. These issues can include infrastructure-related problems, third-party service dependencies, and performance bottlenecks that only manifest under real-world loads. Here is a quickstart guide on test environment.
Faster feedback loops
Traditional testing approaches can lead to delays in identifying and addressing issues. Testing in production provides faster feedback, enabling teams to detect and resolve problems in real-time or as they occur, reducing downtime and improving user experience.
Improved test coverage
Testing in production allows QA teams to test scenarios that are difficult to replicate in pre-production environments, such as specific user behaviors, geographic locations, or unexpected edge cases. This helps in achieving comprehensive test coverage. Read here in detail- what is test coverage.
Testing in production emphasizes user-centric testing, ensuring that software meets the needs and expectations of actual users. It provides insights into how users interact with the application and helps optimize user experience.
By reducing the need for extensive pre-production environments and enabling earlier issue detection, testing in production can be a cost-effective approach to QA. testRigor allows sharing test suites and inheriting the test cases, test data, and reusable rules to use in another test suite through testRigor’s shared test suites. It is constructive when you need to share code between iOS and Android tests.
While testing in production offers numerous advantages, it is essential to implement it carefully to minimize risks. This includes using feature flags, canary deployments, and other techniques to isolate and control the impact of changes on production systems. Additionally, security and privacy considerations must be carefully addressed to protect sensitive data and ensure compliance with regulations.
By using a powerful automation testing tool like testRigor, you can further ensure quicker and more reliable testing in production. This AI-powered tool makes test case creation easy and test execution and maintenance even more accessible. If you haven’t tried this tool yet, go ahead and avail yourself of testRigor’s free trial and see how convenient automation testing can be.