Hi Kalle,

thank you very much for your quick response! I saw this approach before but
did not understand it entirely.

Maybe a shall supply a little bit more information about my situation:

I have a typical t5-service consisting of an interface an the corresponding
implementation. The Service is
a DAO-Service for handling all DB-operations (like persistiing)
transparently.

The interface has some basic methods like:

void add(Item)
Item getItemById(Item)
List<Item> getAll()

My current Testsetuo is like following:
I create the Service with a t5-PageTester instance and then i invoke several
tasks to see if the service is working correctly.
In my opinion this way of testing is not very efficient and error prone.

For example when I add an Item to test the retrieval, hibernate operates on
its cache so the retrieval is not tested correctly. This was the starting
point for my question, as a kind of work around I wanted to clear the
session every time a test tries to read something of the hibernate-session.
This is not a very nice hack so I thought maybe there is a more elegant way
of testing within t5 -> testing services (also with hibernate involved)
seems to me as a rather basic task, but I did not really find a lot about
this topic.

So thanks again to you Kalle, to share your approach. When I tried to
implement it I stumbled over some questions.

What is the mock used for (particularly in this case)?
I commented out these two lines and it still worked, what is the purpose of
the SessionSource?

Just for beeing sure:
using your approach a can use the imlementation of the service, making
things more convinient. Here I use injection by contructor for the session.
So when T5 injects the current session, I can now hand it over in my
testcases. Is this the way it was meant originally?

Many thanks,
regards Stefan



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Basic-DAO-Service-Test-Setup-tp5472574p5478557.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to