9 Replies Latest reply on Jun 2, 2008 8:18 PM by Stan Silvert

    Simple navigation test takes 100 seconds !?

    Brian Gregory Newbie

      I'm using JSFUnit with Facelets (templates configured as *.jspx)
      Here is my test:

       public void testHealthStatusReportHistory()
       throws MalformedURLException, IOException, SAXException {
      
       client.clickLink("reportHistoryMenuItemLink");
       assertEquals("Loaded page doesn't match expected [/status/reportHistory.jspx,"+server.getCurrentViewID()+"]",
       "/status/reportHistory.jspx", server.getCurrentViewID());
       }
      


      After stepping through this code it appears that all of the below code (in clickLink) takes less than 20 seconds (mainly due to the database query in the referenced backing bean) BUT the remaining +60 seconds is taken in the last line ( this.clientIDs = new ClientIDs(); ):

       public void clickLink(String componentID) throws SAXException, IOException
       {
       ComponentTypeException.check("clickLink()", componentID, HtmlOutputLink.class, clientIDs);
       String clientID = this.clientIDs.findClientID(componentID);
       WebLink link = this.webResponse.getLinkWithID(clientID);
       if (link == null) throw new ComponentIDNotFoundException(componentID);
       this.webResponse = link.click();
       this.clientIDs = new ClientIDs();
       }
      


      I've experimented with making the page less complex (removing some of the controls) and it does improve performance, but my thought is why do I need to parse all of the control IDs if all I'm doing is verifying the navigation? Would it be nice to short-cut this?

      Is there any way I could improve this? The page is complex (panelMenu + table + header sort controls + filter controls + a few others) but not that complex considering it is only displaying 10 rows. For a decent jsf app, it doesn't seem unusual.

      Brian