14 Replies Latest reply on Apr 6, 2011 5:07 PM by mwtemple

    Arquillian 4 starters

    marti

      Hi Michael.

      Thanks for replying. I really need help because some parts of arquillian is not clear for me ( as a starter ).

      I'm using eclipse helios with tomcat 6 and want to test JSF components (EJBs for later for sure)

       

      I need to know how should I create and run tests for JSF based applications.

       

      many thanks.

        • 1. Re: Arquillian 4 starters
          marti

          Additional info:

           

          JSF 1.2, servlet 2.5 is being used,

          eclipse m2eclipse plugin installed.

          by default JUnit 4.8 is being used.

          • 2. Re: Arquillian 4 starters
            michaelschuetz

            Hi Marti,

             

            OK, no worries i think we will find a nice solution that suites your usecase (-:

             

            So, to summarize:

            * Java EE 5 compliant environment, Tomcat 6, Junit

            * purpose: focus on testing JSF

             

            Are you using Maven? AFAIK, you do build your app with Eclipse and push WAR straight to integrated server config, right?

            @Aslak: There is no chance to use Arquillian without Maven, right? Or is there some JBossTools magic for that?

             

            OK, i think your environmet is clear and straight forward.

            The Maven part is interesting.

             

            JSFUnit integration is probably what you are looking for. Please have a look on this sample code:

            http://github.com/arquillian/arquillian/blob/master/frameworks/jsfunit/src/test/java/org/jboss/arquillian/framework/jsfunit/JSFUnitTestCase.java

             

            Are you loooking for something like that?

             

             

            Regards

            Michael

            • 3. Re: Arquillian 4 starters
              michaelschuetz

              @Dan I just mentioned this related thread: http://community.jboss.org/thread/157684?tstart=0

               

              How can we help Marti to get started with Arquillian quickly, even without using Maven?

              • 4. Re: Arquillian 4 starters
                marti

                Michael,

                thanks for replying. Couple of days ago i opened a discussion about using Arquillian with non-maven projects... I got good answers... here is the link.

                http://community.jboss.org/message/566366#566366

                 

                OK back to your post:

                yes your summary was correct.

                I'll look at the example and let you know what I get.

                 

                thanks,

                marti

                • 5. Re: Arquillian 4 starters
                  marti

                  I was able to import "arquillian-framework-jsfunit" into eclipse as aseparate project.

                  when I right click -> Debug as -> JUnit Test I get following error:

                   

                   

                  Exception occurred executing command line.
                  Cannot run program "C:\Program Files\Java\jre6\bin\javaw.exe" 
                  (in directory "C:\Users\arquillian-framework-jsfunit"): 
                  CreateProcess error=87, The parameter is incorrect
                  
                  

                   

                  It seems that JUnit can not be launched for some reasons!!!

                  I've never seen this msg before.

                  • 6. Re: Arquillian 4 starters
                    dan.j.allen

                    We need to think about how to produce instructions for which libraries developer need for a given container...whether it be using Maven, Gradle or a shell script to fetch what you need and put it all in a folder somewhere.

                     

                    To be honest, if you are testing on more than one container, using Arquillian without a dependency management solution is a tedious task.

                     

                    If you are sticking to a single container, then I suppose you just dump all the JARs in a lib/ folder and add them all to the IDE classpath. That's a pretty old school approach. In that case I'm inclined to recommend the old "eclipse:eclipse" task of Maven (or Gradle).

                     

                    I'll put something together as a prototype.

                    • 7. Re: Arquillian 4 starters
                      dan.j.allen

                      I have prepared an example project which demonstrates the Arquillian JSFUnit integration running in a Servlet container. The example has profiles for Jetty 8 and Tomcat 6, with the Jetty profile activating by default.

                       

                      First, clone the repo and go into the jsfunit-servlet example

                       

                      git clone http://github.com/arquillian/arquillian-examples
                      cd arquillian-examples/jsfunit-servlet
                      

                       

                      You can then run the example on Jetty using this command:

                       

                      mvn test

                       

                      or on Tomcat using this command:

                       

                      mvn test -Parq-tomcat-embedded

                       

                      If you are not using Maven in your project, follow these steps to get the libraries you need.

                       

                      1. Install Maven 3 (for the purpose of using it as a script)
                      2. Run the following command on the project if you want to use Embedded Jetty (recommended)

                         

                        mvn process-test-resources -Pcopy-test-libs


                        Run the following command on the project if you want to use Embedded Tomcat (recommended)


                        mvn process-test-resources -Parq-tomcat-embedded,copy-test-libs

                         

                      3. Now copy all the JARs in the target/test-libs directory into your own project and add them to the classpath

                       

                      You will need to copy either src/test/resources-jetty/jsf-web.xml or src/test/resources-tomcat/jsf-web.xml into your project and use it in the ShrinkWrap archive (if you are using this example as a reference point). 

                       

                      NOTE


                      To get Tomcat 6 working, all of the auxiliary web.xml configuration must be added directly to web.xml that's added to the @Deployment archive. This will no longer be required once the fix to ARQ-316 is merged in.

                      • 8. Re: Arquillian 4 starters
                        marti

                        Thank you guys for all the helps

                        I'll try it and let you know.

                        • 9. Re: Arquillian 4 starters
                          sri.narayanan.gce

                          Exception occurred executing command line.
                          Cannot run program "C:\Program Files\Java\jre6\bin\javaw.exe"
                          (in directory "C:\Users\arquillian-framework-jsfunit"):
                          CreateProcess error=87, The parameter is incorrect

                           

                          I am seeing the same error , was this problem solved ?

                          I followed the maven set up given in the arquillian doc

                          • 10. Arquillian 4 starters
                            mwtemple

                            The command line launch has exceeded 32k...

                            I know it sounds amazing but, there are over 400+ jars in JBoss (not sure about Tomcat).

                            Depending on where you installed it, it makes a HUGE difference.

                            Are you on windows?

                             

                            Mark

                            • 11. Re: Arquillian 4 starters
                              sri.narayanan.gce

                              Yes I am on windows

                              JBOSS in d:\server

                              Is it dependend on java location as well?

                              • 12. Re: Arquillian 4 starters
                                mwtemple

                                No.

                                It's mostly about where JBoss is installed and your included lib's are.

                                Look at the bottom of this post where I put some screenshots:

                                 

                                http://community.jboss.org/thread/164863?tstart=0

                                 

                                Thanks,

                                Mark

                                • 13. Arquillian 4 starters
                                  sri.narayanan.gce

                                  Got a better solution with simpler dependency

                                  http://community.jboss.org/thread/165071?tstart=0

                                  http://community.jboss.org/en/arquillian/blog/2011/04/05/trim-your-dependencies-when-using-jboss-as-6-remote

                                   

                                  Yes we need maven :-) Guess ur thread was not to use maven

                                  • 14. Arquillian 4 starters
                                    mwtemple

                                    Yes, we don't use maven (yet)...