06.01 - Target

Contents

  1. 1 Database

Database

Category-name: database

What: A database target represents, well, a database. The file (.properties) which permits 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.ta.database.driver' and 'squashtest.ta.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.ta.database.username and squashtest.ta.database.password are not indicated so the user name and the user password must be indicated in the squashtest.ta.database.url property. If they are indicated in both so datas from the properties squashtest.ta.database.username and squashtest.ta.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 Squash TA will create its own datasource - no support for JNDI references for instance (yet).

To this end, Squash TA is backed by the c3p0 technology. Squash TA 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 : 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