If you are testing a web application, there is a good chance that you will need to manipulate or verify some data in a database as part of your testing of the front end application.
It would seem obvious to use DbFit and WebTest on the same test, however you should be aware of a few things.WebTest is a DoFixture, and DbFit can work in two modes, flow or standalone, you will need to use the standalone mode of DbFit when using DbFit with another fixture..
When creating the SetUp page for the suite of tests add the fixtures like this:
!|com.neuri.webfixture. WebTest|
!|import|
|dbfit.fixture|
!|DatabaseEnvironment|sqlserver|
|Connect|server\SQLEXPRESS|FitNesseUser|Password|TestDB|
Note that there isn't a gap between DatabaseEnvironment and Connect, they must be in the same table
You can also connect to DbFit with the Connect table.
Also remember that since you're using standalone mode of DbFit, it wont rollback or commit, so you will need to use the following tables to commit or rollback transactions:
!|DatabaseEnvironment|
|Commit|
!|DatabaseEnvironment|
|Rollback|
We use the WebTest fixture and DbFit together and it works very well for us. However we have also extended WebTest to include some SQL features in WebTest that allow us to do simple SELECTS and use the output to verify what should be on screen without breaking the flow of the test.
No comments:
Post a Comment