Crystalball is a Ruby library which implements Regression Test Selection mechanism originally published by Aaron Patterson. Its main purpose is to select a minimal subset of your test suite which should be run to ensure your changes didn't break anything.
Please check our installation instructions.
Start MapGenerator in your
spec_helperbefore you loaded any file of your app. E.g.
if ENV['CRYSTALBALL'] == 'true' Crystalball::MapGenerator.start! do |config| config.register Crystalball::MapGenerator::CoverageStrategy.new end end
Run your test suite with Crystaball enabled on clean master branch with green build.
CRYSTALBALL=true bundle exec rspec .This step will generate file
tmp/crystalball_data.ymlin your project root. This file contains useful profiling data for Crystalball.
- Make some changes to your app code
bundle exec crystalballto build a prediction and run RSpec with it. Check out RSpec runner section for customization details.
Keep in mind that as your target branch (usually master) code changes your execution maps will become outdated, so you need to regenerate execution maps regularly.
Crystalball workflow can be divided into 2 parts. 1. Full build profiling where Crystalball gathers some data about your RSpec suite for later use in predictions. This is where map generators do their job. 2. Actual predicting where Crystalball uses profiling info from step above and tries to get best prediction possible. This is where predictors do their job.
Both of these steps can be heavily customized and enchanted based on your project specifics and your needs.
You might want to check:
- map generators docs for details related to suite profiling.
- predictors docs for details related to actual prediction.
- runner docs for runner configuration details.