I am working currently with the theme of testing EJBs in the version 3.1 and I do have only some experience with it. So I take look at the literature and found out three different ways/methods of testing EJBs (Version 3.0 and newer)
1) Use of simple POJT (Plain Old Java Tests)
2) Use of an embedded Container
3) Test of the application in the application server
After I figured out these the different methods I started some research on my own and found out some possibilities.
For case 1) tools like JUnit or TestNG are nearly perfect and to solve the problems of the annotations the library EasyGloss can be used. For very simple beans EasyGloss isn't necessary. The "local" testing works fine until the bean need access to Contexts (e.g. sessionContext), uses Transactions or Interceptors.
I use JBoss AS 7.1.1 and as far as I know this application server doesn't provide an embedded Container. So I can switch to Glassfish (what I do not prefer) or use some alternatives like OpenEJB or Arquillian to handle tests for case 2).
I know that you guys have a lot more experience and knowledge of testing Jave EE and EJBs. So I want to ask you if you would share your experience with me and maybe give some tips and tricks, more thoughts or example code of efficient tests of ejbs.
Edit: Added more informations für case 1).