Database Plugin - Macros - Verify DbUnit


# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

VERIFY __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml

This macro is very similar to the ASSERT macro. For more information, please check the following page.



# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ using a DbUnit configuration file. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

VERIFY __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {config} : A configuration file for DbUnit (‘.properties’).

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties


# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH FILTER {filter}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ using a DbUnit filter. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

VERIFY __actual_{%%rand1}.dbu DOES contain THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {filter} : A Dbunit filter ( filter.dbunit TA resource).

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml


# VERIFY_DBUNIT TARGET {database} CONTAINS {dataset} WITH CONFIG {config} AND FILTER {filter}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ using a DbUnit configuration file and a DbUnit filter. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

VERIFY __actual_{%%rand3}.dbu DOES contain THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {config} : A configuration file for DbUnit (‘.properties’). It should be a ‘conf.dbunit’ SKF resource.
  • {filter} : A Dbunit filter xml file. It should be a ‘filter.dbunit’ SKF resource.

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database CONTAINS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml


# VERIFY_DBUNIT TARGET {database} EQUALS {dataset}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ and the reverse. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

VERIFY __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# ASSERT_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml

This macro is very similar to the ASSERT macro. For more information, please check the following page.



# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ and the reverse using a DbUnit configuration file. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

VERIFY __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {config} : A configuration file for DbUnit (‘.properties’).

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_config_dbunit.properties


# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH FILTER {filter}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ and the reverse using a DbUnit filter. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

EXECUTE get.all WITH $() ON {database} AS __actual_{%%rand1}.dbu

LOAD {dataset} AS __temp{%%rand2}.file
CONVERT __temp{%%rand2}.file TO file(param.relativedate) AS __temp_{%%rand3}.file
CONVERT __temp_{%%rand3}.file TO xml(structured) AS __temp_{%%rand4}.xml
CONVERT __temp_{%%rand4}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand5}.dbu

LOAD {filter} AS __filter_{%%rand6}.file
CONVERT __filter_{%%rand6}.file TO filter.dbunit(filter) AS __filter_{%%rand7}.filter

VERIFY __actual_{%%rand1}.dbu IS equal THE __expected_{%%rand5}.dbu USING __filter_{%%rand7}.filter

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {filter} : A DbUnit filter xml file. It should be a ‘filter.dbunit’ SKF resource.

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH FILTER path/to/my_dbunit_filter.xml


# VERIFY_DBUNIT TARGET {database} EQUALS {dataset} WITH CONFIG {config} AND FILTER {filter}

What ?

This macro will check that all the data listed in the ‘dataset file’ exist in the ‘database’ and the reverse using a DbUnit configuration file and a DbUnit filter. For differences between ASSERT and VERIFY assertion mode see this page.

Underlying instructions :

LOAD {config} AS __temp{config}{%%rand1}.file
CONVERT __temp{config}{%%rand1}.file TO conf.dbunit AS __temp{config}{%%rand2}.conf

EXECUTE get.all WITH $() ON {database} USING __temp{config}{%%rand2}.conf AS __actual_{%%rand3}.dbu

LOAD {dataset} AS __temp{%%rand4}.file
CONVERT __temp{%%rand4}.file TO file(param.relativedate) AS __temp_{%%rand5}.file
CONVERT __temp_{%%rand5}.file TO xml(structured) AS __temp_{%%rand6}.xml
CONVERT __temp_{%%rand6}.xml TO dataset.dbunit(dataset) AS __expected_{%%rand7}.dbu

LOAD {filter} AS __filter_{%%rand8}.file
CONVERT __filter_{%%rand8}.file TO filter.dbunit(filter) AS __filter_{%%rand9}.filter

VERIFY __actual_{%%rand3}.dbu IS equal THE __expected_{%%rand7}.dbu USING __filter_{%%rand9}.filter

> Input :

  • {database} : The name (in the context) of the database to use (database type target).
  • {dataset} : A flat xml dbunit dataset file.
  • {config} : A configuration file for DbUnit (‘.properties’). It should be a ‘conf.dbunit’ TA resource.
  • {filter} : A DbUnit filter xml file. It should be a ‘filter.dbunit’ TA resource.

Remark : If the file designed by {dataset} contains formulas of date calculation (See the converter From file to file via param.relativedate), those ones are calculated and replaced by the value.

Example :

# VERIFY_DBUNIT TARGET my_database EQUALS path/to/my_dataset.xml WITH CONFIG path/to/my_dbunit_config.properties AND FILTER path/to/my_dbunit_filter.xml