Dbfit cannot find fixtures

3.1k Views Asked by At

I wrote the folowing test but am getting error:

Could not find fixture: Connect.

!path lib/*.jar

!|Import| !|dbfit.SqlServerTest|

!|Import| |dbfit.fixture|

!|Connect|Data Source=ACER\SQLEXPRESS;Initial Catalog=NopCommerce;Integrated Security=SSPI;|

!|query|select * from dbo.Employees|

!|Query| select 'test' as x| |x| |test|

here is the errors

4

There are 4 best solutions below

0
On

Anything (even comments) between the 'DatabaseEnvironment' and the 'Connect' will also cause the 'Could not find fixture: Connect' error.

So, this fails:

|DatabaseEnvironment|sybase|

|Connect | jdbc:jtds:sybase://10.158.0.189:8000;user=myuser;password=mypass;databaseName=mydb |

But this works:

|DatabaseEnvironment|sybase                                                                                                 |
|Connect             |jdbc:jtds:sybase://10.158.0.141:8000;user=myuser;password=mypass;databaseName=mydb|
2
On

Include the following at the top of your page:

!define TEST_SYSTEM {fit}
0
On

According to this answer, the syntax for the import should be:

!|import fixture|
|dbfit.fixture|

Note: the dbfit.fixture is in a separated row, and has no preceding exclamation mark, the sign of a command, so the mentioned error message should be read as: "Oh, I have found import command asking for something like dbfit.fixture, but the next line asks for a Connect fixture, which is not expected, because Connect is another command".

0
On

Try the following:

|import fixture|
|dbfit.fixture|

!|DatabaseEnvironment|sqlserver|
|Connect|192.168.0.3|user|pass|nz_db|

|Store query|!-select * from sql_tbl-!|fromtbl|

!|Query|<<fromsql|

|Rollback|

!|dbfit.util.ExportFixture|
|dbfit.fixture|

This works for me in DBFit Java.