I have tried as suggested here.
I am able to access the connection object, but it says
IllegalStateException - state should be: open
Below is the snippet which I have tried.
//set connection
testSuite.metaClass.db = db
//get connection (i am trying to access it from the same testSuite for testing purpose)
def connection = testSuite.db.getConnection()
for(def userObj :connection.User.find()){
log.info userObj
}