Iterator behaviour

I have a harness I’m using for testing with Watir. It has become
apparent that the iterator is loading the tests defined based on the
order they appear in the directory as opposed to the order in the
testlist.

File.open(‘testlist.txt’).each_line do |entry|
self.send(:define_method, entry.strip){ load “#{entry.strip}.rb”}

so if the testlist read something like

test_aac
test_aab
test_aaa

instead of executing them in the order above it would do

test_aaa
test_aab
test_aac

I’m probably being thick, but I’m not spotting where my iterator is
going wrong?

I’m doing the ugly thing just now and using something like this

test_001_aaa
test_002_aac
test_003_aab

obviously this isn’t nice as it necessitates retaining a mapping of
tests to order, which is what I wanted to avoid. I had wanted to be able
to select lists of any tests in any order, thus creating suites out of
arbitrary test components.