-
Notifications
You must be signed in to change notification settings - Fork 5
EasyCukes & DbUnit integration
DbUnit is an open source framwork for controlling a database dependency within application, it allows to manage a database state throughout a test : With DbUnit, a database can be seeded with a desired data set before a test; moreover, at the completion of the test, the database can be placed back into its pre-test state.
In order to cover several kind of tests (GUI, REST..),EasyCukes and mostly by easycukes-dbunit component (easycukes-dbunit), allows to use effectively the Dbunit framework.
In the same way to work with Arquillian, you just nedd to :
- Configure POM file by adding dependencies,
- Implement JUnit Runner to launch application,
use the easyCukes dependance in pom.xml
<dependency>
<groupId>com.worldline.easycukes</groupId>
<artifactId>easycukes-dbunit</artifactId>
</dependency>
EasyCukes is comming with a many of steps ready to use directly in your application, below the list of steps
EasyCukes provides an easy way to ensure the integrity of database state by using the available steps
- the operation before executing tests is (NONE|UPDATE|INSERT|...)
- the operation after executing tests is (NONE|UPDATE|INSERT|...)
Except for "NONE" : easycukes will inject data at the beginning of each scenario and it will remove them at the end of each scenarion
With EasyCukes you can easily inject data in your database in 2 different ways :
-
Using Cucumber : calling the avalaible step "fill the table "(.*?)\ with data"
-
Using XML datasets : it's an DbUnit's representation of the table, for example here the datatset.xml represents the table EMPLOYEE :
<EMPLOYEE employee_uid='1' first_name='toto' last_name='toto' salary="1000"/>