【问题标题】:testing wicket pages测试检票口页面
【发布时间】:2013-03-30 18:37:31
【问题描述】:

我正在为检票口页面编写测试。我的页面上有三个下拉菜单。根据从下拉列表中选择的值,面板被渲染(面板包含一个数据表)。 如何更改检票口测试中下拉列表的值,以便我可以测试呈现的面板以选择不同的值组合?

【问题讨论】:

    标签: wicket wicket-tester


    【解决方案1】:
    @Test
    public void testPanel() {
        WicketTester tester = new WicketTester(new JavaWhatApplication()) ;
    
        DropDownChoice<Type> typeDropDown = 
    (DropDownChoice<Type>)tester.getComponentFromLastRenderedPage("categoryForm:types");
        assertEquals(3, typeDropDown.getChoices().size());
    
        FormTester formTester = tester.newFormTester("categoryForm",false);
        formTester.select("types", 1);   // 1 is index
        tester.executeAjaxEvent("categoryForm:types", "onchange"); 
    
    }
    

    Wicket Quick Guide - Unit Testing

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多