Connector Testing
Connector Testing Guide
Fast & Decisive connector validation for production readiness
Quick Start
# 1. Set up credentials
cp config/connector-test.example.env .env
# Edit .env with your actual credentials
# 2. Run all connector tests
make connectors-verify
# 3. Check results
ls -la connector-test-report-*.jsonOverview
The connector testing framework provides comprehensive validation of external service integrations with:
- β Live API Testing - Real authentication and CRUD operations
- π₯ Record/Replay - Cassette-based testing for CI/CD
- π Detailed Reports - JSON reports with performance metrics
- π Credential Safety - Automatic sanitization of sensitive data
- β‘ Fast Execution - Parallel testing with timeout controls
Supported Connectors
| Connector | Status | Operations | Auth Method |
|---|---|---|---|
| ServiceNow | β Production Ready | Create, Read, Update, Sync, Webhooks | Basic Auth |
| Jira Service Management | β Production Ready | Create, Read, Update, Sync, Webhooks | API Token |
| PagerDuty | π§ In Development | Events, Incidents, Services | API Key |
Test Modes
1. Live Testing (Default)
Tests against real external services with actual credentials.
# Test all configured connectors
make connectors-verify
# Test specific connector
make test-servicenow
make test-jira2. Record Mode
Records API interactions to cassettes for later replay.
# Record new interactions
CASSETTE_MODE=record make test-servicenow
# Recordings saved to tests/cassettes/
ls tests/cassettes/servicenow/3. Replay Mode (CI/CD)
Uses recorded cassettes for fast, deterministic testing.
# Run tests in replay mode (no real API calls)
CASSETTE_MODE=replay make test-all
# Perfect for CI/CD pipelinesSetting Up Test Credentials
ServiceNow Developer Instance (Free)
-
Sign up for ServiceNow Developer Instance
- Go to https://developer.servicenow.com/
- Click “Start Building” β “Request Instance”
- You’ll get a unique instance like
dev12345.service-now.com
-
Configure Test User
- Log into your instance as admin
- Navigate to System Security β Users and Groups β Users
- Create a test user with
incident_manageroritilrole - Ensure read/write access to the
incidenttable
-
Set Environment Variables
export SERVICENOW_URL=https://dev12345.service-now.com export SERVICENOW_USERNAME=test_user export SERVICENOW_PASSWORD=test_password
Jira Service Management (Free Tier)
-
Create Atlassian Account
- Go to https://www.atlassian.com/
- Sign up for Atlassian Cloud account
- Create a site:
yourname.atlassian.net - Enable Jira Service Management (free for up to 3 agents)
-
Configure API Access
- Create a “Service Management” project with key “ITSM”
- Go to Settings β System β API tokens
- Create API token for your account
- Verify project has “Incident” issue type
-
Set Environment Variables
export JIRA_URL=https://yourname.atlassian.net export JIRA_USERNAME=your-email@company.com export JIRA_API_TOKEN=your-api-token export JIRA_PROJECT_KEY=ITSM
Environment Configuration
# Create .env file from template
cp config/connector-test.example.env .env
# Edit .env with your actual credentials
# The testing framework will automatically load theseWhat The Tests Validate
Connection Tests
- Validate authentication credentials
- Confirm API accessibility and permissions
- Test rate limiting and error handling
CRUD Operations
- Create test incidents in external systems
- Read back created incidents to verify data
- Update incident titles and descriptions
- Validate field mappings (severity, status, priority)
Integration Validation
- Test webhook payload parsing
- Verify error handling (401, 404, 429, 500)
- Benchmark performance (<1s connections, <2s operations)
- Generate detailed JSON reports
Test Execution Results
Expected Output
π§ͺ Testing ServiceNow Connector
ββββββββββββββββββββββββββββββββββββββββ
π Connection ... β
PASSED (245ms)
π Health Check ... β
PASSED (123ms)
π Create Incident ... β
PASSED (567ms)
π Get Incident ... β
PASSED (234ms)
π Update Incident ... β
PASSED (445ms)
π Field Mappings ... β
PASSED (12ms)
π Webhook Validation ... β
PASSED (34ms)
π Test Results Summary
=======================
ServiceNow: 7/7 passed
Jira: 6/6 passed
Overall: 13/13 tests passed (100.0%)
π Detailed report saved to: connector-test-report-20240824-103045.json
Report Format
Test reports include:
- Connection metrics - Response times, authentication status
- API coverage - Endpoints tested, success rates
- Performance data - P50, P95, P99 response times
- Error analysis - Failed requests with detailed diagnostics
- Field mapping validation - Data transformation accuracy
Troubleshooting
Authentication Failures
β Connection ... FAILED (1.2s)
Error: authentication failed with status 401Solutions:
- Verify credentials in
.envfile - Check user permissions in ServiceNow/Jira
- Confirm API endpoints are accessible
- Validate API token hasn’t expired
Network Issues
β Connection ... FAILED (30.0s)
Error: connection timeoutSolutions:
- Check internet connectivity
- Verify ServiceNow/Jira instance URLs
- Confirm firewall/proxy settings
- Test direct browser access to APIs
Rate Limiting
β οΈ Create Incident ... PASSED (2.1s)
Warning: Rate limited, automatically retriedExpected behavior - Tests include automatic retry logic with exponential backoff.
Advanced Configuration
Custom Test Scenarios
Create custom test files:
# Create custom test scenario
cat > tests/scenarios/custom.json << EOF
{
"name": "Custom Incident Test",
"steps": [
{"action": "create", "severity": "SEV-1", "title": "Custom test incident"},
{"action": "update", "field": "description", "value": "Updated description"},
{"action": "close", "resolution": "Resolved"}
]
}
EOF
# Run custom scenario
make test-scenario SCENARIO=customPerformance Benchmarking
# Run performance benchmarks
make benchmark-connectors
# Results include:
# - Connection establishment times
# - API operation latencies
# - Throughput measurements
# - Resource utilizationCassette Management
# List existing cassettes
ls -la tests/cassettes/
# Clean old cassettes
make clean-cassettes
# Record specific test scenarios
CASSETTE_MODE=record TEST_FILTER=ServiceNow make test-connectorsCI/CD Integration
GitHub Actions Example
name: Connector Tests
on: [push, pull_request]
jobs:
test-connectors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run connector tests (replay mode)
run: |
CASSETTE_MODE=replay make test-all
env:
# No real credentials needed in replay mode
SERVICENOW_URL: https://mock.service-now.com
JIRA_URL: https://mock.atlassian.netProduction Gates
# Add to deployment pipeline
make connectors-verify || exit 1
# Requires 100% test pass rate for deploymentSecurity Considerations
Credential Protection
- Never commit real credentials to version control
- Use environment variables or secure credential stores
- Rotate test credentials regularly
- Monitor test account activity in external systems
Data Sanitization
Test framework automatically sanitizes:
- Authentication tokens and passwords
- Personal identifiable information (PII)
- Internal system identifiers
- Sensitive configuration values
Network Security
- Use HTTPS-only connections for all API calls
- Validate SSL certificates in production mode
- Implement request signing where supported
- Enable audit logging for test activities
Getting Help
Debug Mode
# Enable verbose logging
DEBUG=true make test-servicenow
# Save detailed logs
make test-servicenow 2>&1 | tee connector-debug.logSupport Resources
- Development Guide - Local development setup
- Integration Documentation - Connector-specific guides
- API Reference - REST API documentation
- GitHub Issues - Bug reports and feature requests
Next Steps:
- Configure ServiceNow Integration - Detailed ServiceNow setup
- Configure Jira Integration - Jira Service Management configuration
- Set up PagerDuty - PagerDuty connector configuration