test-metrics-reporter
v1.4.6
Published
Parse JUnit XML test results and report metrics to MongoDB with comprehensive testing and CI/CD integration
Maintainers
Readme
test-metrics-reporter
Parse JUnit XML test results and store metrics in MongoDB.
Installation
npm install test-metrics-reporterQuick Start
# CLI usage
npx test-metrics-reporter \
--project-name "my-project" \
--run-name "test-run" \
--xml-path ./test-results.xmlFeatures
- Parse JUnit XML test results
- Store metrics in MongoDB
- Support for multiple test suites
- CLI and programmatic interfaces
- TypeScript support
Configuration
Set environment variables:
MONGO_URI=mongodb://localhost:27017
DATABASE_NAME=test_metrics
COLLECTION_NAME=test_resultsProgrammatic Usage
const TestMetricsReporter = require('test-metrics-reporter');
const reporter = new TestMetricsReporter({
mongoUri: process.env.MONGO_URI,
database: process.env.DATABASE_NAME
});
await reporter.report({
projectName: 'my-project',
runName: 'test-run',
xmlPath: './test-results.xml'
});CLI Options
--project-name- Project identifier (required)--run-name- Test run identifier (required)--xml-path- Path to JUnit XML file(s)--wdio-pattern- Glob pattern for WDIO XML files--wdio-files- Specific WDIO XML files (space-separated)--build-id- Build identifier--environment- Test environment--tags- Comma-separated tags--env-file- Path to environment file
Requirements
- Node.js >= 16.0.0
- MongoDB >= 4.0
License
MIT
