+(defun find-test-connection-spec (db-type &key position)
+ (nth (or position 0)
+ (db-type-spec db-type (read-specs))))
+
+(defun test-connect
+ (&key
+ (db-type *test-database-type* db-type-p)
+ position pool spec)
+ (unless spec
+ (setf spec
+ (or (and (null db-type-p) *test-connection-spec*)
+ (find-test-connection-spec db-type :position position))))
+ (when *default-database*
+ (disconnect :database *default-database*))
+ (setf *test-database-type* db-type
+ *test-database-user*
+ (cond
+ ((member db-type '(:oracle :odbc :aodbc)) (second spec))
+ ((>= (length spec) 3) (third spec)))
+ *test-connection-spec* spec
+ *default-database*
+ (clsql:connect
+ spec
+ :database-type db-type
+ :make-default t
+ :if-exists :old
+ :pool pool)
+ *test-database-underlying-type*
+ (clsql-sys:database-underlying-type *default-database*))
+ *default-database*)
+
+(defun test-setup-database (db-type &key (spec (find-test-connection-spec db-type)))