[LRUG] YAML iteration

aidy lewis aidy.lewis at googlemail.com
Mon Mar 3 07:29:06 PST 2008


Hi,

This is my YAML

test: tiscali
url:  http://tiscali3-test.vizumi.com/
first_name: aidy
surname: lewis
email: testautomated6 at googlemail.com
password: password
registration: KJHDF123
search_term: Alien
expected_search_result: Alien 3

---

test: Vizumi
url:  http://vizumi3-test.vizumi.com/
first_name: aidy
surname: lewis
email: testautomated6 at googlemail.com
password: password
registration: KJHDF123
search_term: Alien
expected_search_result: Alien 3

this is the code to load it.
<code>
def SmokeTest.create_from_yaml_file(filename)
 require 'yaml'
 include AUT
 log = File.open(filename)
 yp = YAML::load_documents(log) { |data|
 obj = new(data['test'], data['url'])
 obj.register(data['first_name'], data['surname'], data['email'],
                data['password'], data['registration'])
 obj.login_to_site(data['email'], data['password'])
 obj.search_for_film(data['search_term'], data['expected_search_result'])
 obj
 browser_close
}
end

SmokeTest.create_from_yaml_file('C:\tiscali.yaml')

</code>

I am struggling to use the data from the second document. Any ideas?

Aidy



More information about the Chat mailing list