2 Replies Latest reply: Feb 21, 2012 7:12 PM by Tim Evers RSS

How to start a new page in test...

hantsy bai Master

JsfUnit provided a @IntialPage with @Test on test case to initialize a new page...

How to start a new page in programming way.

 

For example,

 

 

@Test
@InitialPage("/login.faces")
public void testLoginPage(){

  //I want to start new page "/another.faces"
}


 

 

How to do this, I can not find such as API in JSFClientSession and JSFServerSession.

Any help here? Thanks.

 

PS:I am using Arquillian 1.0CR6 and JSFUnit 2.0.0Beta2.

  • 1. Re: How to start a new page in test...
    Thibaud VIBES Newbie

    Hi,

     

    you could try this,

     

     

    @Test
    @InitialPage("/login.faces")
    public void testLoginPage() throws Exception{
    
      //start new page "/another.faces"
      JSFSession session = new JSFSession("/another.faces");
      JSFClientSession client = session.getJSFClientSession();
      JSFServerSession server = session.getJSFServerSession();
    
      //Assertion here
    
    }
    

     

     

     

    (JSFUnit 1.3 style but still works in JSFUnit 2 :-) )

  • 2. Re: How to start a new page in test...
    Tim Evers Master

    Pretend you are the user of the system. How would the user get to that page. I doubt you make them type the url into the browser.

     

    The above solution may work but, your tests could just as easily be written to click the appropriate menu item/link/etc in your app to navigate to that page.