This directory contains conformance test cases for validating GABP implementations. These tests ensure that implementations correctly handle valid and invalid messages.
- valid/ - Messages that should validate successfully and be accepted
- invalid/ - Messages that should be rejected due to schema violations
Conformance tests serve multiple purposes:
- Verify your implementation handles edge cases correctly
- Test error handling for malformed messages
- Ensure compatibility with the GABP specification
- Validate schema definitions catch expected errors
- Document expected behavior for corner cases
- Regression testing during protocol evolution
- Automated validation that examples conform to schemas
- Prevent accidental breaking changes to schemas
- Ensure consistency between specification and implementation
All messages in valid/ should validate against their respective schemas:
# Test all valid messages against envelope schema
ajv -s ../../SCHEMA/1.0/envelope.schema.json -d 'valid/*.json'
# Test specific method messages
ajv -s ../../SCHEMA/1.0/methods/session.hello.request.json -d 'valid/session-hello-*.json'All messages in invalid/ should fail validation:
# Test invalid messages (should fail)
ajv -s ../../SCHEMA/1.0/envelope.schema.json -d 'invalid/*.json' --invalidThe --invalid flag tells AJV that validation failures are expected.
Test files are named to indicate what they test:
valid-session-hello-basic.json- Basic valid session/hello messageinvalid-missing-version.json- Message missing required version fieldinvalid-wrong-type.json- Message with invalid type field
These tests run automatically in GitHub Actions to ensure:
- All valid messages pass schema validation
- All invalid messages fail schema validation as expected
- Schema changes don't break existing valid messages
- New invalid cases are properly caught
When adding conformance tests:
- Include both positive and negative test cases
- Test edge cases and boundary conditions
- Document what each test validates in comments
- Follow the naming convention for discoverability