[jboss-user] [EJB 3.0] - Question about unit testing EJB3?
do-not-reply at jboss.com
Wed Oct 15 14:54:19 EDT 2008
I'm working on an example lesson with JBoss5/Maven2/EJB3/JPA. I have it pretty much complete here http://learntechnology.net/content/ejb/maven-ejb3.jsp except I'm not showing testing yet (which I'd like to add).
I started looking at the best way to test my Stateless Session Beans that pretty much serve as DAOs in my example. I basically started following the example as shown in this older blog post: http://escx.blogspot.com/2007/03/testing-ejb3-jpa-with-maven2.html
Things seem ok, but if some of the EJBs call other EJBs it gets a bit more messy, but it's rare (at least in my real life cases) that were be a lot of chaining. However, I want to accommodate for it in my tests, so I'd appreciate the following:
1) Is this a bad approach as shown here http://pastie.org/293219 (I left out the non pertinent things like the local interfaces).
2) Is there a better recommended approach people use for testing EJB3/JPA?
3) Is it better to possibly find some example that demonstrates standing up the EJB3 microcontainer and then run tests within that? (If this is a better approach can someone point to me some good examples of how to use this within JUnit(or TestNG)? I suppose for integration tests this would be a better way to go?
Thanks for your time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4182485#4182485
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4182485
More information about the jboss-user