4 Replies Latest reply on Jul 6, 2011 4:24 PM by wolfgangknauf

    JSFUnit + Arquillian

    spinner

      hey guys, good afternoon, I have arquillian+jsfunit running but there're some aspects that feels weird, and I bet that I'm doing something wrong.

       

      Maybe you can help me figure it out.

       

      1) I can run just with maven -Pprofile test and I suppose I could run with junit from eclipse.

       

      2) I cannot debug with eclipse. It should work as normal. but It never stops on the breakpoints

       

      3) what do I need to conf to have JSFServerSession and JSFClientSession injected?

       

      4) and at last, an offtopic question: is there a way to print with sysout directly to maven console?

        • 1. Re: JSFUnit + Arquillian
          ssilvert

          spinner wrote:

           

          1) I can run just with maven -Pprofile test and I suppose I could run with junit from eclipse.

          It should work, but I'm not an Eclipse user so I haven't tried it.  It does run well from NetBeans, which executes it through Maven.

           

           

          spinner wrote:

           

          2) I cannot debug with eclipse. It should work as normal. but It never stops on the breakpoints

          I'd check with the Arquillian folks about that.  They should be able to help you.

           

           

          spinner wrote:

           

          3) what do I need to conf to have JSFServerSession and JSFClientSession injected?

          For Beta 1 you need to run with a container that supports CDI.  Some have it already (JBoss AS6, for instance).  For others like Jetty, you can add it.  The Arquillian documentation lists the containers and how to turn on CDI for each.

           

          For the next release, you probably won't need CDI.  Also, see this doc if you haven't already.

           

           

          spinner wrote:

           

          4) and at last, an offtopic question: is there a way to print with sysout directly to maven console?

          If you are running your container in embedded mode then you will get sysout in the same console.  Otherwise, your JSFUnit tests are running in a remote server on a remote VM, so they will print out there.

           

          Stan

          • 2. Re: JSFUnit + Arquillian
            spinner

            thanks for the reply stan.

             

            about the third question, I'm working with JbossAS6 and the injection does not work, JSFClientSession and JSFServerSession objects are null.

            It's weird that it does not throw unsatisfied exception though but a "java.lang.RuntimeException: Could not inject members"

             

             

            please, see the full stack trace on: http://pastebin.com/PkLwZWfD

            • 3. Re: JSFUnit + Arquillian
              wolfgangknauf

              Hi,

               

              in your stack trace, this is the most inner error:

               

              Caused by: java.lang.IllegalArgumentException: @InitialPage required for injection.  Specify at class level for field injection or at method level for method injection

               

              Do you have this "@InitialPage" annotation in your test class?

               

              Hope this helps, but I am a bloody beginner as well ;-)

               

              And about your Eclipse question: I managed to run my tests from inside Eclipse by using M2Eclipse. But currently, this works by using the M2Eclipse specific contextmenu. It is on my "todo list" to check whether it is possible to start the tests by using the standard Eclipse unit tests.

              I found this: http://docs.jboss.org/arquillian/reference/latest/en-US/html/gettingstarted.html#d0e574

               

              Best regards

               

              Wolfgang

              • 4. Re: JSFUnit + Arquillian
                wolfgangknauf

                Hi spinner,

                 

                 

                {quote}1) I can run just with maven -Pprofile test and I suppose I could run with junit from eclipse. {quote}

                 

                I can confirm now that running the tests without maven (by just using the eclipse integrated JUnit) works.

                 

                {quote}2) I cannot debug with eclipse. It should work as normal. but It never stops on the breakpoints{quote}

                 

                This worked also for me when starting the test as "Debug" => "my Unit test". First the debugger did not find the sources of the test classes, but they could be added to the "debug configuration".

                 

                I will try to write some doc about "JSFUnit + Eclipse" (I think I have weird concepts about this ;-))

                 

                Best regards

                 

                Wolfgang