Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.

Configuration

lkhoward edited this page Mar 18, 2016 · 10 revisions

There are three attributes that Huzzah needs to know in order to function properly. You set the value for these attributes in a configuration block:

Huzzah.configure do |config|
  
  config.path = "#{Dir.pwd}/lib/huzzah"
  
  config.environment = 'prod'

  config.default_driver = 'my_firefox'
end
  • path: The location of your 'huzzah' directory. This directory does not need to be named 'huzzah' and can exist anywhere within your project.

  • environment: The name of the environment that the tests will be run against. The value used here will be referenced in role ans site configuration files.

  • default_driver: The default browser driver. This is a named driver within the Huzzah framework (not to be confused standard browser names within Watir-WebDriver). See Defining Custom Drivers

NOTE: If you are using Cucumber, do NOT put your huzzah directory under features/support. Huzzah needs to load files in a specific order which conflicts with the way Cucumber auto-loads files.

The placement of the configuration block depends on the testing framework you are using. For example, env.rb for Cucumber or spec_helper.rb for RSpec.

If you want to dynamically set these values from the command line and also provide defaults:

Huzzah.configure do |config|
  
  config.path = "#{Dir.pwd}/lib/huzzah"
  
  config.environment = ENV['AUTO_ENV'] ||= 'prod'

  config.default_driver = ENV['DRIVER'] ||= 'my_firefox'
end

Setting the configuration values from the command line when running cucumber:

cucumber features DRIVER=grid_firefox AUTO_ENV=qa

NOTE: The environment variables can have any name you chose.

Clone this wiki locally