Soapui & populating database before
- by mada
SoapUi & database data needed
Hi,
In a J2ee project( spring ws + hibernate +postgresql+maven 2 + tomcat),We have created webservices with full crud operations.
We are currently testing them with SoapUi (not yet integrated in the integration-test maven phase ). We need tomcat to test them.
Actually before the phase test, with a maven plugin, only one time, some datas are injected in the database before the launch of all tests through many sql files.
But the fact is that to test some webservices i need some data entry & their Id (primary key)
A- What is the best way to create them ?
1- populate one of the previous .sql test file.
But now we have a big dependency where i have to be careful to use the same id use in a insert in the sql file in SoapUi too. And if any developper drop the value, the test will broke.
2- create amongst the .sql file test a soapui.sql where ALL data needed for the Sopaui test will be concentrated. The advantage is that the maintenance will be much more easy.
3-because i have Ws available for all crud operations, i can create before any testsuite a previous testsuite called setup-testsuiteX. In this one, i will use those Ws to inject datas in the databse & save id in variables thanks to the feature "property transfer"
4-launch the soapui test xml file with a junit java test & in the Setup Method (we are using spring test), we will populate the database with DbUnit.
Drawback: they are already data in the database & some conflicts may appear due to constraint.And now i have a dependency between:
- dbUnit Xml file (with the value primary key)
- sopaui test where THOSe value of primarykey will be used
advantage: A automatic rollback is possible for DbUnit Data but i dont know how it will react because those data have been used with the Ws.
5- your suggestion ? better idea ?
Testing those Ws create datas in the DB.
How is the best way to remove them at the end ?
(in how daostest we were using a automatic rollback with spring test to let the database clean)
Thanks in advance for your hep & sorry for my english, it is not my mother thongue.
Regards.