From: Sagy Drucker Date: 2012-12-05T16:28:13+09:00 Subject: Re: Unable to run the program. --14dae9340bc3c9ccc404d015eca8 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable There is no need to use both =93require=94 and =93include=94 for the class = Watir. http://ruby.about.com/b/2008/10/23/a-quick-peek-at-ruby-include-vs-require.= htm Also, Why do you define =93ie=94 as Global Variable? (using $) Seems to me it=92s not necessary and you can omit the =91$=92. Last thing, It would be better practice to use: assert_equal(=93Programming Ruby=94 , $ie.text) rather than assert($ie.contains_text("Programming Ruby") ) Sagy *From:* Ralf Mueller [mailto:ralf.mueller@zmaw.de] *Sent:* Wednesday, December 05, 2012 9:19 AM *To:* ruby-talk ML *Subject:* Re: Unable to run the program. On 12/05/2012 07:33 AM, sachin.s32@wipro.com wrote: Hey all, I am novice into the world of ruby and trying to do a simple search with the below program, but I am unable to run and no error is thrown. Can somebody help me where I am going wrong? require 'watir' include Watir require 'test/unit' class Test_google_Search < Test::Unit::TestCase def search test_site =3D 'http://www.google.com' $ie =3D IE.new $ie.goto(test_site) $ie.text_field(:name, "q").set("pickaxe") $ie.button(:name, "btnG").click assert($ie.contains_text("Programming Ruby") ) end end you just defined a class, no operation is performed here. In this special case, it's a child of Test::Unit, so you could run it with ruby this_file.rb or ruby this_file.rb --name=3Dtest_search if you rename search to test_search regards ralf --14dae9340bc3c9ccc404d015eca8 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

There is no need to use both =93require=94 and =93includ= e=94 for the class Watir.

http:/= /ruby.about.com/b/2008/10/23/a-quick-peek-at-ruby-include-vs-require.htm

=A0

Also,

Why do you define =93ie=94 as Global= Variable? (using $)

Seems to me it=92s not= necessary and you can omit the =91$=92.

<= span style=3D"color:#1f497d">=A0

Last thing,

It would be better pra= ctice to use:

assert_equal(=93Programming Ruby=94 , $ie.text)

rather than

=A0assert($ie.contains= _text("Programming Ruby") )

=A0

Sagy

=A0

From: Ralf Mueller [mailto:ralf.mueller@zmaw.de]
Sent: Wednesday, December 05, 2012 9:19 AM
To: ruby-talk M= L
Subject: Re: Unable to run the program.

<= p class=3D"MsoNormal">=A0

On 12/05/2012 07:3= 3 AM, sachin.s32@wipro.com wrot= e:

Hey all,

=A0

I am novice into the world of ruby and trying to do a simple search wi= th the below program, but I am unable to run and no error is thrown. Can so= mebody help me where I am going wrong?

=A0

require 'watir'= ;

include Watir

=A0

=

require 'test/unit'

=A0

class Test_google_Search < Test::Unit::TestCase

=A0

=A0 def search

= =A0

=A0=A0=A0=A0test_site =3D 'http://www.google.com'

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $ie =3D = IE.new

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 $ie.goto(test_site)

=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $ie.te= xt_field(:name, "q").set("pickaxe")

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $ie.button(:name, &quo= t;btnG").click

=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 assert= ($ie.contains_text("Programming Ruby") )

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0

= =A0 end

=A0

end

=A0

=A0

=A0

you just= defined a class, no operation is performed here.
In this special case, it's a child of Test::Unit, so you could run it w= ith

ruby this_file.rb
or
ruby this_file.rb --name=3Dtest_sear= ch

if you rename search to test_search

regards
ralf
=

--14dae9340bc3c9ccc404d015eca8--