10 Replies Latest reply on Jun 4, 2010 10:40 AM by Jay Balunas

    New test application for RichFaces 4

    Pavol Pitonak Master
      Hi,

       

      I studied Exadel's selenium tests a bit but since original authors don't work on it anymore and practically nobody is able to maintain it, I decided to create a new app because it seems to require much less effort. My application merges the best approaches from both applications. I commited new version of our future test application for RF 4.x to QE repo (http://anonsvn.jboss.org/repos/qa/people/ppitonak/testapp/). At the moment works only in JBoss 6, not Tomcat.

       

      My idea is to have one complex application where almost everything could be tested:
        * plain components with all its attributes (see screenshot 3)
        * various combinations of components and containers (e.g. calendar in data table, panel, modal panel etc.)
        * it would be very easy to test not only rich and a4j components but also standard components
        * it would be possible to add regression tests into this application

       

      There is a plan to separate Selenium tests into its own application (like in demo). Lukas already prepared a pom which can be used as a parent for all projects containing Selenium tests.
       
      After you start the application, you will see list of all components (picture 1). ATM only a4j:commandLink works. When you select a component, a list of all available test cases will be displayed (picture 2). That might be e.g. plain link (picture 3), internationalized link, skinned link, some special cases for regression tests etc. The first and second list might be merged into one page and made more rich if desirable. I want all pages to be bookmarkable which will make selenium tests a bit simpler.

       

      In the screenshot 3 you can see a simple page with a4j:commandLink. You can set whichever attribute of component you want. You can even set actions and action listeners. I'll add some kind of help so that anyone knows what can be inserted into input boxes.

       

      Last but not least you can change a template of a page which, generally, will change container. I prepared a simple template which contains a div with red border for illustration (see picture 4). In practice, instead of red border there will be table, rich panel, modal panel etc.

       

      I'll add logging and messages to the page later. I also plan to add prepared tests like in old test application. There are some automated tests in original application which might be useful but it requires further investigation.

       

      Adding a new component is a matter of creating min. 2 xhtml, one managed bean, adding component's name into list of components and adding css and javascript files as needed. I prefer convention over configuration so maybe in future it will be even simpler.

       

      In my humble opinion, this application could provide us a good base for very high coverage by Selenium tests. If we keep in mind some details, Selenium tests should run without problems also in portal environment. Are we going to provide support e.g. for Google App Engine?

       

      Regards
      Palo

       

      testapp01.pngtestapp02.pngtestapp03.pngtestapp04.png

        • 1. Re: New test application for RichFaces 4
          Jay Balunas Master

          Hi Pavol,

           

          Here are some of my initial thoughts:

           

          • Suggest leaving list of component and available tests for the components on separate pages
            • Have a template for the list of tests to supports a regression area.
              • Selenium or user can then choose those to perform/verify the regressions
              • Also there should be a link to the jira that is tests :-)
          • Please also plan for a section dedicated to component interactions
            • i.e. after the list of components have a section to cover the multiple component cases
          • I would like to get this into the 4.0 branch, and discuss adding some basic styles to the templates so that we can push this as something everyone can try.
            • May also be a good showcase for the richfaces-selenium project
          • Is there a way to automate the initial test creation for components using the CDK or an archetype? 
            • So when adding components or a test it is easy and not so manual
          • Why do you think selenium tests should be separated?
            • pros/cons
          • Using templates seems interesting for container component testing
            • how much testing has been done with this?
            • Multiple nesting supported?

           

          I'm sure I'll have more but that is all I've had time for now.

          • 2. Re: New test application for RichFaces 4
            Pavol Pitonak Master

            Please also plan for a section dedicated to component interactions

            I thought that we will have more smaller applications to test component interactions. Anyway, it is no problem to add such a page into testapp.

             

            May also be a good showcase for the richfaces-selenium project

            Definitely

             

            Why do you think selenium tests should be separated?

            + Lukas prepared a POM that could be used as a parent for all our Selenium tests, e.g. for testapp, richfaces-demo, photoalbum.

            + It contains things like deploying app to container, running selenium server, running Selenium tests etc.

            + In this way we don't have to repeat this code again and again. It is practically what we have now for richfaces-demo (3.3.x).

            + Practically there will be two projects (testapp & tests) so you don't have to download all tests when testing manually.  Compare photoalbum (both code and tests in one project) and richfaces-demo (separated).

            - This POM is quite complex because of our release process so we will need a good how-to article.

            - If there are many profiles in parent/child POM, Maven isn't able to list parent's profiles which might be a maintainability problem.

             

            Using templates seems interesting for container component testing
            • how much testing has been done with this?
            • Multiple nesting supported?

            Templating is "borrowed" from Exadel's Selenium tests. They tested many components in 4 templates - plain, data table line 1, data table line 2 and modal panel. We would extend it to much more templates - one for each meaningful component. Theoretically, multiple nesting could be supported - for given number of templates immediately, if you want it to be dynamical it would probably require more effort.

            • 3. Re: New test application for RichFaces 4
              Pavol Pitonak Master

              I added some help to attributes which will make manual testing easier. WDYT?

               

              testapp05.png

              • 4. Re: New test application for RichFaces 4
                Prabhat Jha Master

                I believe this is looking good. Let's make some progress on this and add all components that have been developed so far.

                • 5. Re: New test application for RichFaces 4
                  Nick Belaevski Master

                  Hi Pavol,

                   

                  I've checked application, it looks good. Here are some suggestions to consider:

                   

                  Change action/actionListener selection functionality to use h:selectOneMenu (it is even possible to find matching methods automatically according to signature) + input text for free-from input. Also it'll be easier to use application, if boolean attributes ("rendered", "disabled", etc.) will be represented as check boxes.

                   

                  To be sure that new settings were applied to component, add some kind of indicator (e.g. re-rendered string that contains current time) or even use simple form submission instead of AJAX.

                   

                  Talking about containers, dimensions & positioning testing containers should be added, like:

                   

                  - System of scrollable, absolute- & relative-positioned containers

                  - Containers with different directions (LTR/RTL)

                  - Outline containers that show what page area is occupied by the component (this can be inline-block element with red 1px border and/or text flowing around).

                  • 6. Re: New test application for RichFaces 4
                    Pavol Pitonak Master

                    Now application uses radio buttons, checkboxes and input text for attributes:

                    testapp06.png

                     

                    I also implemented nested templating (in the picture beneath each color box represents one template):

                    testapp07.png

                    • 7. Re: New test application for RichFaces 4
                      Pavol Pitonak Master

                      Attributes rewritten as a composite component to increase maintainability but cannot be used because of a bug in JBoss M3 (see  https://jira.jboss.org/jira/browse/JBAS-8024). Tested in Glassfish.

                      • 8. Re: New test application for RichFaces 4
                        Pavol Pitonak Master

                        I refactored the application's pom.xml. Now it inherits from org.richfaces.examples:examples-aggregator. I also added profiles for building binaries (inspired by richfaces-showcase).

                         

                        Templating was refactored (only naming conventions), and two new temples were added (rich data table row 1 & 2) which are inspired by selenium tests application for RF 3.3.x. This is how view parameters can be used now:

                         

                        http://localhost:8080/testapp/faces/components/a4jCommandLink/simple.xhtml?templates=richDataTable1,redDiv

                         

                         

                        testapp09.png

                        • 9. Re: New test application for RichFaces 4
                          Pavol Pitonak Master

                          New templates and components were added:

                          templates (each twice):

                          • a4j:repeat
                          • ui:repeat
                          • rich:dataTable
                          • h:dataTable

                           

                          This is how it looks when you use all templates at once:

                          testapp11.png

                          • 10. Re: New test application for RichFaces 4
                            Jay Balunas Master

                            Great, I'll take a look when I can.