# Ruby/rails newby needs help with passing parameters to testc

**URL:** <https://www.ruby-forum.com/t/ruby-rails-newby-needs-help-with-passing-parameters-to-testc/104542>\
**Category:** Rails\
**Created:** [May 19, 2007, 4:44am UTC](https://www.ruby-forum.com/t/ruby-rails-newby-needs-help-with-passing-parameters-to-testc/104542 "2007-05-19T04:44:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 19, 2007, 4:44am UTC](https://www.ruby-forum.com/t/ruby-rails-newby-needs-help-with-passing-parameters-to-testc/104542/1 "2007-05-19T04:44:49Z")

</div>

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
