Write a ruby file and save it as test.rb.
——————————————-
require ‘test/unit’
require ‘watir’
class GoogleHomePage < Test::Unit::TestCase
def test_text_About_Google_exists
browser = Watir::IE.start “http://www.google.com”
assert(browser.text.include?(”About Google”))
end
end
——————————————-
Now open up the command prompt, navigate to where the file is located. Enter the filename at the command prompt to run it:
C:\>test.rb
Loaded suite C:/Documents and Settings/limited/Desktop/branches_test_unit/test_unit
Started
.
Finished in 1.687 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
——————————————-
You will see that there were no errors. Try changing the assert line to:
assert(browser.text.include?(”Fail Google”))
Run the file again to see what happens. You will see an error.
*keep in mind I”m posting helpful information as I learn it myself! Some useful information may have been written in previous posts.*

You must log in to post a comment.