2 Replies Latest reply on Mar 26, 2008 11:18 AM by maykellff

    Can i test my managed beans without the need of to be the ap

    maykellff

      Hi all, i need to test my managed beans but without the need of to be the application server running.

      Can i do that with JSFUnit?

      I mean something like the test api of Seam framework, where i can write test cases like this:


      package pruebas;

      import org.jboss.seam.mock.SeamTest;
      import org.testng.annotations.Test;

      public class ExpedienteFacadeIntegrationTest extends SeamTest
      {

      @Test
      public void testBuscarExpediente()throws Exception
      {
      new FacesRequest() {

      /*
      @Override
      protected void processValidations() throws Exception
      {
      validateValue("#{house.address}", "123 Main Street");
      validateValue("#{house.city}", "Columbus");
      validateValue("#{house.state}", "OH");
      assert !isValidationFailure();
      }

      */
      @Override
      protected void updateModelValues() throws Exception
      {
      setValue("#{expediente.nroExpediente}", "123");
      setValue("#{expediente.tipoAcusado}", "Acusado Libre");
      //setValue("#{expediente.fechaTurnado}", "Jan 1, 2008");
      }

      @Override
      protected void invokeApplication()
      {
      assert invokeMethod("#{expedienteFacade.buscarExpediente}").equals("success");
      }

      @Override
      protected void renderResponse()
      {
      assert getValue("#{expedienteFacade.expedientesEncontrados.size}").equals(7);
      //assert getValue("#{house.city}").equals("Columbus");
      //assert getValue("#{house.state}").equals("OH");
      }
      }.run();
      }
      }