Ruby & Watir

  • Thread starter John John gouda
  • Start date
J

John John gouda

Hey guys,

It's the first time to use ruby, I'm .Net developer I'm using ruby and
watir to create automated test for my web site,

I have many sections in my web site, for instance i have a sign-up
wizard, create people, contacts, groups, etc...

I making file for each section, the first file "Create Account.rb" open
the browser and create the account for me, I'm using random number
generator to generate email address and data to be entered.

When that file end, I open the 2nd file to test the 2nd section which is
create person.

My question now, I need to share some data between files, Like the email
address created, I need to share these data between many files.

how can I share these data, like making global variables that shared
between n files, if not possible can I write these data to file and read
it again when needed and how to do this?

Another question, each file need to create a new instance of IE, i need
to use the current window opened, how? how to share the IE object among
files?

Many thanks!
 
B

Ben Lovell

[Note: parts of this message were removed to make it a legal post.]

On Thu, Apr 9, 2009 at 9:48 AM, John John gouda <
Hey guys,

It's the first time to use ruby, I'm .Net developer I'm using ruby and
watir to create automated test for my web site,

While I'm not trying to dissuade you from using ruby (heresy!) you could use
Watin -- the .net equivalent of Watir. I believe there is total feature
parity between the two implementations and you may be more comfortable in
the .net environment.

Ben
 
J

John Gouda

Many thanks for your comments,

That will be great! :), However the client I'm working with need to use
Watir for some reasons!

I'll tell him about Whatin, but meanwhile how can i fix my problem?

Thanks!
 
B

Ben Lovell

N

Nigel Hennan

You can define a test_helper.rb to have methods to do what you
described, and make it available to all your test files,

You may want to try iTest2 (http://www.itest2.com), it runs Watir (with
extension) tests in RSpec syntax. It comes with a recorder and IDE.

Nigel
 
J

John Gouda

Nigel said:
You can define a test_helper.rb to have methods to do what you
described, and make it available to all your test files,

How can i do that? Sorry I know nothing about Ruby.

Many thanks
 
N

Nigel Hennan

John,

I would suggest to follow tutorial (Watir - shown in ben's post or
iTest2), get it working step by step, like opening a browser, can click
a link, can assert text present, ...

If you are using iTest2, you can post your questions on its new forum (I
discovered today)
http://groups.google.com/group/itest2

The developers at iTest2 are very helpful.

Nigel
 
J

John Gouda

Hey guys,

Thanks for your comments and advice.

I have another question,
I need to share object between files

I have a file Globals.rb contain my global variables.
I need to include this

# Open the Browser browser.
Browser = Watir::IE.new;

In another file I'll write:
require 'Globals.rb'

And use Browser without reintialize it, is that possible? if not how to
share objects between multiple files?

Thanks
 
N

Nigel Hennan

John,

I would suggest to share the functions instead of global variables,
(from my experiences), this leads test scripts more readable and less
dependencies among test cases.

Here is an example test_helper.rb

test_helper.rb

def login_as(username="testuser", password="iTest2")
....
end

def try_logout_if_i_can
fail_safe { click_link('logout_link') }
end

Nigel
 
J

John Gouda

Hey guys,

Really thanks for your helpful post!!
I have something comeup, I'm using tinymce editor in composing mails,
and i need to automate the test.

I tried many solutions online but nothing works!
Please help in this :).

Thanks!!
 
J

John Gouda

Hey,

Another important thing, I need to be able to send mails from ruby, and
login and check if the mail arrive to my inbox or not, is that possible?

So here is my question:
1- How to write text in tinymce editor?
2- Send mails using ruby?
3- Login to my email inbox, and check if mail sent in step 2 arrived?

Really thanks!
 
J

Jared Quinert

John said:
Hey guys,

Really thanks for your helpful post!!
I have something comeup, I'm using tinymce editor in composing mails,
and i need to automate the test.

I tried many solutions online but nothing works!
Please help in this :).

Thanks!!

I've posted how to do this here -
http://www.software-testing.com.au/...fficulties-problems-and-trouble-with-tinymce/

Others have contributed further to the solution, but hopefully you've
found it already.

Jared
http://www.software-testing.com.au/blog/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top