Comprehensive integration testing orchestrator with parallel technology analysis and strategy generation
<codex_skill_adapter>
$test-generate-integration-test.$test-generate-integration-test as {{SC_ARGS}}.{{SC_ARGS}} as empty.spawn_agent(...) patterns to Codex spawn_agent(...).update_plan.config.toml when the original command mentions MCP.test:generate:integration-test.$test-generate-integration-testSTEP 1: Initialize comprehensive integration testing session with technology analysis
/tmp/integration-test-session-$SESSION_ID.json# Initialize integration testing session state
echo '{
"sessionId": "'$SESSION_ID'",
"targetProject": "'{{SC_ARGS}}'",
"detectedTechnologies": [],
"architecturePattern": "auto-detect",
"integrationPoints": [],
"testingStrategy": "comprehensive",
"frameworkRecommendations": []
}' > /tmp/integration-test-session-$SESSION_ID.json
STEP 2: Parallel technology stack analysis with sub-agent coordination
TRY:
IF codebase_size > 50 files OR multiple_technologies_detected:
LAUNCH parallel sub-agents for comprehensive technology analysis:
Agent 1: Backend Framework Analysis: Analyze server-side technologies and frameworks
Agent 2: Database & Storage Analysis: Identify data persistence layers and testing strategies
Agent 3: Message Queue & Event Systems: Analyze asynchronous communication patterns
Agent 4: External Service Integration: Map third-party dependencies and API integrations
Agent 5: Infrastructure & Deployment: Analyze containerization and deployment patterns
Sub-Agent Coordination:
# Each agent reports findings to session state under respective domains
echo "Parallel technology analysis launched for comprehensive integration testing strategy..."
echo "Results will be synthesized into tailored testing recommendations"
ELSE:
EXECUTE streamlined single-technology analysis:
# Single-technology analysis for smaller projects
echo "🔍 Analyzing focused integration testing requirements..."
STEP 3: Architecture pattern recognition and integration point mapping
Architecture Pattern Detection:
# Microservices detection
if fd "docker-compose" . -e yml -e yaml | head -1 >/dev/null; then
echo "🏗️ Microservices architecture detected - service-to-service testing required"
fi
# Monolithic pattern detection
if fd "(main\.rs|main\.go|app\.py|Application\.java)" . | head -1 >/dev/null; then
echo "🏛️ Monolithic architecture detected - module integration testing focus"
fi
# Event-driven pattern detection
if rg "(kafka|rabbitmq|event|saga|cqrs)" . --ignore-case -l | head -1 >/dev/null; then
echo "⚡ Event-driven architecture detected - event flow testing required"
fi
Integration Point Discovery:
# API endpoint discovery
echo "🔍 Discovering API integration points:"
rg "(POST|GET|PUT|DELETE|PATCH).*[\"']\/.*[\"']" . --type-add 'code:*.{js,ts,rs,go,java,py}' --type code -o | head -10
# Database connection analysis
echo "🗄️ Analyzing database integration requirements:"
rg "(connection.*string|database.*url|db.*host)" . --ignore-case -l | head -5
# External service detection
echo "🌐 Identifying external service dependencies:"
rg "(api\..*\.com|\.googleapis\.|stripe\.|paypal\.|oauth)" . -l | head -5
STEP 4: Framework-specific integration testing strategy generation
CASE detected_primary_technology:
WHEN "deno":
Deno Fresh Integration Testing Strategy:
// Integration test setup with Fresh 2.0 patterns
import { assertEquals } from "@std/assert";
import { createHandler } from "$fresh/server.ts";
import { TestDatabase } from "./utils/test-database.ts";
Deno.test("API integration test suite", async (t) => {
const testDb = new TestDatabase();
await testDb.setup();
await t.step("user creation flow", async () => {
const handler = createHandler(manifest, {
database: testDb.connection,
});
const response = await handler(
new Request("http://localhost/api/users", {
method: "POST",
body: JSON.stringify({ name: "Test User", email: "[email protected]" }),
headers: { "Content-Type": "application/json" },
}),
);
assertEquals(response.status, 201);
// Verify database persistence
const user = await testDb.query("SELECT * FROM users WHERE email = $1", ["[email protected]"]);
assertEquals(user.length, 1);
});
await testDb.cleanup();
});
WHEN "rust":
Rust Axum Integration Testing Strategy:
// Integration tests with TestContainers and real database
use axum_test::TestServer;
use sqlx::PgPool;
use testcontainers::{clients::Cli, images::postgres::Postgres, Container};
#[tokio::test]
async fn test_user_creation_integration() {
let docker = Cli::default();
let postgres_image = Postgres::default();
let postgres_container = docker.run(postgres_image);
let connection_string = format!(
"postgres://postgres:postgres@localhost:{}/postgres",
postgres_container.get_host_port_ipv4(5432)
);
let pool = PgPool::connect(&connection_string).await.unwrap();
sqlx::migrate!("./migrations").run(&pool).await.unwrap();
let app = create_app(pool.clone()).await;
let server = TestServer::new(app).unwrap();
let response = server
.post("/api/users")
.json(&serde_json::json!({
"name": "Test User",
"email": "[email protected]"
}))
.await;
response.assert_status_created();
// Verify database state
let user = sqlx::query!("SELECT id, name, email FROM users WHERE email = $1", "[email protected]")
.fetch_one(&pool)
.await
.unwrap();
assert_eq!(user.name, "Test User");
}
WHEN "go":
Go ConnectRPC Integration Testing Strategy:
package integration_test
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)
func TestUserServiceIntegration(t *testing.T) {
ctx := context.Background()
// Setup PostgreSQL test container
pgContainer, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{
Image: "postgres:15",
ExposedPorts: []string{"5432/tcp"},
Env: map[string]string{
"POSTGRES_PASSWORD": "test",
"POSTGRES_DB": "testdb",
},
WaitingFor: wait.ForListeningPort("5432/tcp"),
},
Started: true,
})
assert.NoError(t, err)
defer pgContainer.Terminate(ctx)
// Get database connection
port, err := pgContainer.MappedPort(ctx, "5432")
assert.NoError(t, err)
dbURL := fmt.Sprintf("postgres://postgres:test@localhost:%s/testdb?sslmode=disable", port.Port())
// Setup service with real database
userService := setupUserService(dbURL)
// Test user creation through ConnectRPC
createReq := connect.NewRequest(&userv1.CreateUserRequest{
Name: "Test User",
Email: "[email protected]",
})
resp, err := userService.CreateUser(ctx, createReq)
assert.NoError(t, err)
assert.Equal(t, "Test User", resp.Msg.User.Name)
// Verify database persistence
var count int
err = db.QueryRow("SELECT COUNT(*) FROM users WHERE email = $1", "[email protected]").Scan(&count)
assert.NoError(t, err)
assert.Equal(t, 1, count)
}
WHEN "java":
Java Spring Boot + Temporal Integration Testing Strategy:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Testcontainers
class UserWorkflowIntegrationTest {
@Container
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:15")
.withDatabaseName("testdb")
.withUsername("test")
.withPassword("test");
@Autowired
private TestRestTemplate restTemplate;
@Autowired
private UserRepository userRepository;
private TestWorkflowEnvironment testWorkflowEnv;
private WorkflowClient workflowClient;
@BeforeEach
void setUp() {
testWorkflowEnv = TestWorkflowEnvironment.newInstance();
workflowClient = testWorkflowEnv.getWorkflowClient();
// Register workflow and activities
Worker worker = testWorkflowEnv.newWorker("user-task-queue");
worker.registerWorkflowImplementationTypes(UserRegistrationWorkflowImpl.class);
worker.registerActivitiesImplementations(new UserActivitiesImpl(userRepository));
testWorkflowEnv.start();
}
@Test
@Transactional
void testUserRegistrationWorkflow() {
// Start workflow
UserRegistrationWorkflow workflow = workflowClient.newWorkflowStub(
UserRegistrationWorkflow.class,
WorkflowOptions.newBuilder()
.setWorkflowId("test-user-registration-" + UUID.randomUUID())
.setspawn_agentQueue("user-task-queue")
.build()
);
UserRegistrationRequest request = new UserRegistrationRequest(
"Test User",
"[email protected]",
"secure-password"
);
// Execute workflow
UserRegistrationResult result = workflow.registerUser(request);
// Assert workflow completion
assertThat(result.isSuccess()).isTrue();
assertThat(result.getUserId()).isNotNull();
// Verify database state
Optional<User> user = userRepository.findByEmail("[email protected]");
assertThat(user).isPresent();
assertThat(user.get().getName()).isEqualTo("Test User");
assertThat(user.get().isEmailVerified()).isTrue();
}
@AfterEach
void tearDown() {
testWorkflowEnv.close();
}
}
STEP 5: External service integration and contract testing implementation
Service Virtualization Setup:
# Generate WireMock configuration for external services
cat > wiremock-mappings.json << 'EOF'
{
"mappings": [
{
"request": {
"method": "POST",
"url": "/api/payments",
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": "{\"id\": \"payment-123\", \"status\": \"completed\"}"
}
}
]
}
EOF
Contract Testing with Pact:
// Consumer-driven contract testing setup
const { Pact } = require("@pact-foundation/pact");
const path = require("path");
const provider = new Pact({
consumer: "user-service",
provider: "payment-service",
port: 1234,
log: path.resolve(process.cwd(), "logs", "pact.log"),
dir: path.resolve(process.cwd(), "pacts"),
});
describe("Payment Service Contract", () => {
beforeAll(() => provider.setup());
afterAll(() => provider.finalize());
test("processes payment successfully", async () => {
await provider.addInteraction({
state: "user has valid payment method",
uponReceiving: "a payment request",
withRequest: {
method: "POST",
path: "/payments",
headers: { "Content-Type": "application/json" },
body: { amount: 100, currency: "USD" },
},
willRespondWith: {
status: 200,
headers: { "Content-Type": "application/json" },
body: { id: "payment-123", status: "completed" },
},
});
const response = await makePayment({ amount: 100, currency: "USD" });
expect(response.status).toBe("completed");
});
});
STEP 6: CI/CD integration and automation pipeline setup
GitHub Actions Integration Testing Workflow: