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|
      print 'Before Queue Hook - run before test suite'
    end
    
    # this will be run after set of tests fetched from Queue has been executed
    KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
      print 'After Subset Queue Hook - run after subset of test suite'
    end
    
    KnapsackPro::Hooks::Queue.after_queue do |queue_id|
      print 'After Queue Hook - run after test suite'
    end
    
    
  • Minitest in knapsack_pro Queue Mode supports hooks:

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

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