Watchdog Dashboard is a Rails engine that provides a visual interface for monitoring the performance and reliability of your RSpec tests. This dashboard is part of the RspecWatchdog ecosystem but is specifically designed to integrate with Rails applications.
- Metrics Visualization: Charts and tables to analyze your test execution times
- Flaky Test Detection: Identify tests that fail intermittently
- Trend Tracking: Monitor the health of your test suite over time
- Comprehensive Statistics: Visualize data such as total runs, failures, and average test times
- Simple Integration: Easy to set up in any existing Rails application
[You can include some screenshots of the dashboard here]
gem 'watchdog-dashboard'Then run:
bundle installbin/rails watchdog_dashboard:install:migrations
bin/rails db:migrateIn config/routes.rb, add:
mount Watchdog::Dashboard::Engine => "/watchdog"This will make the dashboard available at /watchdog in your Rails app.
Create a configuration file in config/initializers/watchdog_dashboard.rb:
Watchdog::Dashboard.configure do |config|
config.watchdog_api_token = "your_secret_token" # Change this to a secure value
endTo get the maximum benefit, you should use Watchdog Dashboard together with the RspecWatchdog gem, which handles data collection during your test execution.
Configure RspecWatchdog in your spec/rails_helper.rb:
require "rspec_watchdog"
RspecWatchdog.configure do |config|
config.show_logs = true
config.watchdog_api_url = "http://localhost:3000/watchdog/analytics"
config.watchdog_api_token = "your_secret_token" # Must match the dashboard token
end
RSpec.configure do |config|
config.add_formatter(:progress) # Default RSpec formatter
config.add_formatter(SlowSpecFormatter)
endImportant: Make sure that the watchdog_api_token matches between RspecWatchdog and Watchdog::Dashboard.
This token is used to validate that requests sent to the dashboard API are legitimate.
- If you're running tests in a CI/CD environment (e.g., GitHub Actions or CircleCI), you can set this value as an environment variable.
- For development environments, you can use a constant value, but make sure not to include it in version control.
Once configured, the dashboard will be available at /watchdog and will display:
- Main Panel: Summary of key metrics and general trends
- Slow Tests: List of tests that take longer to execute
- Flaky Tests: Identification of tests that fail intermittently
- Execution History: Tracking of all test runs
- Settings: Adjustments to customize the dashboard
To make the most of Watchdog Dashboard in a CI/CD environment:
- Configure the token as a secure environment variable in your CI/CD platform
- Ensure your tests send data to the correct endpoint
- Use the dashboard to analyze trends after each CI run
Contributions are welcome. If you have ideas, suggestions, or find a bug, please open an issue or submit a pull request on GitHub.
This engine is available as open source under the terms of the MIT License.



