unified-report-generator
v1.0.14
Published
A unified performance report generator that combines JMeter, Playwright, and Azure metrics into a single dashboard
Maintainers
Readme
Unified Report Generator
A unified performance report generator that combines JMeter load test results, Playwright UI test results, and Azure server metrics into a single, navigable HTML dashboard.
Features
- Multi-Source Integration: Combines JMeter, Playwright, and Azure metrics
- Configurable Features: Enable/disable automation and AI analysis sections
- Standalone Reports: Generate self-contained HTML reports
- Azure Integration: Configurable Azure metrics fetching
- AI Analysis: Optional AI-powered insights using Google Gemini
Installation
npm install unified-report-generatorGetting Started
Follow these steps to get started with Unified Report Generator:
Step 1: Install the Package
npm install unified-report-generatorStep 2: Create Configuration File
Create a config.js file in your project root. You can start by copying the example:
# Copy the example config (if you have it)
cp config.example.js config.js
# Or create a new config.js file manuallyImportant: If your config.js contains hardcoded sensitive values (API keys, credentials), add it to .gitignore:
echo "config.js" >> .gitignoreFor CI/CD pipelines: If your config.js only uses environment variables (like the example above), you can safely commit it. Your pipeline should inject environment variables at runtime.
Step 3: Set Up Environment Variables (Recommended)
Create a .env file in your project root for sensitive configuration:
# .env file
GEMINI_API_KEY=your_gemini_api_key_here
AZURE_SUBSCRIPTION_ID=your_subscription_id
AZURE_RESOURCE_GROUP=your_resource_group
AZURE_LOAD_TEST_RESOURCE=your_load_test_resource
AZURE_LOAD_TEST_DATA_PLANE_URI=your_data_plane_uriSecurity: Always add .env to your .gitignore (it should never be committed):
echo ".env" >> .gitignoreNote: The .env file is for local development only. In CI/CD pipelines, use your pipeline's environment variables/secrets management instead.
The package automatically loads environment variables from .env files using dotenv.
Step 4: Configure Your Settings
Edit config.js and customize it for your project:
export default {
features: {
automation: true, // Set to false if you don't have Playwright results
aiAnalysis: true, // Set to false if you don't want AI analysis
},
ai: {
apiKey: process.env.GEMINI_API_KEY || '', // Loads from .env file
model: 'gemini-2.5-pro',
},
azure: {
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID || '',
resourceGroup: process.env.AZURE_RESOURCE_GROUP || '',
loadTestResource: process.env.AZURE_LOAD_TEST_RESOURCE || '',
loadTestDataPlaneUri: process.env.AZURE_LOAD_TEST_DATA_PLANE_URI || '',
appComponents: [
// Add your Azure resources here
],
},
outputDir: '.artifacts/unified-report', // Where reports will be generated
paths: {
jmeterCsvPath: 'jmeter', // Path to your JMeter CSV files
playwrightReportPath: 'playwright-report', // Path to Playwright reports
azureDataPath: 'unified-report/azure', // Path to Azure data
},
};See config.example.js for a complete example with all available options.
Step 5: Prepare Your Test Data
Ensure your test artifacts are in the expected locations:
- JMeter CSV: Place your JMeter results CSV file in
.artifacts/jmeter/ - Playwright Reports: Place Playwright reports in
.artifacts/playwright-report/(if automation is enabled) - Azure Data: Azure metrics can be fetched automatically, or place data in
.artifacts/unified-report/azure/
You can customize these paths in config.paths if your structure is different.
Step 6: Generate Your First Report
Run the report generator:
# Basic usage (uses config.js in current directory)
npx unified-report
# Or with custom config file
npx unified-report --config ./config.js
# Or with custom output directory
npx unified-report --output ./my-reports
# Or specify artifacts directory
npx unified-report --artifacts ./.artifactsThe report will be generated at .artifacts/unified-report/index.html (or your custom output directory).
Step 7: View Your Report
Open the generated report:
# On macOS
open .artifacts/unified-report/index.html
# On Linux
xdg-open .artifacts/unified-report/index.html
# On Windows
start .artifacts/unified-report/index.htmlOr use the standalone option for a single-file report:
npx unified-report --standalone
# Generates: .artifacts/unified-report/unified-report-standalone.htmlNext Steps
- Customize User Types: Update
userTypesin config to match your JMeter thread groups - Configure Azure Resources: Add your Azure resources to
appComponentsarray - Enable/Disable Features: Toggle
automationandaiAnalysisin config based on your needs - Add to CI/CD: Integrate report generation into your pipeline scripts
Quick Start (Summary)
For experienced users, here's the minimal setup:
# 1. Install
npm install unified-report-generator
# 2. Create config.js (see config.example.js)
# 3. Create .env with your credentials
# 4. Generate report
npx unified-reportConfiguration
Configuration File
Create a config.js file in your project root. See config.example.js for a complete example.
Output Directory
outputDir: Default output directory for generated reports (default:.artifacts/unified-report)- Can be relative to current working directory or absolute path
- CLI
--outputflag overrides this setting
Feature Flags
features.automation: Enable/disable Playwright automation sections (default:true)features.aiAnalysis: Enable/disable AI analysis generation (default:true)
AI Configuration
ai.apiKey: Google Gemini API key (can also useGEMINI_API_KEYenv var)ai.model: Primary model to use (default:'gemini-2.5-pro')ai.fallbackModels: Array of fallback models if primary fails
Azure Configuration
All Azure details should be configured in config.azure:
subscriptionId: Azure subscription IDresourceGroup: Azure resource grouploadTestResource: Azure Load Testing resource nameloadTestDataPlaneUri: Azure Load Testing data plane URIappComponents: Array of Azure resources to monitor
Important: Never hard-code Azure credentials or sensitive information. Use environment variables or secure configuration management.
Configuration Details
Required vs Optional Settings
Minimum required for basic report:
- None! The package will work with just JMeter CSV files using default settings.
Recommended for full functionality:
config.jsfile with your paths configured- Azure configuration (if you want Azure metrics)
- AI API key (if you want AI analysis)
For Azure metrics fetching:
- Azure CLI installed and authenticated (
az login) - Azure configuration in
config.jsor environment variables
Configuration File Structure
Your config.js should export a default object. See config.example.js for the complete structure with all available options.
CLI Usage
unified-report [options]Options
--config, -c <path>: Path to configuration file (default:config.jsin current directory)--standalone, -s: Generate standalone HTML report (all data embedded)--no-automation: Disable Playwright/automation sections (overrides config)--enable-automation: Enable Playwright/automation sections (overrides config)--no-ai-analysis: Disable AI analysis (overrides config)--enable-ai-analysis: Enable AI analysis (overrides config)--output, -o <dir>: Output directory (overridesconfig.outputDir, default:.artifacts/unified-report)--help, -h: Show help message
Examples
# Generate standard report
unified-report
# Generate standalone report
unified-report --standalone
# Use custom config and disable automation
unified-report --config ./my-config.js --no-automation
# Custom output directory with AI analysis enabled (CLI override)
unified-report --output ./reports --enable-ai-analysis
# Using config file for default output directory
# In config.js: outputDir: './reports'
unified-report # Will use ./reports from configProgrammatic Usage
import { generateUnifiedReport, generateStandaloneUnifiedReport, loadConfiguration } from 'unified-report-generator';
// Load configuration
const config = await loadConfiguration('./config.js');
// Generate standard report
await generateUnifiedReport({
config,
outputDir: './reports', // Optional
artifactsDir: './.artifacts', // Optional
});
// Generate standalone report
await generateStandaloneUnifiedReport({
config,
outputDir: './reports',
});Output Structure
The generator creates the following structure:
.artifacts/
└── unified-report/
├── index.html # Master dashboard
├── unified-report-standalone.html # Standalone report (if --standalone)
├── jmeter/
│ ├── summary.html
│ └── transactions/
│ └── *.html
├── playwright/ # Only if automation enabled
│ └── summary.html
├── azure/
│ └── summary.html
└── ai-analysis/ # Only if AI analysis enabled
└── summary.htmlSecurity Best Practices
- Commit
config.jsif it only uses environment variables - Safe to commit when usingprocess.env.*patterns - Don't commit
config.jsif it contains hardcoded secrets - Add to.gitignoreif you have hardcoded API keys or credentials - Use environment variables for sensitive data:
apiKey: process.env.GEMINI_API_KEY || '', subscriptionId: process.env.AZURE_SUBSCRIPTION_ID || '', - For CI/CD pipelines: Commit
config.jswith environment variable references, then inject actual values via pipeline environment variables or secrets - Use
config.example.jsas a template for documentation - Rotate credentials regularly
- Limit access to environment variables and secrets in your pipeline/CI system
Environment Variables
The following environment variables are supported:
GEMINI_API_KEY: Google Gemini API key for AI analysisAZURE_SUBSCRIPTION_ID: Azure subscription IDAZURE_RESOURCE_GROUP: Azure resource groupAZURE_LOAD_TEST_RESOURCE: Azure Load Testing resource nameAZURE_LOAD_TEST_DATA_PLANE_URI: Azure Load Testing data plane URI
Troubleshooting
Package Not Found After Installation
# Make sure you're using npx to run the CLI
npx unified-report
# Or add to your package.json scripts:
{
"scripts": {
"report": "unified-report"
}
}Config File Not Found
- Ensure
config.jsexists in your project root (or current working directory) - Or specify the path explicitly:
npx unified-report --config /path/to/config.js - Check that the file exports a default object:
export default { ... }
Environment Variables Not Loading
- Ensure you have a
.envfile in your project root - The package automatically loads
.envfiles usingdotenv - Verify environment variable names match exactly (case-sensitive)
- Check that values don't have extra spaces or quotes
AI Analysis Not Working
- Check that
features.aiAnalysisistruein config - Verify
ai.apiKeyis set orGEMINI_API_KEYenv var is available - Check model name is valid (e.g.,
'gemini-2.5-pro') - Test your API key:
echo $GEMINI_API_KEY(should show your key)
Azure Metrics Not Fetching
- Verify all Azure configuration values are set in
config.jsor.env - Ensure Azure CLI is installed:
az --version - Authenticate with Azure:
az login - Check that
appComponentsarray is properly configured - Verify Azure resource IDs are correct
- The package will automatically fetch the latest test run if
testRunIdis not provided
Automation Sections Missing
- Check that
features.automationistruein config - Verify Playwright test results exist in the configured path (default:
.artifacts/playwright-report/) - Check that
--no-automationflag is not set - Update
paths.playwrightReportPathin config if your reports are elsewhere
JMeter CSV Not Found
- Check that JMeter CSV files are in the configured path (default:
.artifacts/jmeter/) - Update
paths.jmeterCsvPathin config if your CSV files are elsewhere - Verify the CSV file is from a recent JMeter test run
Report Generation Errors
- Check that output directory is writable
- Verify you have read permissions for artifact directories
- Check console output for specific error messages
- Ensure all required files (JMeter CSV, etc.) exist before generating report
Development
For contributors and developers working on the package itself:
Project Structure
unified-report-generator/
├── bin/
│ └── cli.js # CLI entry point
├── src/
│ ├── generateUnifiedReport.js
│ ├── fetchAzureMetrics.js
│ ├── generateAIAnalysis.js
│ └── config/
│ ├── defaultConfig.js
│ └── configLoader.js
├── config.example.js # Example configuration
├── package.json
├── index.js # Main entry point
└── README.mdSee the GitHub repository for development setup instructions.
License
ISC
Support
For issues and questions, please refer to the project documentation or create an issue in the repository.
