1 Reply Latest reply on Nov 2, 2009 2:16 PM by Stan Silvert

    How do I get test data into my data via setup with jsfunit

    Pucky Loucks Newbie

      I know I can just do raw jdbc in the setup. But I was wondering if there is a way to get the EntityManger and use it.

      I've got a seam application that I'm starting to build JSFUnitTests for and it's working great, except I would like to not have to have real or pre installed data in my database.

      So I'd love to be able to create some Entities in my setup, and delete them in teardown...... but I'm not having any luck.

      My EntityManager is using JTA and at one point I had it saying that it needed to be in a transaction, so something is messing up.


        • 1. Re: How do I get test data into my data via setup with jsfun
          Stan Silvert Master

          In setUp/tearDown, you are not inside a Seam request. So anything that Seam does for you will not be available at that point.

          I suggest that you create a simple JSF/Seam request that can do the setup and teardown you are looking for. That way, you can just call this request using JSFUnit and do the setup/teardown inside a real Seam request.

          public void setUp()
           JSFSession jsfSession = new JSFSession("/setup.seam");
           JSFClientSession client = jsfSession.getJSFClientSession();
          public void tearDown()
           JSFSession jsfSession = new JSFSession("/tearDown.seam");
           JSFClientSession client = jsfSession.getJSFClientSession();