This content has been marked as final.
Show 2 replies
-
1. Re: Question about unit testing EJB3?
wolfgangknauf Oct 16, 2008 5:48 AM (in response to rickcr)Hi,
why don't you test your EJBs the same way your client would use them (connect to the server, get EJB, call methods)? This way, e.g your entity manager will work, you will use the same persistence.xml as the EJB.
The approach described in http://escx.blogspot.com/2007/03/testing-ejb3-jpa-with-maven2.html seems to ignore all the server related things like security, transactions, injection and just tests the plain EJB methods. So the tests will not be like reality.
Hope this helps
Wolfgang -
2. Re: Question about unit testing EJB3?
rickcr Oct 16, 2008 9:34 AM (in response to rickcr)why don't you test your EJBs the same way your client would use them (connect to the server, get EJB, call methods)? This way, e.g your entity manager will work, you will use the same persistence.xml as the EJB.
What's the best way to set that up? That's what I'm struggling with. Do you create JMX components to perform those tests? A JSP that allows you to click on some testing links? I want what is simple and I don't mind if the user does have to stand up the server first. Just wondering what the best approach is.
I did think it would be nice if, as part of the build process, junit could run and perform all the tests. but that's not a necessity if there are some better/simpler ways to do things.