I am directing my script output to the file by executing the script
through DOS prompt like test.rb > results.txt. My question is how do I
write test case failed puts statement in red color? is there any
WATIR/ruby method available?
ex: script
My aim is write this text in red color in the following method
puts “Test Failed! Could not find: #{val}”
def Set(ie,id,val)
writeln 'SET - ’ + id + ’ ’ + val
$ie.text_field(:id, id).set(val)
if id == 'username'
puts "Test Passed. Found the test string: #{id}. "
elsif id == 'password'
puts "Test Passed. Found the test string: #{id}. "
elsif $ie.contains_text(val)
puts "Test Passed. Found the test string: #{val}. "
else
puts "Test Failed! Could not find: #{val}"
end
I am directing my script output to the file by executing the script
through DOS prompt like test.rb > results.txt. My question is how do I
write test case failed puts statement in red color? is there any
WATIR/ruby method available?
try this on ruby under msdos under windows xp - it works fine
require ‘rubygems’
require ‘Win32console’
matchknt=1
mismatchknt=3
puts “#{matchknt} \e[32mmatch\e[0m and #{mismatchknt}
\e[31mmismatch\e[0m”