Exam >
On this page

db-clean

Cleans specified tables in a database

Overview

Usage

1. Configure a connection to database via DbPlugin.

2. Use e:db-clean tag in specification:

src/test/resources/specs/Specs.html
<e:db-clean tables="person, person_fields"/>  

Attributes

attributedescexample
tables Tables to clean. Tables will be cleaned up in the order opposite to declaration, hence the "referenced" tables should go first and the "referencing" - last Required. Default: -
tables="person, person_fields"
ds Datasource to which dataset will be applied. By default only 1 datasource with name default exists, other may be added by DbPlugin configuration. Optional. Default: default
ds="myOtherDatasource"

Example

Clean

Given


Table has the following records:
ANDROIDS_TABLE
idname
1Adam

When


Clean:
The following markup:
<e:db-clean tables="ANDROIDS_TABLE"/>
will be rendered as:
ANDROIDS_TABLE

Then


Table is empty:
ANDROIDS_TABLE
EMPTY