You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by iwessels <iz...@gmail.com> on 2008/05/02 18:14:04 UTC

Wicket : Navigation Test Case Failure

Hello all, 

I am trying to write a test case to simulate that when the user clicks on a
button, they are navigated to a new page.

// Test Case 
public void testProgramPageNavigation() {
   WicketTester tester = new WicketTester();
   FormTester formTester = tester.newFormTester("programForm");
   formTester.submit("programButton");
  
   // this line fails (expected NewProgramPage but was ProgramPage)      
  tester.assertRenderedPage(NewProgramPage.class);
}

// Program Page
public class ProgramPage extends WebPage {
 
 public ProgramPage() {
    Form programForm = new Form("programForm");

    programForm.add(new Button("programButton") {
        public void onSubmit() { 
           setReponsePage(NewProgramPage.class);
        }
    }

    add(programForm);

  }
}

Any help would be much appreciated

-- 
View this message in context: http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17022776.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket : Navigation Test Case Failure

Posted by Izak Wessels <iz...@gmail.com>.
Just to answer my own question, the problem was that I prefixed the
programButton id with the id of the 
form, which meant that the button was never invoked.


Izak Wessels wrote:
> 
> You are correct, I omitted it, due to it being done in the superclass, but
> tester.startPage(ProgramPage.class) is def being called
> 
> 
> Mr Mean wrote:
>> 
>> Do you do tester.startPage(ProgramPage.class) before you use the
>> FormTester?
>> You should get a different error if you didn't but i don't see where
>> you tell wicket which page to load, so i am just checking.
>> 
>> Maurice
>> 
>> On Fri, May 2, 2008 at 6:14 PM, iwessels <iz...@gmail.com> wrote:
>>>
>>>  Hello all,
>>>
>>>  I am trying to write a test case to simulate that when the user clicks
>>> on a
>>>  button, they are navigated to a new page.
>>>
>>>  // Test Case
>>>  public void testProgramPageNavigation() {
>>>    WicketTester tester = new WicketTester();
>>>    FormTester formTester = tester.newFormTester("programForm");
>>>    formTester.submit("programButton");
>>>
>>>    // this line fails (expected NewProgramPage but was ProgramPage)
>>>   tester.assertRenderedPage(NewProgramPage.class);
>>>  }
>>>
>>>  // Program Page
>>>  public class ProgramPage extends WebPage {
>>>
>>>   public ProgramPage() {
>>>     Form programForm = new Form("programForm");
>>>
>>>     programForm.add(new Button("programButton") {
>>>         public void onSubmit() {
>>>            setReponsePage(NewProgramPage.class);
>>>         }
>>>     }
>>>
>>>     add(programForm);
>>>
>>>   }
>>>  }
>>>
>>>  Any help would be much appreciated
>>>
>>>  --
>>>  View this message in context:
>>> http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17022776.html
>>>  Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17033073.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket : Navigation Test Case Failure

Posted by Izak Wessels <iz...@gmail.com>.
You are correct, I omitted it, due to it being done in the superclass, but
tester.startPage(ProgramPage.class) is def being called


Mr Mean wrote:
> 
> Do you do tester.startPage(ProgramPage.class) before you use the
> FormTester?
> You should get a different error if you didn't but i don't see where
> you tell wicket which page to load, so i am just checking.
> 
> Maurice
> 
> On Fri, May 2, 2008 at 6:14 PM, iwessels <iz...@gmail.com> wrote:
>>
>>  Hello all,
>>
>>  I am trying to write a test case to simulate that when the user clicks
>> on a
>>  button, they are navigated to a new page.
>>
>>  // Test Case
>>  public void testProgramPageNavigation() {
>>    WicketTester tester = new WicketTester();
>>    FormTester formTester = tester.newFormTester("programForm");
>>    formTester.submit("programButton");
>>
>>    // this line fails (expected NewProgramPage but was ProgramPage)
>>   tester.assertRenderedPage(NewProgramPage.class);
>>  }
>>
>>  // Program Page
>>  public class ProgramPage extends WebPage {
>>
>>   public ProgramPage() {
>>     Form programForm = new Form("programForm");
>>
>>     programForm.add(new Button("programButton") {
>>         public void onSubmit() {
>>            setReponsePage(NewProgramPage.class);
>>         }
>>     }
>>
>>     add(programForm);
>>
>>   }
>>  }
>>
>>  Any help would be much appreciated
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17022776.html
>>  Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>  For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17022970.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket : Navigation Test Case Failure

Posted by Maurice Marrink <ma...@gmail.com>.
Do you do tester.startPage(ProgramPage.class) before you use the FormTester?
You should get a different error if you didn't but i don't see where
you tell wicket which page to load, so i am just checking.

Maurice

On Fri, May 2, 2008 at 6:14 PM, iwessels <iz...@gmail.com> wrote:
>
>  Hello all,
>
>  I am trying to write a test case to simulate that when the user clicks on a
>  button, they are navigated to a new page.
>
>  // Test Case
>  public void testProgramPageNavigation() {
>    WicketTester tester = new WicketTester();
>    FormTester formTester = tester.newFormTester("programForm");
>    formTester.submit("programButton");
>
>    // this line fails (expected NewProgramPage but was ProgramPage)
>   tester.assertRenderedPage(NewProgramPage.class);
>  }
>
>  // Program Page
>  public class ProgramPage extends WebPage {
>
>   public ProgramPage() {
>     Form programForm = new Form("programForm");
>
>     programForm.add(new Button("programButton") {
>         public void onSubmit() {
>            setReponsePage(NewProgramPage.class);
>         }
>     }
>
>     add(programForm);
>
>   }
>  }
>
>  Any help would be much appreciated
>
>  --
>  View this message in context: http://www.nabble.com/Wicket-%3A-Navigation-Test-Case-Failure-tp17022776p17022776.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org