How do you unit test Java EE code?

前端 未结 4 1790
误落风尘
误落风尘 2021-01-31 18:26

I want to ask for your prefered way to test Java EE code?

I found only three project, that are trying to help to code unit tests in Java EE environment:

  • ht
4条回答
  •  孤独总比滥情好
    2021-01-31 18:35

    I've been facing the same problem of running integration tests based on JUnit in a Java EE 6 container (Glassfish v3, to be precise), and after a lot of browsing and searching, I could not find a solution that really suited me needs, so I wrote my own, now published as jeeunit on Google Code.

    I wouldn't call it a test framework, it is really just a handful of classes providing the glue between JUnit and Embedded Glassfish.

    The general idea is similar to Cactus, your tests run in the container and get triggered by a servlet from outside.

    jeeunit supports JUnit 4, Glassfish v3, CDI and generates the standard XML JUnit reports just like Ant or Maven Surefire (in fact, I reused some code from Ant for generating the reports).

提交回复
热议问题