Database Plugin - Target¶
Database¶
Category-name : database
What ?
A database target represents, well, a database. The file (.properties)
which allows to define this target to test contains all needed informations to connect to the database.
Configuration (basic) : A simple .properties
file dropped in the ‘targets’ directory of your test project. The file must include the shebang on the very first line : #!db
and it must contain AT LEAST squashtest.tf.database.driver
and squashtest.tf.database.url
.
Available properties :
- squashtest.ta.database.driver : the jdbc driver supporting your database
- squashtest.ta.database.url : aka connection string, this is the url of your database
- squashtest.ta.database.username : the username to connect with
- squashtest.ta.database.password : the corresponding password
Remark
If properties squashtest.tf.database.username
and squashtest.tf.database.password
are not indicated, then the user name and the user password must be indicated in the squashtest.tf.database.url property
. If they are indicated in both, then datas from the properties squashtest.tf.database.username
and squashtest.tf.database.password
prime.
Configuration (advanced) : Using the same .properties
file you can also specify options related to the pooling of the datasource. As for version 1.0.x SKF will create its own datasource - no support for JNDI references for instance (yet).
To this end, SKF is backed by the c3p0 technology. SKF will transmit to c3p0 its regular configuration properties (see here). For the sake of consistency with the rest of the file, each key must be prefixed with squashtest.ta.database.pool.
+ property. For instance squashtest.ta.database.pool.maxPoolSize
will configure the property maxPoolSize
.
The only exception to this are the c3p0 properties user
and password
, that already exist as basic configuration. Consequently they will be ignored : namely, squashtest.ta.database.pool.user
and squashtest.ta.database.pool.password
will be shunted. Please use the basic keys instead.
Example of valid configuration file :
#!db
# basic configuration
squashtest.ta.database.driver = com.mysql.jdbc.Driver
squashtest.ta.database.url = jdbc:mysql://localhost:3306/my_database
squashtest.ta.database.username = tester
squashtest.ta.database.password = _tester
# advanced configuration
squashtest.ta.database.pool.acquireRetryDelay = 3000
squashtest.ta.database.pool.maxPoolSize = 40