Previous page: Command reference Parent page: Table of contents

Frequently asked questions

I'd like to use DbFit with DB2/Sybase/PostGRE. Is that possible?

Currently, the only supported databases are Oracle, SQL Server and MySQL. However, implementing support for a new database takes less than one working day, if you know your way around the database internals. Just implement a new DbEnvironment variant and fire away. Sybase, DB2, PostGRE and similar databases are not supported simply because I do not have a test database at hand and do not know enough about those systems to extract all relevant meta-data. If you need can provide a test database and one person who can help with database meta-data extraction, please contact me and I'll help with implementing support for your database.

NULLs and blank cells

I need to insert null values to several columns, but I get an error message if a column is empty ?Cannot use input parameters as output values. Please remove the question mark after ?.

In FitNesse, empty cell generally means "print the current value, don?t test". That is why you get the message that the input parameter (insert value) cannot be used for output. Use the keyword NULL to insert nulls.

DbFit complains that it cannot read columns or parameters. What's wrong?

When I try to insert (or execute a procedure), DbFit complains that it "Cannot read columns/parameters for object". What's wrong?

There are two possible causes of this problem:

The first is that you misspelled the procedure or table name (it is obvious, but people keep reporting problems caused by this, so I'd like to suggest double-checking that first). Keep in mind that DbFit is executing under the privileges of the user that you supplied in the Connect command, so it may need a schema prefix to see your objects.

The second possible cause is that the current user does not have access to table or procedure metadata. See Section Does DbFit require any special database privileges? for detailed information on required privileges.

Does DbFit require any special database privileges?

DbFit generally goes not require any special privileges for the database. The only important thing is that the user whose credentials you are using to run the test pages has at least read-only access to the schema meta-data. For MySql, that means select grants on mysql.proc and information_schema.columns tables. For Oracle, that means access to all_arguments, all_tab_columns and all_synonyms. For SqlServer, that means access to sys.columns and sys.parameters tables.

Does DbFit support VARBINARY columns?

Yes, and it treats them as arrays of bytes. You can use the standard FitNesse syntax for byte arrays (comma-separated list of values), or you can use the 0xHEXDIGITS syntax if you activate the byte array handler. |CellHandlerLoader| |Load|dbfit.util.ByteArrayHandler|

My stored procedure returns a result set. How do I use it?

In Oracle, you can store the REF CURSOR output parameter into a variable (using >>varname) and then execute a query with that variable:

|Query|<<varname|

With SQL Server, there are no typically output arguments, but a stored procedure just opens a cursor. You can use the Query table directly against it. If you would like to use a parameter, put exec before the procedure name:

|set parameter|hm|3|

|query|exec listusers_p @hm|
|name|username|
|user1|user name 1|
|user2|user name 2|
|user3|user name 3|

DbFit says that my VARBINARY is System.Byte[]

You see System.Byte[] because that is how .NET prints a byte array. The object should have been stored correctly as a byte array, and you should be able to use 0xHEXDIGITS syntax for comparisons. See BinaryTests acceptance test for examples.

Does DbFit support GUID columns?

Yes, but you may need to activate that support manually. DbFit has a non-standard extension for FIT.NET which allows it to "understand" GUID fields. That is being implemented now in the standard FIT.NET test runner, so you may not need to load it manually in the future. In any case, put this table in your test to load the GUID handler:

|CellHandlerLoader|
|Load|dbfit.util.GuidHandler|

This table should come below the test type definition (below SQLServerTest).

DbFit complains about an unsupported type. What's wrong?

To handle types properly, DbFit requires a bit of additional information that does not come from typical database driver meta-data. That is why there is some small amount of work involved in supporting each column type. You can see a list of supported data types for each database server in the AcceptanceTests suite. If you are using a column/parameter type that is not there, then no one asked for that yet. Please contact me and I'll be happy to extend DbFit to support that type.

Can you extend DbFit to support Oracle collection types?

A short answer is "Not easily". The .NET version uses Microsoft's Oracle .NET driver because Oracle ODP requires binary client compatibility (if DbFit is compiled for ODP 9, it will not work with Oracle 10 or 11, and vice-versa). If you really desperately need this, I can create a version-specific variant of ODP driver support for you, with support for Oracle collection types. I started implementing this in the Java version, but it turned out that proper use of Oracle collections in JDBC requires Oracle-specific extensions and meta-data which currently does not get loaded in DbFit. This would require restructuring in the way that DbFit handles types, so it is on my roadmap for some future release, but not a priority. If you need it sooner, contact me.

How can we use Windows-integrated authentication?

Instead of calling connect with three or four separate arguments, call it with just one argument and specify the full .NET or JDBC connection string. If you are a database develeoper and don't know about those things, ask a .NET or Java developer in your organisation to help you out.

DBFit complains about invalid fixtures/methods

If you want to use DbFit in flow mode, then DbFit test name should be the first table on the page -- not even imports, cell handler loaders or any set-up can come before it. If you want to use some other fixture to control the flow, then use DbFit in standalone mode.

Why does DbFit not see the time portion of my Date fields?

This issue affects Oracle users on the Java version of DbFit. Oracle's JDBC driver strips the time from Date columns since version 9, so no amount of magic on the client side can fix that. see Oracle JDBC FAQ for more information.

In the JDBC FAQ, Oracle suggests setting -Doracle.jdbc.V8Compatible="true" to map dates to timestamps. That should instantly solve your problem, but I don't know what else is triggered by that flag. If you want to experiment, change the batch file that starts FitNesse and add that before the FitNesse class name.

Previous page: Command reference Parent page: Table of contents


Personal Tools