Re: Can I create a RunData object that works in my test cases?

Thomas Vandahl <[email protected]>
Newsgroups gmane.comp.jakarta.turbine.user
Message-ID <[email protected]>
Ludwig Magnusson wrote:
> Hi!
> I am developing a turbine application and I want to run automated test cases
> through JUnit. However, some methods that I want to test require a RunData
> object to store the user in. I can create a DefaultTurbineRunData object and
> pass it to the method but an exception is thrown since it doesn't contain a
> valid session object, and one of the methods calls
> data.removeUserFromSession()
> Is there any way to go around this error (and perhaps some similar errors I
> haven't come across yes) and create some kind of RunData object that would
> work in my test cases?
> /Ludwig

Normally, the TurbineRunDataService is responsible for correctly
initialized RunData objects. Because RunData is tight very closely to
HttpServletRequest and HttpServletResponse you will need to provide
these - initialized with meaningful data.

I heard people recommend Cactus for test purposes in web applications
but never used it myself. What we are trying to do is to split our
Turbine modules into HTTP-related and model-related stuff. The
model-related classes and methods can be tested easily with generic
JUnit stuff and the Turbine screens and actions consist of merely
"glue-code" which is straightforward.

Hope it helps.

Bye, Thomas.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.