1 Reply Latest reply on Mar 2, 2005 9:29 AM by rexorient

    Best Practice for JUnit test with EJB3

    kevinvinsen

      I'd be interested to find out for people how they are testing their EJB3 code.

      The way I'm doing it is seems cumbersome
      1. Deploy a test version of the .ejb3 file that creates and drops the database
      2. Populate the database (MySQL) using raw JDBC - not really a big deal as I use phpMyAdmin to export the data
      3. Run my tests

      Anyone got a better way?

      Thanks
      Kevin

        • 1. Re: Best Practice for JUnit test with EJB3
          rexorient

          Since I have EJB methods to store and retreive data, I connect to the deployed application from the junit tests and compare retrieval results with what I stored. I don't check what's in the database directly.

          On the EJB interface, most of what I'm testing is business logic... does it respond correctly for the correct and incorrect data I feed it.