Ivan,

I'm using PageTester with Spring integration, but you'll have to jump
through a few small hoops to accomplish this.

I've written a "TestHarnessModule" in my <app dir>.services directory.
This module contributes the Spring services manually.  My code looks
very similar to what's found here:

http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative1

Then, you can pass in the name of the module to your PageTester:

PageTester pageTester= new PageTester("com.myapp.dir", "TestHarness");

IMHO, what's really neat about this is you can point your tests to a
different Spring configuration that uses mocked objects, mock databases,
etc.  This is what we're doing and it has worked very well.

Hope this helps,

Joel

-----Original Message-----
From: Ivan Dubrov [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 24, 2007 7:14 AM
To: Tapestry users
Subject: Using PageTester with tapestry-spring

Hi,

How can I use the PageTester with the Spring integration? The problem is
that when PageTester creates the registry it does not adds
SpringModuleDef to the list of modules and all my Spring services are
unavailable because of this. Extending the PageTester is not possible as
well, so I cannot extend it and provide additional module (like the
TapestrySpringFilter does), so I have to copy-paste the complete
PageTester and add a line to include SpringModuleDef module to the list.

Are there any other ways that not include dumb copy-pasting?

Just for clearness. How can I add an override to the services when
running the tests? Creating AliasContribution's with the mode set to
"test", right? But what to do if I want to keep my primary module clear
of test services and keep all my test services in the test module inside
the src/test Maven2 hierarchy (so they even aren't included in the
release build)?

--
WBR,
Ivan S. Dubrov



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to