简体   繁体   中英

Dbfit cannot find fixtures

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|

这是错误

在页面顶部添加以下内容:

!define TEST_SYSTEM {fit}

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 ".

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.

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|

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM