testing-framework
Automated testing and validation for all marketing skills
SKILL.mdskills/testing-framework/SKILL.md
GitHub๐งช Testing Framework
Purpose: Automated testing, validation, and quality checks for all Brand Marketing Team skills.
Continuous Testing Pipeline
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ Gemini โโโโโโ Build & โโโโโโ Validate โโโโโโ Report โ
โ Builder โ โ Test โ โ & Check โ โ Results โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ โ โ โ
โผ โผ โผ โผ
Skill Code Unit Tests Integration GitHub
Generated Jest/Mocha End-to-End Status
Tests Update
Test Types
1. Unit Tests
// Example: pricing-optimizer test
describe('Pricing Optimizer', () => {
test('calculates margin correctly', () => {
const result = calculateMargin(15999, 8500);
expect(result).toBe(46.8);
});
test('never recommends below min margin', () => {
const recommendation = getRecommendation({
currentPrice: 15999,
minMargin: 15,
cogs: 14000
});
expect(recommendation.margin).toBeGreaterThanOrEqual(15);
});
});
2. Integration Tests
// Test skill integration
describe('Competitive Intel Integration', () => {
test('reads brand context correctly', async () => {
const context = await readBrandContext();
expect(context.brandName).toBeDefined();
expect(context.competitors).toBeInstanceOf(Array);
});
test('sends WhatsApp alert on price drop', async () => {
const alert = await sendPriceAlert({
product: 'test-product',
priceDrop: 15
});
expect(alert.sent).toBe(true);
});
});
3. End-to-End Tests
# Full workflow test
npm run test:e2e
# Simulates:
# 1. User runs @competitive-intel watch
# 2. Competitor price drops detected
# 3. Alert sent via WhatsApp
# 4. @pricing-optimizer recommends response
# 5. Copy generated by @copywriting
Quality Checks
Pre-Commit Checks
#!/bin/bash
# .github/hooks/pre-commit
echo "๐ Running pre-commit checks..."
# Lint Markdown
npx markdownlint skills/
# Validate YAML frontmatter
node scripts/validate-frontmatter.js
# Check skill completeness
node scripts/check-skill-completeness.js
# Run unit tests
npm test
echo "โ
All checks passed!"
Skill Validation Rules
Every skill must have:
- Valid YAML frontmatter
- Required fields: name, description, version
- Dependencies declared
- Usage examples
- Safety guardrails documented
- Credits/attribution
Automated Testing Schedule
Schedule:
- Every commit: Unit tests + linting
- Every PR: Integration tests + review
- Daily: Full e2e test suite
- Weekly: Security audit
- Monthly: Performance benchmarking
Commands
# Run all tests
npm test
# Run specific skill tests
npm test -- skills/pricing-optimizer
# Run with coverage
npm run test:coverage
# Run e2e tests
npm run test:e2e
# Validate all skills
npm run validate
# Generate test report
npm run test:report
GitHub Actions Workflow
name: Test & Validate
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run unit tests
run: npm test
- name: Run integration tests
run: npm run test:integration
- name: Validate skills
run: npm run validate
- name: Upload coverage
uses: codecov/codecov-action@v3
Gemini Builder Integration
// scripts/build-with-gemini.js
const { GoogleGenerativeAI } = require('@google/generative-ai');
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
async function buildSkill(skillName) {
const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
const prompt = `
Build a marketing skill for: ${skillName}
Requirements:
- Follow SKILL.md format
- Include usage examples
- Add safety guardrails
- Optimize for Indian mobile market
- Use async/await
- Include error handling
Generate the complete skill code.
`;
const result = await model.generateContent(prompt);
const code = result.response.text();
// Validate generated code
const validation = await validateSkill(code);
if (validation.passed) {
await saveSkill(skillName, code);
await runTests(skillName);
return { success: true };
} else {
return { success: false, errors: validation.errors };
}
}
Test Coverage Requirements
| Component | Minimum Coverage |
|---|---|
| Core functions | 90% |
| Skill logic | 80% |
| API integrations | 70% |
| UI components | 60% |
Reporting
Test Results Dashboard
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Test Results - March 19, 2025 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
Passed: 47 โ
โ โ Failed: 0 โ
โ โ ๏ธ Skipped: 3 โ
โ ๐ Coverage: 87% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Skills Tested: โ
โ โ
competitive-intel โ
โ โ
pricing-optimizer โ
โ โ
copywriting โ
โ โ ๏ธ meta-ads-optimizer (3 skipped) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Credits
Testing framework built with Jest, GitHub Actions, and Gemini integration.
Part of the Brand Marketing Team framework.