This project provides a flexible and extensible test suite runner for validating implementations of the specification for securing W3C Verifiable Credentials using JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE).
It's designed to work with different types of implementations (SDK or server) as long as they conform to a common CLI interface via Docker.
The suite makes use Digital Bazaar's mocha-w3c-interop-reporter.
.
├── implementations/
│ ├── docker-compose.yml
│ ├── implementations.json
│ └── [implementation folders]
├── tests/
│ ├── input/
│ └── output/
├── reports/
│ ├── index.html
│ └── suite.log
├── test-mapping.js
├── test-runner.js
├── test-util.js
└── README.md
This file defines the structure of the test suite. It exports two main objects:
TestResult
: An enum of possible test outcomes (success, failure, indeterminate, error).GenericTestMapping
: A mapping of test names to their configurations. Each test configuration includes:
number
: A unique identifier for the testinput_file
: The name of the input file to be usedconfig
: Configuration options for the test, including the check
property which determines the feature being testedexpected_result
: The expected outcome of the testThis is the main test runner script. It:
This file contains utility functions used by the test runner:
generateTestResults
: Executes the Docker command to run a test for a specific implementationcheckTestResults
: Reads and interprets the results of a test executionTo add a new implementation:
implementations/
directory with your implementation name.implementations/implementations.json
to include your new implementation and its supported features:{
"your-implementation-name": {
"features": {
"feature1": true,
"feature2": false,
"feature3": true
}
}
}
Note: if your implementation does not support a feature, set the value to false
. This will cause the test runner to
skip tests for that feature.
implementations/docker-compose.yml
to include your new service:services:
your-implementation-name:
build: ./your-implementation-name
volumes:
- ../tests/input:/tests/input
- ../tests/output:/tests/output
To run the test suite:
node test-runner.js
).There is also an npm script that can be used to run the test suite:
npm run test
The test runner will execute each test for each implementation and generate a report in the reports/
directory.
To add new tests:
tests/input/
directory.test-mapping.js
to include the new test configurations.Each implementation should provide a Docker container that exposes a CLI with the following interface:
validate --input <input_file> --config '<config_json>' --output <output_file>
<input_file>
: Path to the input file within the container<config_json>
: JSON string containing test configuration<output_file>
: Path where the output should be written within the containerThe Docker containers are run using Docker Compose, with volumes mounted to provide access to the input and output directories.
This configuration setup is designed to be flexible and can be modified to suit the specific requirements of each implementation, though it can be modified to suit the specific requirements of a given test suite.
If you encounter issues:
For more detailed debugging:
For any questions or issues not covered in this README, please open an issue in the project repository.