Knapsack Pro

Check out the new docs for the updated documentation.

FAQ / knapsack_pro / General questions for knapsack_pro gem

What hooks are supported in Queue Mode?

  • RSpec in knapsack_pro Queue Mode supports hooks:

    
    # spec_helper.rb or rails_helper.rb
    KnapsackPro::Hooks::Queue.before_queue do |queue_id|
      puts 'Before Queue Hook - run before the test suite'
    end
    
    # this hook will be run before a set of tests fetched from the Queue API is executed
    KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
      puts 'Before Subset Queue Hook - run before the subset of the test suite'
    end
    
    # this hook will be run after a set of tests fetched from the Queue API has been executed
    KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
      puts 'After Subset Queue Hook - run after the subset of the test suite'
    end
    
    KnapsackPro::Hooks::Queue.after_queue do |queue_id|
      puts 'After Queue Hook - run after the test suite'
    end
    
    
  • Minitest in knapsack_pro Queue Mode supports hooks:

    
    # test/test_helper.rb
    KnapsackPro::Hooks::Queue.before_queue do |queue_id|
      puts 'Before Queue Hook - run before the test suite'
    end
    
    KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
      puts 'Before Subset Queue Hook - run before the subset of the test suite'
    end
    
    KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
      puts 'After Subset Queue Hook - run after the subset of the test suite'
    end
    
    KnapsackPro::Hooks::Queue.after_queue do |queue_id|
      puts 'After Queue Hook - run after the test suite'
    end
    
    
  • Cucumber in knapsack_pro Queue Mode supports hooks:

    
    # features/support/knapsack_pro.rb
    KnapsackPro::Hooks::Queue.before_queue do |queue_id|
      puts 'Before Queue Hook - run before the test suite'
    end
    
    KnapsackPro::Hooks::Queue.before_subset_queue do |queue_id, subset_queue_id|
      puts 'Before Subset Queue Hook - run before the subset of the test suite'
    end
    
    KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
      puts 'After Subset Queue Hook - run after the subset of the test suite'
    end
    
    # this hook is not supported and won't run
    KnapsackPro::Hooks::Queue.after_queue do |queue_id|
      puts 'After Queue Hook - run after the test suite'
    end
    
    

# General questions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.