Testing in Production

Rate this content
Bookmark

FAQ

Testing in production means testing your features in the environment where they will actually be used, rather than using a separate staging environment. This approach helps identify issues that may not appear in staging due to differences in data, configurations, or performance.

Common problems with staging environments include data mismatch, configuration drift, slow performance, and lack of priority. These issues can make it difficult to replicate production conditions accurately, leading to undetected bugs and inefficiencies.

Configuration drift occurs when changes made in production to address incidents are not replicated in the staging environment. This creates a divide between staging and production, leading to inconsistent test results and making staging less reliable for testing.

Feature flags allow you to deploy code to production without releasing it to all users. You can target specific internal users for testing while keeping the feature hidden from real end users. Once the feature is confirmed to be bug-free, you can release it to all users with a simple toggle.

The benefits of testing in production include faster release cycles, increased developer velocity, more reliable test results, and higher team confidence. Testing in the actual production environment ensures that features work as expected for real users.

You can automate testing in production by targeting test users with feature flags and creating automated test scripts. Another option is to override feature flags during tests to simulate different scenarios. Using an automation framework and job scheduler can help manage and run these tests efficiently.

To differentiate between real data and test data, you can use a flagging system that identifies test entities (e.g., isTestUser=true). This allows you to separate test data and real data in your data dashboards, ensuring that tests don't interfere with real user data.

Recommended tools for testing in production include Split for feature flagging, Robot Framework for automation, Jenkins or CircleCI for job scheduling, and PagerDuty or Slack for alerting. These tools help streamline the process and ensure reliable test results.

Facilitating testing in production requires a solid automation framework, a supportive testing culture, and a willingness to adopt innovative practices. Teams need to understand the value of testing in production and have the necessary tools and processes in place.

Feature flags help mitigate risks by allowing you to test features with a small subset of users (canary release) or internal users before a full rollout. They also provide a kill switch to quickly disable problematic features without redeploying code, minimizing potential damage.

Talia Nassi
Talia Nassi
29 min
24 Jun, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Talk discusses the concept of testing in production, including challenges with staging environments and data mismatch. The use of feature flags is highlighted as a solution to enable testing in production. Automation is emphasized as a key component for efficient feature flag testing. The benefits of testing in production are increased developer velocity and confidence. Organizational requirements and resistance to testing in production are also addressed. The Talk concludes by discussing feature flag management and user segmentation in feature flag services.
Available in Español: Pruebas en Producción

1. Introduction to Testing in Production

Short description:

Today we're going to talk about how to enable tests in production, including what testing in production is, how to set it up, and common pitfalls. As a former test engineer, I faced challenges with staging environments and data mismatch. The data in staging doesn't always match production, leading to test results that don't align. Configuration drift also creates a divide between staging and production, making testing in staging less reliable. Additionally, staging environments often have slow performance, which doesn't accurately reflect user interactions in production.

Hi, everyone, I'm Talia and today we're going to talk about how to enable tests in production. We're going to talk about what testing in production is, how to set it up and common pitfalls that people usually run into. This is my contact information, my Twitter and my email, in case you guys have questions later.

But a little bit about me, I'm a developer advocate at Split and I used to be a test engineer and I worked in QA and automation and testing for a while before I joined Split. Being a test engineer was really difficult for me because most of the problems that I had revolved around staging and using this dummy environment and staging isn't the same as production. So I would have so many problems and these are some of the problems that I dealt with that I'm sure most of you have dealt with too. If you've dealt with any sort of test environment, any sort of QA environment, anything that's not production. These are some of the things that made it really hard for me to do my job.

So the first problem was data mismatch. So the data and staging doesn't match production, which means test results don't always match. So I used to work really hard on making sure I tested every single product requirement and I would go through the documentation with the product donor and I worked with my developers to fix all the bugs, make sure my end-to-end tests were passing, and then I would sign off on the feature. And as soon as it's launched to production, there would be a bug. And it's such a horrible feeling when there's all this pressure on you to make sure that your feature works in a dummy environment. And then the next thing with data mismatch that happened to me was something called configuration drift. And what this is, is let's say that you get paged one night because there's an incident for your app and you look at the logs and you identify the problems, but in order to fix it, you have to update a specific configuration in production. And so you make the change in production and you go back to sleep. And although you fixed the issue, you've just created an even bigger divide between your staging and your production environments. So this, this divide is called configuration drift. And many times staging environments are not the same as production because of changes made during incident management, which just adds to a bigger configuration drift. And I felt like, what's the point of testing and staging if it's not gonna give me the same results as production?

