I am using be.janbols.spock.extension.dbunit
But content is called for all cases.
How specify it for each case?
@DbUnit def content = {
CATEGORY(CATEGORY_ID: 1L, CATEGORY_NAME: "N", CATEGORY_IMAGE:"I")
}
Yes you would require it at global level of the testcase for class which you are testing. It would generally be required while testing service layer classes which have many DAOs injected in them.
After initial content setup i.e the values you want to be seen in your inmemory database like H2
Then in, the setup , specify the table schema like,
def setup() {
new Sql(dataSource).execute("CREATE TABLE Category(category_id INT PRIMARY KEY, category_name VARCHAR(255), category_image VARCHAR(255))")}
Do not forget to cleanup after each testcase