Secure API Automation That Never Leaves Our Network
A CSV-driven JMeter suite, embedded in Jenkins, running entirely inside the Office network — automating 32 APIs, saving 12 minutes per API and an estimated $50K, with zero licence cost and zero cloud dependency.
Case Study: A CSV-driven JMeter suite, embedded in Jenkins, running entirely inside the Office network.
The Numbers First
| Metric | Value |
|---|---|
| APIs automated | 32 |
| Manual effort saved per API | 12 minutes |
| Estimated cost saved | ~$50K |
| Licence cost | $0 |
| Cloud dependency | Zero |
The Problem
Our internal APIs lived entirely inside the corporate network — they were never exposed to the internet, and for good reason. Security policy was strict: no API traffic was allowed to leave the perimeter.
That created a real challenge for automation. Most cloud-based API testing tools were immediately ruled out. SaaS platforms, hosted CI runners, external test orchestration services — all off the table. The test suite had to run inside the network, or it wouldn't run at all.
At the same time, the team was spending roughly 12 minutes per API on manual regression checks every release cycle. With 32 APIs in scope, that was over 6 hours of manual effort per release — effort that added no value and introduced human error.
We needed a solution that was:
- ✅ Fully air-gapped — no data leaves the network
- ✅ Zero licence cost — no SaaS subscriptions
- ✅ Maintainable by the team without deep scripting knowledge
- ✅ Integrated into the existing Jenkins CI/CD pipeline
- ✅ Data-driven — easy to add new APIs without touching test logic
The Architecture
The solution was straightforward once we committed to the constraints:
Test CSV → Jenkins → JMeter → Internal APIs
Everything runs inside the Office network. Jenkins triggers JMeter as a build step. JMeter reads test data from a CSV file, executes requests against internal API endpoints, and reports results back to Jenkins. No cloud. No external dependencies.
Why JMeter?
JMeter is often thought of as a load testing tool, but it is an excellent API automation engine when used correctly:
- Free and open source — zero licence cost
- Runs anywhere Java runs — perfect for on-premise Jenkins agents
- CSV Data Set Config — native support for data-driven testing
- Assertions — response code, response body, JSON path, duration
- Jenkins integration — via the Performance Plugin or simple shell execution
Why CSV-Driven?
The CSV approach was the key to maintainability. Instead of hardcoding API details into the test plan, all test cases live in a structured CSV:
api_name,method,endpoint,expected_status,payload_file
Get User Profile,GET,/api/v1/users/profile,200,
Create Order,POST,/api/v1/orders,201,payloads/create_order.json
Update Inventory,PUT,/api/v1/inventory/123,200,payloads/update_inventory.json
Delete Session,DELETE,/api/v1/sessions/abc,204,
Adding a new API to the suite means adding one row to the CSV. No JMeter knowledge required. No test plan edits. The QA team owns the data; the framework owns the execution.
The Jenkins Pipeline
The Jenkins job is simple by design:
pipeline {
agent { label 'internal-agent' } // runs inside the network
stages {
stage('Run API Suite') {
steps {
sh '''
jmeter -n \
-t test-plans/api-regression.jmx \
-l results/results.jtl \
-e -o results/html-report \
-JCSV_PATH=test-data/api-suite.csv \
-JBASE_URL=http://internal-api-gateway.corp
'''
}
}
}
post {
always {
perfReport sourceDataFiles: 'results/results.jtl'
publishHTML([
reportDir: 'results/html-report',
reportFiles: 'index.html',
reportName: 'JMeter API Report'
])
}
}
}
The internal-agent label ensures the job only runs on a Jenkins agent that sits inside the corporate network. The base URL is passed as a JMeter property so the same test plan works across environments (dev, staging, production) by simply changing the parameter.
The JMeter Test Plan Structure
API Regression Suite
└── Thread Group (1 thread, 1 iteration per CSV row)
├── CSV Data Set Config
│ └── Reads: api_name, method, endpoint, expected_status, payload_file
├── HTTP Request Sampler
│ ├── Method: ${method}
│ ├── Path: ${endpoint}
│ └── Body: (conditional — loaded from file if payload_file is set)
├── Response Assertion
│ └── Response Code = ${expected_status}
├── JSON Extractor (optional — for chained requests)
└── JSR223 PostProcessor (Groovy — for custom validation logic)
The key insight is using 1 thread with loop count = CSV row count. This is not a load test — it is a functional regression suite. One virtual user, iterating through every API in the CSV, asserting correctness.
Handling Authentication
Internal APIs used OAuth2 with short-lived tokens. The solution was a JSR223 PreProcessor that fetches a fresh token before the test run and stores it as a JMeter property:
import groovy.json.JsonSlurper
def conn = new URL("http://internal-auth.corp/oauth/token").openConnection()
conn.setRequestMethod("POST")
conn.setDoOutput(true)
conn.outputStream.write(
"grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}"
.getBytes("UTF-8")
)
def response = new JsonSlurper().parse(conn.inputStream)
props.put("ACCESS_TOKEN", response.access_token)
conn.disconnect()
Every subsequent HTTP Request sampler then adds the header:
Authorization: Bearer ${__P(ACCESS_TOKEN)}
Token refresh is handled automatically at the start of each Jenkins run. No manual token management.
The Results
After rolling this out across all 32 internal APIs:
Before:
- Manual regression: ~6.5 hours per release
- Human error rate: occasional missed assertions
- Release confidence: moderate
After:
- Automated regression: ~8 minutes per Jenkins run
- Human error rate: zero (assertions are code)
- Release confidence: high
The ~$50K estimated saving comes from engineering time recovered across a full year of release cycles — time that moved from repetitive manual checking to actual feature work.
What We Learned
1. Constraints drive good architecture. The "no cloud" requirement forced us toward a simpler, more maintainable solution than we might have built otherwise.
2. CSV-driven beats hardcoded every time. The test plan has not changed in months. The CSV grows every sprint. That separation of concerns is the right model for API regression.
3. JMeter is underrated for functional testing. Most teams only think of it for load testing. As a functional API runner inside a CI pipeline, it is fast, reliable, and costs nothing.
4. Jenkins agents are your security boundary. Pinning jobs to internal agents is a simple, auditable way to enforce network policy in CI/CD.
Download the Full Case Study
The complete write-up, including the full JMeter test plan structure, CSV schema, Jenkins pipeline configuration, and Groovy scripts, is available as a PDF:
Download: Secure API Automation — Full Case Study (PDF)
Madeshwaran Kotteswaran is a Technical Architect specialising in Test Automation with 18+ years of experience building quality engineering systems for enterprise platforms.
Explore Topics
Written by
Madeshwaran Kotteswaran
Content creator and writer sharing insights and stories.