The next thing, the next problem I had was staging was really slow. There was just really bad performance. And a lot of times when you're writing tests and staging, you often have to add weights and sleeps because things take longer to load. For example, click on a button. Wait 10 seconds for something to happen. Perform this action. Wait another 10 seconds for something to happen. Your user is not gonna wait 10 seconds for something to appear in tech time. That's crazy talk. So that's not how my users are gonna interact with my features in production. So why make that different in staging? Nobody cares if staging is down.

2. Testing Challenges and the Solution: Feature Flags

Short description:

I faced challenges with a bad staging environment and a bad testing experience. Testing in production means testing features and their environment, not using a dummy environment like staging. Big companies like Google, Facebook, Netflix, and Twitter are testing in production. Feature flags separate code deployment from feature release, allowing bug-free releases with a click of a button.

This is another thing that I had to deal with is that I would be assigned to test different issues. To test different hot fix tickets, and these were just critical bug fixes that needed to get immediately released to production. So I would log into staging to test it, but staging would be down. So I have to ping the DevOps guy. But the DevOps guy says, you need to open an IT ticket. And then the IT ticket has to get escalated by my manager. And meanwhile, all I'm trying to do is test this ticket for our product, and nobody seems to care. It's not a priority for anybody. Nobody's going to get a call in the middle of Thanksgiving dinner if staging is down.

And I was so fed up with dealing with a really bad staging environment and a really bad testing experience and being bling for when things didn't work. And I thought there has to be a better way to test software. My end users are not going to log into staging to use my application. They're going to log into production. So I did a ton of homework and I researched what other companies are doing. And this is what I companies are doing. It's the norm for companies to use staging environments, especially companies that are still waterfall.

The next thing is that most companies use more than one staging environment. So staging, preprod, beta, most companies have more than one. And big name companies like Google, Facebook, Netflix, Twitter, they're all testing in production. And when I read that, I thought, what is testing in production? Like how is that possible? What do you mean, testing in production? So testing in production means testing your features and the environment that your features will live in, not using a dummy environment like staging and I thought, wow, this is so perfect. This is going to solve all of my problems. And I also learned that testing in prod doesn't mean you only test in prod, so you're still going to use staging for GDPR and socks related data and privacy issues and I thought, like, this is perfect because what I can't test in production, I would just test in staging, but those critical user flows, I can run those in production and I thought this is great. Like, how do I do this? What are the steps to get there? And the answer was feature flags. And a feature flag is basically just a way to separate code deployment from feature release. And the idea here is you deploy your code to production behind a feature flag, test it in prod, and then release the feature with the click of a button as soon as it's bug free.

So, how does it work? This is kind of what it looks like. So, our developers would create a feature flag from the UI, and then target all of our internal teammates. And what that means is that only the users who are inside of the feature flag while the flag is off, will be able to have access to the feature. So, here you can see devs, testers, product design. Only they are going to have access to this new feature while the feature flag is off, because they're the only ones who are targeted.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Network Requests with Cypress
TestJS Summit 2021TestJS Summit 2021
33 min
Network Requests with Cypress
Top Content
Cecilia Martinez, a technical account manager at Cypress, discusses network requests in Cypress and demonstrates commands like cydot request and SCI.INTERCEPT. She also explains dynamic matching and aliasing, network stubbing, and the pros and cons of using real server responses versus stubbing. The talk covers logging request responses, testing front-end and backend API, handling list length and DOM traversal, lazy loading, and provides resources for beginners to learn Cypress.
Testing Pyramid Makes Little Sense, What We Can Use Instead
TestJS Summit 2021TestJS Summit 2021
38 min
Testing Pyramid Makes Little Sense, What We Can Use Instead
Top Content
Featured Video
Gleb Bahmutov
Roman Sandler
2 authors
The testing pyramid - the canonical shape of tests that defined what types of tests we need to write to make sure the app works - is ... obsolete. In this presentation, Roman Sandler and Gleb Bahmutov argue what the testing shape works better for today's web applications.
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
The talk discusses the importance of supply chain security in the open source ecosystem, highlighting the risks of relying on open source code without proper code review. It explores the trend of supply chain attacks and the need for a new approach to detect and block malicious dependencies. The talk also introduces Socket, a tool that assesses the security of packages and provides automation and analysis to protect against malware and supply chain attacks. It emphasizes the need to prioritize security in software development and offers insights into potential solutions such as realms and Deno's command line flags.
Full-Circle Testing With Cypress
TestJS Summit 2022TestJS Summit 2022
27 min
Full-Circle Testing With Cypress
Top Content
Cypress is a powerful tool for end-to-end testing and API testing. It provides instant feedback on test errors and allows tests to be run inside the browser. Cypress enables testing at both the application and network layers, making it easier to reach different edge cases. With features like AppActions and component testing, Cypress allows for comprehensive testing of individual components and the entire application. Join the workshops to learn more about full circle testing with Cypress.
Test Effective Development
TestJS Summit 2021TestJS Summit 2021
31 min
Test Effective Development
Top Content
This Talk introduces Test Effective Development, a new approach to testing that aims to make companies more cost-effective. The speaker shares their personal journey of improving code quality and reducing bugs through smarter testing strategies. They discuss the importance of finding a balance between testing confidence and efficiency and introduce the concepts of isolated and integrated testing. The speaker also suggests different testing strategies based on the size of the application and emphasizes the need to choose cost-effective testing approaches based on the specific project requirements.
Playwright Test Runner
TestJS Summit 2021TestJS Summit 2021
25 min
Playwright Test Runner
Top Content
The Playwright Test Runner is a cross-browser web testing framework that allows you to write tests using just a few lines of code. It supports features like parallel test execution, device emulation, and different reporters for customized output. Code-Gen is a new feature that generates code to interact with web pages. Playwright Tracing provides a powerful tool for debugging and analyzing test actions, with the ability to explore trace files using TraceViewer. Overall, Playwright Test offers installation, test authoring, debugging, and post-mortem debugging capabilities.

