Speaking of Shale, I really dislike the idea of one huge factory. I much prefer builders if you need to assemble an aggregate object....for instance, if you need FacesContext with ExternalContext mocked out. And you don't often need everything setup anyway. It depends on the test.
As for the injection, we can think about tying that into the @Artifact framework from the JBoss test harness (created for Web Beans Pete and co)
-Dan
I have an idea for the mock testing project. While Shale and all other projects use one base class where all mock objects are initialized, the new one can utilize Seam/WebBeans 'inverse of control' pattern, where necessary mock object should be injected in the same way as components use:
public class FooTest extends .... {
@in
private FacesContext context;
public void testBar() {
...............
context.get......
...............
}
Therefore all mock initialization code can be moved into separate class, that may be used with any test framework ( jUnit 3/4, testng.... ).
Dan Allen wrote:
On Tue, May 5, 2009 at 7:22 PM, Alexandr Smirnov <asmirnov@exadel.com <mailto:asmirnov@exadel.com>> wrote:
Ok, do you start that project ? RichFaces uses Shale mocks now, but I
wish to replace that with something more convenient. I can help with
development and contribute existing test classes from richfaces to the
new mocks project.
Yes, it is here: http://anonsvn.jboss.org/repos/seam/modules/trunk/mock/
However, give me a day or two while I import what we have from Seam (I need to bring in the mocks from seambay and a couple other places).
Exactly, we want to get away from Shale.
-Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a message if
you feel that it did not reach my attention.