I am trying to take a test-driven approach to a script I am writing.
The script needs to connect to SQLServer using DBI.
Currently it looks like this:
class BurndownTests < Test::Unit::TestCase
def setup
db = DBI.connect(“DBI:ODBC:driver={SQL
Server};Server=INPSESVER1;Database=RMT;Trusted_Connection=yes;”)
end
def teardown
db.disconnect
end
def test_connectrmtrack
pass
end
def test_export_schedule
pass
end
def test_format_datecols
pass
end
def test_count_resolutions
pass
end
def test_dumptofile
pass
end
end
The issue with this is that using setup like this, from what I
understand is used for each new test method I add. As I want to connect,
test the connection and then run tests which have a reliance on the
connection being established, how can I do a onetime setup and then test
this?