Ruby/rails newby needs help with passing parameters to testc


#1

I’m trying to pass parameters into a Selenium testcase using
Test::Unit:Testcase … would I do this with a fixture or simply pass
parameters somehow into a class I create like:

myTest = TC_LoginTest.net(param1, param2, param3)

Basically I want to write 1 test that will log into an application I
made as different users and validate the outcome. The parameters are
user name, password and database. I’m not really familiar with
fixtures (if that’s what I should be using) or if I should be passing
parameters in a separate test suite file … not sure. Any advice or
a website you could point me to I’d appreciate it.

Nicholas

My class is below__________________________________________

require ‘test/unit’
require ‘…/selenium’

class TC_LoginTest < Test::Unit::TestCase
include SeleniumHelper

def setup
@selenium = Selenium::SeleniumDriver.new(“localhost”, 4444,
“*iexplore”, 10000);
@selenium.start
end

def teardown
@selenium.stop
end

def test_doLogin
#open the special test login page that doesn’t need SSL (since
Se doesn’t like SSL)
open(’/myapp/utils/specialLogin.cfm’)
uncheck(name=“myChkBox”)
type(name=“UName”, username)
type(name=“Pass”, password)
click(database)
# after providing username and password we click the database
button we want to test and validate
sleep 5
assert_equal(“nickc”,get_text(“userName”),[“User name doesn’t
match login name”])
assert_equal(“Developer”,get_text(“profileName”),[“Profile name
doesn’t match login name”])

end

end