From: Shiwei Zhang Date: 2006-12-21T20:46:57+09:00 Subject: Re: iterator behaviour --------------050103010402030204020202 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Max, Can you tell us how you define your define_method? You put "yield" within it, right? I think the iterator in your scenario has no issues. And I think the "iterator" has nothing to do with Watir. I guess you defined your Watir cases respectively in the file "#{entry.strip}.rb". So I propose a possibility as follows: The files are loaded in the sequence of test_aac, test_aab, test_aaa, but their results print in a random sequence depending on how much time needs to be taken before printing the results. You may disclose more details to this mailing list. Shiwei (The views expressed are my own and not necessarily those of Oracle and its affiliates.) Brad Phelan wrote: > Max Russell wrote: > >> 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? >> > > There is nothing wrong with your iterator here. However what > you are doing with your iterator is calling define_method > which will generate methods ( presumably test methods ) > inside your test class. > > I am guessing that the test framework is agnostic as to > the order you define methods. It would probably pull them > off the class with > > Class:instance_methods > > which I will probably generate a list in alphabetical order > which is what you see. > > -- > Brad Phelan > http://xtargets.com > --------------050103010402030204020202--