Trace: » setupscript » fit_framework_implementation_differences » start » fixturegallery » frontpage » commandreference
Previous page: DbFit for Integration tests Next page: Frequently asked questions Parent page: Table of contents
Command reference
This chapter will introduce and explain all available DbFit commands (tables, fixture types). To see more examples, get the dbfit-complete package and run the FitNesse wiki from that package. All commands, for all supported database, are shown in the AcceptanceTests subwiki. Examples in this chapter are, unless stated otherwise, written for MySQL. The AcceptanceTests subwiki contains equivalent examples for all other supported databases.
Working with parameters
DbFit enables you to use Fixture symbols as global variables during test execution, to store or read intermediate results. The .NET syntax to access symbols (>>parameter to store a value and <<parameter to read the value) is supported in both .NET and Java versions. In addition, you can use the Set Parameter command to explicitly set a parameter value to a string.
|Set parameter|username|arthur|
DbFit is type sensitive, which means that comparing strings to numbers, even if both have the value 11, will fail the test. Most databases will allow you to pass strings into numeric arguments, but if you get an error that a value is different than expected and it looks the same, it is most likely due to a wrong type conversion. Keep that in mind when using Set parameter. A good practice to avoid type problems is to read out parameter values from a query. This will be explained in detail soon.
You can also use the keyword NULL to set a parameter value to NULL.
Transaction control
By default, each individual test (FitNesse page) in flow mode is executed in a transaction that is automatically rolled back after the test. In standalone mode, you are responsible for overall transaction control.
If in flow mode, you can use the Commit and Rollback commands to control the transactions manually, but remember that a final rollback will be added at the end of the test. These commands have no additional arguments.
In standalone mode, you will probably control transactions from outside DbFit. Utility commands to commit and rollback are still provided, if you need them, as part of the DatabaseEnvironment fixture. For example, use this table to rollback:
!|DatabaseEnvironment| |Rollback|
Previous page: DbFit for Integration tests Next page: Frequently asked questions Parent page: Table of contents