Workshops on related topic

Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn
How to Start With Cypress
TestJS Summit 2022TestJS Summit 2022
146 min
How to Start With Cypress
Featured WorkshopFree
Filip Hric
Filip Hric
The web has evolved. Finally, testing has also. Cypress is a modern testing tool that answers the testing needs of modern web applications. It has been gaining a lot of traction in the last couple of years, gaining worldwide popularity. If you have been waiting to learn Cypress, wait no more! Filip Hric will guide you through the first steps on how to start using Cypress and set up a project on your own. The good news is, learning Cypress is incredibly easy. You'll write your first test in no time, and then you'll discover how to write a full end-to-end test for a modern web application. You'll learn the core concepts like retry-ability. Discover how to work and interact with your application and learn how to combine API and UI tests. Throughout this whole workshop, we will write code and do practical exercises. You will leave with a hands-on experience that you can translate to your own project.
Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
WorkshopFree
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop
API Testing with Postman Workshop
TestJS Summit 2023TestJS Summit 2023
48 min
API Testing with Postman Workshop
Top Content
WorkshopFree
Pooja Mistry
Pooja Mistry
In the ever-evolving landscape of software development, ensuring the reliability and functionality of APIs has become paramount. "API Testing with Postman" is a comprehensive workshop designed to equip participants with the knowledge and skills needed to excel in API testing using Postman, a powerful tool widely adopted by professionals in the field. This workshop delves into the fundamentals of API testing, progresses to advanced testing techniques, and explores automation, performance testing, and multi-protocol support, providing attendees with a holistic understanding of API testing with Postman.
1. Welcome to Postman- Explaining the Postman User Interface (UI)2. Workspace and Collections Collaboration- Understanding Workspaces and their role in collaboration- Exploring the concept of Collections for organizing and executing API requests3. Introduction to API Testing- Covering the basics of API testing and its significance4. Variable Management- Managing environment, global, and collection variables- Utilizing scripting snippets for dynamic data5. Building Testing Workflows- Creating effective testing workflows for comprehensive testing- Utilizing the Collection Runner for test execution- Introduction to Postbot for automated testing6. Advanced Testing- Contract Testing for ensuring API contracts- Using Mock Servers for effective testing- Maximizing productivity with Collection/Workspace templates- Integration Testing and Regression Testing strategies7. Automation with Postman- Leveraging the Postman CLI for automation- Scheduled Runs for regular testing- Integrating Postman into CI/CD pipelines8. Performance Testing- Demonstrating performance testing capabilities (showing the desktop client)- Synchronizing tests with VS Code for streamlined development9. Exploring Advanced Features - Working with Multiple Protocols: GraphQL, gRPC, and more
Join us for this workshop to unlock the full potential of Postman for API testing, streamline your testing processes, and enhance the quality and reliability of your software. Whether you're a beginner or an experienced tester, this workshop will equip you with the skills needed to excel in API testing with Postman.
Monitoring 101 for React Developers
React Summit US 2023React Summit US 2023
107 min
Monitoring 101 for React Developers
Top Content
WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 
Workshop level: Intermediate
Node.js Masterclass
Node Congress 2023Node Congress 2023
109 min
Node.js Masterclass
Top Content
Workshop
Matteo Collina
Matteo Collina
Have you ever struggled with designing and structuring your Node.js applications? Building applications that are well organised, testable and extendable is not always easy. It can often turn out to be a lot more complicated than you expect it to be. In this live event Matteo will show you how he builds Node.js applications from scratch. You’ll learn how he approaches application design, and the philosophies that he applies to create modular, maintainable and effective applications.

Level: intermediate