2 Replies Latest reply on May 22, 2013 4:47 AM by struffieux

    Testing injectable classes with Arquillian

    jeanpsv

      Hi Arquillian guys!

       

      I'm currently working on a layered web application that uses Hibernate, Seam and JSF (Primefaces). Database communication (EntityManager) is implemented in injectable "provider" Java classes (DAO style).

      Right now we are able to test our entities and providers classes using Arquillian but no success with "back beans" at all. I have Googled a lot for one week and could not have my problem solved until now.

      Some details:

       

      Versions:

       

      Primefaces 3.4.2

      JSF: Mojarra 2.1.7

      Seam: 3.1.0

      Hibernate: 4.1

       

       

      Bean structure:

       

      @Stateful

      @ConversationScoped

      @Named("patientList")

      public class PatientList { … }

       

      Inside the beans I have:

       

      @Inject

      @Authenticated

      private Technician technician;

       

      Following Seam-Book design: (https://github.com/seam/examples/tree/master/booking/src/main/java/org/jboss/seam/examples/booking/account)

       

      @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })

      @Retention(RetentionPolicy.RUNTIME)

      @Documented

      @Qualifier

      public @interface Authenticated {}

       

      While testing with Arquillian I got the below error message:

       

      WELD-001408 Unsatisfied dependencies for type [Technician] with qualifiers [@Authenticated] at injection point [[field] @Authenticated @Inject private com.linksaude.manager.bean.PatientList.technician]

       

      As I'm not very experienced with Arquillian tests I could not figure out what is happening in did...


      Am I using the right strategy/design in my tests? Is there an example source or tutorial in witch I can based my implementation?

       

      Is there a better way to run tests with @Authenticated injections? I suppose my problem lays here since I do not have login during tests....

       

      I have read about using Selenium to simulate the login... is this a viable solution for JBoss webapps?

       

      Any help is really appreciated.

       

      Best Regards,

       

      Jean