A
aidy
Hi,
This is my code and I have printed out some de-bug statements. I
haven't a clue why the task = 'validate' switch statement is not being
executed.
<code>
class Form
def initialize
#see if file exists, what file or we going to use?
#@filename = "search.txt"
@filename = "validate.txt"
end
def enter_data
task = nil
count = 1
flag = 0
read_in_test_data.each { |x|
line = x.chomp
#debug
p "line = #{x.chomp}"
case line
when /^\*+ TESTID_\d+$/
p line.gsub(/\*/, '')
flag += 1
if flag > 1
$ie.back
count = 1
end
when /^Address:$/
task = :address
when /^Country:$/
task = :country
when /^Search-Results:$/
task = :search
when /^Validate:$/
task = :validate
when /^Expected-Result:$/
task = :verify
when /^END:$/
$ie.close
else
p "the task = #{task}"
case task
when :address
$ie.text_fieldname, "AL#{count}").set(line)
count += 1
when :country
$ie.text_fieldname, 'C1').set(line)
when :validate
$ie.buttonvalue, 'Validate').click
when :search
$ie.text_fieldname, 'NR1').set(line)
$ie.buttonvalue, 'Search').click
when :verify
if $ie.contains_text(line)
p line, "PASS"
else
p line, "FAIL"
end
else
#whatever
end
end
}
end
def read_in_test_data
#check if file exists and give date of last change
File.readlines(@filename, "\n" )
end
private:read_in_test_data
end
<code>
debug statements
"line = *********************************************** TESTID_100"
" TESTID_100"
"line = Address:"
"line = Choyce Close"
"the task = address"
"line = Country:"
"line = GB"
"the task = country"
"line = Validate:"
"line = Expected-Result:"
"line = Is Complete: "
"the task = verify"
the file being read
*********************************************** TESTID_100
Address:
Choyce Close
Country:
GB
Validate:
Expected-Result:
Is Complete:
false
Confidence Level:
0
Address:
Postal Authority Formatted Address:
Choyce Close
United Kingdom
*********************************************** TESTID_200
etc
Much appreciated
Aidy
This is my code and I have printed out some de-bug statements. I
haven't a clue why the task = 'validate' switch statement is not being
executed.
<code>
class Form
def initialize
#see if file exists, what file or we going to use?
#@filename = "search.txt"
@filename = "validate.txt"
end
def enter_data
task = nil
count = 1
flag = 0
read_in_test_data.each { |x|
line = x.chomp
#debug
p "line = #{x.chomp}"
case line
when /^\*+ TESTID_\d+$/
p line.gsub(/\*/, '')
flag += 1
if flag > 1
$ie.back
count = 1
end
when /^Address:$/
task = :address
when /^Country:$/
task = :country
when /^Search-Results:$/
task = :search
when /^Validate:$/
task = :validate
when /^Expected-Result:$/
task = :verify
when /^END:$/
$ie.close
else
p "the task = #{task}"
case task
when :address
$ie.text_fieldname, "AL#{count}").set(line)
count += 1
when :country
$ie.text_fieldname, 'C1').set(line)
when :validate
$ie.buttonvalue, 'Validate').click
when :search
$ie.text_fieldname, 'NR1').set(line)
$ie.buttonvalue, 'Search').click
when :verify
if $ie.contains_text(line)
p line, "PASS"
else
p line, "FAIL"
end
else
#whatever
end
end
}
end
def read_in_test_data
#check if file exists and give date of last change
File.readlines(@filename, "\n" )
end
private:read_in_test_data
end
<code>
debug statements
"line = *********************************************** TESTID_100"
" TESTID_100"
"line = Address:"
"line = Choyce Close"
"the task = address"
"line = Country:"
"line = GB"
"the task = country"
"line = Validate:"
"line = Expected-Result:"
"line = Is Complete: "
"the task = verify"
the file being read
*********************************************** TESTID_100
Address:
Choyce Close
Country:
GB
Validate:
Expected-Result:
Is Complete:
false
Confidence Level:
0
Address:
Postal Authority Formatted Address:
Choyce Close
United Kingdom
*********************************************** TESTID_200
etc
Much appreciated
Aidy