EJB unit Test Case
Asked Answered
T

3

5

Team,

We need to do EJB 3.1 Unit Test cases. For that we are analyzing tools to do efficient testing. We are taking arquillian, cactus in consideration. Can anyone tell me which tool is suitable for our technology stack in performance wise. We are using JBOSS+Hibernate

Team answered 12/5, 2011 at 12:19 Comment(0)
P
4

You might check out the technique of using the Embedded Container in EJB 3.1.

Pilocarpine answered 12/5, 2011 at 19:28 Comment(1)
I've found that tricky because of the need to set up a database. Even embedded Derby seems troublesome.Crescin
P
3

Testing EJBs is my daily challenge. The simple answer is don't. Here are some basic reasons why it's better to have unit tests than integrated tests: http://blog.thecodewhisperer.com/2010/10/16/integrated-tests-are-a-scam/

Nevertheless, if testing EJBs is really something you want and need I've committed few articles how to approach it (JBoss and Hibernate is my configuration as well). Sometimes OpenEJB is an overkill and simple mocking is enough - I suggest Mockito http://mockito.org and some examples I've written http://jakub.marchwicki.pl/posts/2011/05/06/the-art-of-testing-an-ejb-application-part-ii/

Partner answered 29/6, 2011 at 19:55 Comment(0)
A
0

Use an embedded container in your Maven setup, then mock-out any interfaces to the EJB system with either your own mock objects, or Mockito. That way you can just focus on testing the 'flesh' of the EJBs and nothing else.

Aparicio answered 13/12, 2013 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.