why not put your login code into a login class, and have th test class
instantiate that
class Login
def initialize(params)
self.username.set(params[:username])
self.password.set(params[:password])
end
def username;$ie.text_field(:name, 'username');end
def password;$ie.text_field(:name, 'password');end
def sign_in;$ie.button(:alt, /Log in/);end
end
class TestLogin < Test::Unit::Testcase
def test_login
asert_nothig_raised( 'Login Problem') do
l = Login.new( :password=>'secret' , username = 'paul' )
end
end
end
----- Original Message -----
From: "aidy lewis" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, June 03, 2007 1:27 AM
Subject: Re: [Wtr-general] instantiate a class that inherits from Test::Unit
> On 31/05/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:
>> However, i still have no idea what you are trying to do. Why do you want
>> to instantiate a test case?
>>
>
> Hi Bret,
>
> Each page has its own class. So for example the Login Class will hold
> its own object map and methods relating to that page
>
> <code>
>
> class Login
>
> def initialize(params)
> self.username.set(params[:username])
> self.password.set(params[:password])
> end
>
> def username;$ie.text_field(:name, 'username');end
> def password;$ie.text_field(:name, 'password');end
> def sign_in;$ie.button(:alt, /Log in/);end
>
> end
>
> </code>
>
> Now, I was thinking of having a method that would assert all the page
> objects. So I was planing to inherit Test::Unit and instantiate the
> sub-class:
>
> login = Login.new
> login.check_all_page_objects.
>
> aidy
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general