Easy unit testing with Spring and DBUnit
Annotation Documentation
All setup for DbUnit can be configured using annotations. Here is a quick overview of the annotations available in Openutils testing along with their attributes.
| @DbUnitConfiguration | Controls how the setup will be performed. It can be configured with a list of file names (xml od xsl DbUnit datasets) that will be loaded before every single method in this test class is executed. |
| dbUnitExecutions | All details for correcr execution of DbUnit, using the homonym annotation. |
| @DbUnitExecution | Contains all the details needed for the correct execution of DbUnit. |
| datasets | The resource locations to use for loading dbunit dataset. |
| dataTypeFactory | Data type factory to use. Can be left unset if not needed. |
| dataSource | The name of the datasource to use. If can be left unset only if there is only one DataSource available in the Spring context. |
| schema | Db schema name that will be given to dbUnit. Can be left unset if not needed (database specific) |
| feature | A list of DbUnit features that should be enabled or disabled on the connection. See http://www.dbunit.org/properties.html. They must be configured with the @DbUnitFeature annotation. |
| excludedTables | A regexp that can match table names. Any table matching this regular expression will not be considered by DbUnit. By default tables starting with BIN$ are ignored (oracle recycle bin). |
| truncateAll | If true, all the tables in the database will be truncated before loading any dataset. |
| truncateOperation | The database operation that will be used to truncate tables. Defaults to org.dbunit.operation.DeleteAllOperation. |
| insertOperation | The database operation that will be used to load datasets. Defaults to org.dbunit.operation.InsertOperation. For Sql Server databases the default is automatically set to MsSqlIndentityInsertOperation (allow writing of identity columns). |
| datasetType | The type of dataset to load. Defautils to XML, but automatically switches to EXCEL if you are using a file with the ".xml" extension. You need to explicitely set this only if you are using the "flat xml" format. |
| properties | A list of DbUnit properties that should be set on the connection. See http://www.dbunit.org/properties.html. The must be configured with the @DbUnitProperty annotation. |
| @DbUnitFeature | A list of DbUnit features that should be enabled or disabled. |
| key | Property key. |
| value | Property value. |
| @DbUnitProperty | A list of dbunit properties that should be set on the connection. |
| key | Property key. |
| value | Property value. |
Project info & quick links
-
Latest release: 2.2.2
License: LGPL v2.1 - Download Sourceforge file download area
- Bugs and feature requests OpenmindLAB Jira
- Changelog See what's new in release 2.2.2
- Source code Subversion public url
- Javadocs Documentation for the release 2.2.2
- Maven The dependency snippet for your pom