Table of contents
Testing is still the most arduous, painful, and expensive task within a DevOps practice, regardless of framework or approach. Why? Because the current approaches to testing and development are not focused on production.
Production-Driven Development (PDD), allows for rapid iteration without sacrificing stability or confidence. Following PDD, a small team or single developer can launch an application in weeks that used to take multiple teams months or a year.
About Test-Driven Development and Behavior-Driven Development
The industry practices test-driven Development (TDD—testing early and often) and behavior-driven Development (BDD—keeping in mind the end user and other product owners) for years, but these approaches keep the practice of quality gated in complex workflows, inefficient abstractions, and siloed to the teams responsible for one aspect of the software development lifecycle (SDLC).
Add the common practice of deploying to multiple environments that are checked for quality by manual QA and product owners before deploying to main and you have a very time expensive and inefficient practice.
Rapid iteration is crucial for outpacing your competition and for delivering sooner: these legacy practices hinder that progress.
What is Production-Driven Development?
Production-driven Development is an approach that combines testing and monitoring throughout every step of the SDLC. PDD is focused on increasing confidence, velocity, and quality while reducing the time it takes to launch in production. The approach addresses the inherent inefficiencies of BDD & TDD offering a more streamlined and effective development process.
PDD relies on the following:
- A focus on practicality and efficiency
- A hosting solution that allows fast iteration through preview deployments
- A solution that allows you to test and monitor integration and live deployments
While there are a few options for hosting solutions that offer rapid deployments of persisting branch previews, there is only one solution that allows you to seamlessly blend testing and monitoring of web applications at the time of this writing, Checkly.
PDD-ready solutions:
Vercel: Harnessing the Power of Preview Deployments
Vercel is a leading cloud platform provider known for its JavaScript framework Next.js. It allows for the rapid deployment of persisting preview deployments for every individual branch. The hosting provider also allows us to interact with previously strictly ephemeral environments that provide little ongoing context for why something failed when running in CI.
With Vercel, you can create unlimited previews of PRs before they’re merged, and fixed domains for staging, and production deployments tied to preferred branches. This empowers you to review and interact with previous iterations, ensuring the continuity and quality of your application and bringing in other stakeholders to review and approve if necessary.
Playwright: Leveraging the best of test automation
Playwright is the most rapidly growing testing framework valued for its speed, low overhead, and stability. It’s your best choice if you’re looking at leveraging a modern testing stack for your web application. Playwright can run component (experimental), API, integration, and e2e tests and can provide traces for every test step.
It’s currently also ChatGPT’s front-runner out of Cypress, Playwright, and Selenium.
Checkly: Maximizing Efficiency with Developer-First Synthetic Monitoring
With Playwright and Vercel, we can test, we can deploy, but something is missing.
What if you could validate the stability of this rapidly evolving application just by updating your existing Playwright scripts to run on-demand against preview deployments or in a scheduled fashion against staging or production?
Imagine performing comprehensive checks on these preview deployments beyond traditional testing. You could do integration testing and real e2e across real, live persisting environments.
This is where Checkly comes into play: by leveraging Checkly's developer-first synthetic monitoring, you can transform your Playwright scripts into powerful browser checks. Schedule these checks to continuously monitor your dynamic environments, ensuring stability throughout the development lifecycle.
PDD in Practice — Code, Test, Deploy
The aim of PDD is to focus on practicality, velocity, quality, and confidence. The practice is centered on three simple words; code, test, deploy.
Code
A developer has finished the login for a new application. They submit a PR. A preview deployment is spun up with the changes persisting for continued testing, manual review, or product manager exploration.
And with the preview environment, said developer defined and pushed monitoring resources such as Playwright spec files.
import { test, expect } from '@playwright/test';
test('Login', async ({ page }) => {
await page.goto('https://your-site.com/');
await page.getByRole('link', { name: 'Login' }).click();
await page.getByPlaceholder('jane@example.com').click();
await page.getByPlaceholder('jane@example.com').fill('you@your-site.com');
await page.getByPlaceholder('your password').click();
await page.getByPlaceholder('your password').fill('YOUR_PASSWORD');
await page.getByRole('button', { name: 'Log In' }).click();
});
Test
The only tests that should fire off when this PR is submitted are ones that are useful, reliable, and practical. We make it a point to run and record these tests, so we don’t have to hunt for artifacts and there is a history of our evolving quality.
- You only test things under your control
- A test should be readable and usable in all stages of development
$ npx checkly test --record
Parsing your project... done
Running 2 checks in eu-central-1.
__checks__/production.check.js
✔ Login Check (8s)
✔ Runtimes API endpoint (103ms)
2 passed, 2 total
Detailed session summary at: https://chkly.link/l/a2Owb
Deploy
When your tests pass in the preview environments, you can then immediately deploy those exact same tests as monitoring checks.
This has multiple purposes:
- Your tests for your web application live alongside your synthetic monitors making tracking breaking changes much easier.
- You will know when performance degradations are tied to a code change or your environment’s stability.
- You increase reliability and overall confidence in your application; testing and monitoring are united and not disparate.
$ npx checkly deploy
Parsing your project... done
✔ You are about to deploy your project "Your project" to account "Monitoring as Code". Do you want to continue? … yes
Successfully deployed project "Your project" to account "Monitoring as Code".
The benefits of PDD
By combining tools like Vercel, Playwright, and Checkly, you can create an ecosystem that supports fast iteration, efficient testing, and seamless monitoring. Embracing PDD empowers teams to deliver high-quality software with confidence and gain a competitive advantage in the ever-evolving software development landscape.
Have you embraced PDD already? Join the movement and say Hi in the Checkly community and see hundreds of developers uniting testing and monitoring!