1 Reply Latest reply on Nov 25, 2015 7:17 AM by Matous Jobanek

    Integration testing of @ViewScoped JSF actions

    Oliver Schell Newbie

      Hi everybody,


      i tried to write an integration test for a CDI-@ViewScoped JSF action bean. As this scope is not active during an in-container Arquillian test I tried other ways to produce my action bean, expecially over a producer method.




      private CustomerActionsAjax customerActionsAjax;






      public CustomerActionsAjax createInstance( @New CustomerActionsAjax bean ) {

         return bean;








      But Arquillian injections always seem to ignore each and every CDI feature I use: producers, names, qualifiers and @New are never recognized while doing Injections. Is this intented behaviour? Is there another way to produce testable instances that have a problematic scope?




        • 1. Re: Integration testing of @ViewScoped JSF actions
          Matous Jobanek Novice



          AFAIK the producers (and similar advanced cdi features) included directly within the test are not supported by Arquillian. I would recommend you to create a producer in a separated class and add this class (with the aid of ShrinkWrap) into the deployment. Then, theoretically, you should be able to inject the produced bean within the test class.


          Regarding to @ViewScoped JSF action bean - have you considered the UI tests?