Skip to main content

IdiomarkD Testing Guide

Comprehensive testing approach for IdiomarkD (Idiomark for Developers) implementation.

Testing Strategy​

Unit Tests​

Location: packages/core/src/__tests__/

Test SuitePurposeStatus
migration-idiomarkd.test.tsBackward compatibility Idiomark → IdiomarkD✅
extraction-idiomarkd.test.tsBehavioral analysis from code samples✅
integration-idiomarkd.test.tsPlatform-agnostic integration✅
scenarios-idiomarkd.test.tsBehavioral scenario validation✅

Running Tests​

# Run all tests
npm test

# Run specific test suite
npm test -- packages/core/src/__tests__/scenarios-idiomarkd.test.ts

# Run with coverage
npm run test:coverage

Integration Tests​

HTTP API Testing​

The IdiomarkD API server runs on port 4000.

# Start the server
cd packages/idiomarkd-api
pnpm dev

Health Check:

curl http://localhost:4000/health
# Expected: {"status":"ok","service":"idiomarkd-api","version":"1.0.0","timestamp":"..."}

Analyze Endpoint:

curl -X POST http://localhost:4000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{"code_samples":[{"filePath":"test.ts","content":"const x = 1","language":"typescript"}]}'

Expected Response:

  • Status: 200
  • Body contains behavioral, confidence, sampleCount, meta

Error Cases:

# Missing code_samples
curl -X POST http://localhost:4000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{}'
# Expected: {"error":"code_samples array required","statusCode":400}

# Too many samples
curl -X POST http://localhost:4000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{"code_samples":['$(seq 1 101 | xargs -I{} echo '{"filePath":"test{}.ts","content":"x"}' | tr '\n' ',')']}'
# Expected: {"error":"max 100 samples per request","statusCode":400}

Web Playground Testing​

  1. Start all services:

    # Terminal 1: Web app
    cd web && pnpm dev

    # Terminal 2: IdiomarkD API
    cd packages/idiomarkd-api && pnpm dev
  2. Visit http://localhost:3000/playground/idiomarkd

  3. Test cases:

    • Empty input shows validation error
    • Single file analyzes correctly
    • Multiple files work
    • Results display in all tabs
    • Export button works
    • Loading states show correctly

Manual Testing Checklist​

1. Code Sample Extraction​

  • Extract from public repository
  • Extract from private repository
  • Extract with custom sample size
  • Extract with specific file extensions
  • Extract excluding test files
  • Verify error handling for missing repos

2. Behavioral Analysis​

  • Verify cognitive style detection
  • Check code structure calculation
  • Validate naming convention extraction
  • Review error handling patterns
  • Analyze testing approach
  • Check code review style

3. Profile Validation​

  • Validate against IdiomarkD schema
  • Check required fields present
  • Verify confidence scores 0-1
  • Check enum values are valid
  • Validate behavioral layer completeness

4. Editor Integrations​

  • VS Code: Load profile, check status bar, apply transformation
  • Cursor: Load profile, verify prompt injection
  • Copilot: Check configuration injection (limited API)

Scenario Testing​

Cognitive Styles​

StyleExpected CodeTest Case
iterative_refinementLoops with gradual refinement✅
divide_conquerModular functions✅
mvp_firstSimple implementation first✅
spike_firstExperimental prototypes⏳

Code Structures​

PreferenceExpected PatternTest Case
High functional (0.7+).map(), .filter()✅
Low functional (0.3-)For loops✅
Short functions (<20)Single-purpose functions✅

Naming Conventions​

ConventionVariablesTypesConstants
camelCaseuserNameUserServiceMAX_RETRIES
PascalCaseUserNameUserServiceMaxRetries
UPPER_SNAKEUSER_NAMEUSER_SERVICEMAX_RETRIES

Error Handling​

PhilosophyPatternTest Case
graceful_degradationtry-catch with returns✅
fail_fastEarly validation throws✅
defensiveNull checks everywhere⏳

Testing Approaches​

TemperamentExpected PatternTest Case
pragmatic_not_zealousCore path tests✅
tdd_zealotFull coverage with mocks✅
exploratoryTests during development⏳

Validation Criteria​

Successful Test​

  • ✅ All tests pass
  • ✅ Confidence scores are reasonable (> 0.5)
  • ✅ Behavioral dimensions match manual inspection
  • ✅ Profile validates without errors

Needs Investigation​

  • ⚠️ Low confidence (< 0.5)
  • ⚠️ Inconsistent patterns across samples
  • ⚠️ Test failures with valid profiles

Real Developer Validation​

Preparation​

  1. Create Test Plan

    • Define testing scenarios
    • Prepare test repositories
    • Set success criteria
  2. Recruit Testers

    • Target 3-5 developers
    • Vary experience levels
    • Include different specialties
  3. Generate Initial Profiles

    • Extract from public code
    • Create IdiomarkD files
    • Document confidence levels
  4. Conduct Study

    • 2-week testing period
    • Daily feedback mechanism
    • Weekly check-ins
  5. Analyze Results

    • Compare generated vs expected
    • Collect qualitative feedback
    • Document discrepancies

Success Metrics​

  • ✅ Generated code "feels like mine" > 80%
  • ✅ Behavioral preferences accurate > 70%
  • ✅ Would use in production > 60%
  • ✅ Overall satisfaction > 3.5/5

Issue Tracking​

Document issues found during testing:

IssueSeverityDescriptionResolution
Low confidenceHighToo few samplesIncrease sample size
Wrong patternsMediumAnalysis errorCheck algorithm
Validation errorsLowSchema mismatchUpdate validator
PerformanceHighSlow extractionOptimize AST

Test Data​

Sample Repositories​

Use for testing:

Public Repos:

Test Account:

  • Create dedicated GitHub account for testing
  • Use test repos to avoid conflicts

Continuous Integration​

Add to CI/CD pipeline:

# .github/workflows/test-idiomarkd.yml
name: Test IdiomarkD
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm test