Tuesday, September 8, 2009

Better testing of form elements in Cucumber using form fieldsets


# Scenario:
# Sometimes too form elements --> messy!
# Also elements have same label names --> webrat won't know how to distinguish them
#
# Solution:
# Separate logical groupings of elements into fieldsets
# Cucumber test the fieldsets

# In feature file
When /../ do
Given I focus on XXX section
...
end

# In step definition file
Given /^I focus on "([^\"]*)" section do |section|
set_fielset_context(section)
end

No comments:

Blog Archive