# salesforce ci/cd · chaos testing

Would've blown up
in production.
Caught it in the PR.

On every PR, sf-chaos spins up a scratch org loaded with real-world entropy: recursive triggers, strict validation rules, 50,000 records. It deploys your code, runs your Apex tests, and drops a governor limit report right on the pull request.

$sf plugins install sf-chaos
Read the docs
v0.1.0 Free tier available Node 20+ Salesforce CLI plugin
sf chaos test run --profile heavy-enterprise
$ sf chaos test run --profile heavy-enterprise
▸ Spinning up scratch org
▸ Injecting chaos profile
▸ Deploying source
▸ Running Apex tests142 passed
GOVERNOR LIMITSheavy-enterprise
SOQL Queries87/100
CPU Time8,200/10,000ms
Heap Size4.2/6.0 MB
DML Statements42/150
2 warnings · 0 failures · 14m 22s exit 0

Simulated output. heavy-enterprise profile, 5 triggers · 12 validations · 50,000 records.

# the problem

Every test passes in a clean scratch org.

Code that passes flawlessly in a fresh scratch org can easily shatter when it hits a messy, five-year-old production environment loaded with legacy triggers and strict validation rules. Suddenly, you are dealing with a SOQL 101 error on a Monday morning deployment. sf-chaos simulates this exact entropy right at the pull request stage, letting you catch governor limit breaches during code review rather than in a live incident.

Production deploy · AccountTriggerHandler.cls:84
System.LimitException: Too many SOQL queries: 101
↑ your users should never see this. ↓ sf-chaos surfaces it in the PR.
Move the query out of the loop, bulkify with Map<Id, List<Contact>>.
# one command, five steps

sf chaos test run

01

Scratch org spins up

A clean, isolated, disposable org. Your real org is never touched.

$ sf org create scratch
02

Chaos profile is injected

Triggers, validation rules, and seed data are pushed to the org based on the profile you choose.

$ sf project deploy start
03

Your code is deployed

The metadata in your force-app directory is deployed into this chaotic environment.

$ sf project deploy start
04

Apex tests run

Debug logs are parsed and governor limit consumption is measured for every transaction.

$ sf apex run test
05

Report is generated

Breaking points, limit heat map, and actionable recommendations. Output in three formats.

terminal · json · markdown
The org is always deleted. Pass, fail, or error: it gets cleaned up every time.
# chaos profiles

How much chaos can your code handle?

Each profile simulates a different real-world org. clean is your baseline; trigger-hell is there to stress-test your limits.

clean
Free
Zero injection, empty baseline. Does your code even pass in a clean environment?
medium-enterprise
Free
2 triggers · 4 validations · 5,000 records. A mid-size org.
heavy-enterprise ★★★
Pro
5 recursive triggers · 12 validations · 50,000 records · 3 namespaces. A 5-year-old org.
governor-edge ★★★
Pro
Rides the edge of the limits. SOQL, CPU, and heap pressure all at once.
trigger-hell ★★★
Pro
Nested trigger chains, recursion and mixed-DML traps.
custom profile
Team
Define your own org's chaos. Upload your own trigger and validation sets.
# PR report

You'll know it's breaking before it breaks.

Every run produces a governor limit heat map, a breaking-point risk score, and on the Team tier, error-to-fix suggestions. Here is what the PR comment looks like:

sf-chaos commented · just now
sf-chaos | Chaos Test Report
profile: heavy-enterprise duration: 14m 22s WARNINGS DETECTED
Governor Limit Consumption
SOQL Queries
87/100
CPU Time (ms)
82%
Heap Size
70%
Query Rows
64%
DML Statements
28%
Callouts
0%
CRITICAL · SOQL limit risk

Query inside a loop

AccountTriggerHandler.cls:84

Under chaos conditions SOQL consumption hit 87/100. In production with additional triggers, exceeding the 100 limit is highly likely.

SUGGESTION · Team tier Move the [SELECT … FROM Contact WHERE AccountId = :acc.Id] query outside the loop. Use the Map<Id, List<Contact>> pattern.
terminal · colorized, for local runs json · for CI/CD pipelines, exit code decisions markdown · drops straight into the PR as a comment
# pricing

Start free. Upgrade when your org grows.

Free

$0
10 chaos tests per month · 1 seat
  • + clean + medium-enterprise profiles
  • + Terminal · JSON · Markdown reports
  • + Governor limit gauges
  • + GitHub Actions, GitLab CI, Bitbucket
npm install

Pro

most popular
$49 / mo
100 chaos tests per month · 3 seats
  • + Everything in Free, plus:
  • + heavy-enterprise, governor-edge, trigger-hell
  • + Detailed governor limit heat map
  • + Priority support
Upgrade to Pro

Team

$129 / mo
Unlimited chaos tests · 10 seats
  • + Everything in Pro, plus:
  • + Actionable suggestions · error to fix
  • + Custom profile builder
  • + Slack · Teams notifications
  • + Run history & historical trends
Upgrade to Team

Payments via Lemon Squeezy. Tax included, license key delivered instantly. Cancel anytime.

# add it to your pipeline

Two lines in GitHub Actions.

$npm install -g @salesforce/cli
$sf plugins install sf-chaos
$sf chaos test run --profile heavy-enterprise

clean and medium-enterprise ship bundled. No license key needed, works out of the box.

.github/workflows/chaos-test.yml
name: Salesforce Chaos Test
on:
  pull_request:
    paths: ['force-app/**']
jobs:
  chaos-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm i -g @salesforce/cli && sf plugins install sf-chaos
      - run: sf chaos test run --profile heavy-enterprise --report markdown
        env:
          CHAOS_KEY: ${{ secrets.CHAOS_KEY }}
# about us

Built by Salesforce engineers,
for Salesforce engineers.

We have spent years building and shipping complex architectures on the Salesforce platform. We have debugged the 3 AM production outages caused by a recursive trigger chain nobody documented. We have watched perfectly green CI pipelines deploy code that instantly blew past governor limits in a real org.

sf-chaos exists because we got tired of learning about limit breaches from angry Slack messages. Every chaos profile in the tool is modeled after a real org we have worked in. The governor limit gauges, the breaking-point reports, the fix suggestions: all of it comes from patterns we have seen and fixed dozens of times in the field.

This is not a general-purpose testing tool. It does one thing: it tells you whether your code will survive a real Salesforce org before you push it to one.

10+
Years on the SF platform
6
Chaos profiles shipped
0
Production orgs touched
$ cat /var/log/why-we-built-this.txt "We kept seeing the same pattern: code passes every test in a clean scratch org, gets deployed, and immediately hits SOQL 101 in production because nobody accounted for the 15 other triggers firing on the same object. We built sf-chaos so that never happens again."
The sf-chaos team · shipping from Ankara