0 Replies Latest reply on Oct 23, 2009 3:10 PM by jeffersonb

    Writing a Seam test to process validations

    jeffersonb

      Hi,


      I am quite new to Seam and I am trying to write a SeamTest to check the validations of a specific entity.
      I took a look at the tests available at the Booking example and my idea was to write something like this:


           @Test
           public void testValidations() throws Exception {
                new FacesRequest() {
      
                     @Override
                     protected void processValidations() throws Exception {
                          validateValue("#{userHome.instance.login}", null);
                          assert isValidationFailure();
                          validateValue("#{userHome.instance.login}", "");
                          assert isValidationFailure();
                     }
      
                }.run();
      
                assert true;
           } 



      But then I got an exception:

      java.lang.AssertionError: org.jboss.seam.InstantiationException: Could not instantiate Seam component: userHome



      I might be doing this in the wrong way so I would like to know if there is a way and how to write a simple test to check if the value validations are happening. Is it necessary to trigger a method from an action (i.e. Home) to be able to do this or there is a way we can test it directly without doing a method call?


      Thanks,
      Jeff.