我想在某些應用程序中聲明某個標籤label1
。我寫了下面的JUnit測試用例:Wicket錯誤路徑:'label1'不存在頁面:BarPage
wicketTester.assertLabel("label1", "Hello!");
的頁面,在標籤中添加如下所示:
FooPage.java
public class FooPage extends WebPage {
public FooPage() {
add(new Label("label1", "Hello!"));
}
}
和corresponed html頁面看起來是這樣的: FooPage.html
<body>
..
...
<div wicket:id="label1"></div>
..
<body>
標籤label1
- 我想assert-顯示,當有人在以下頁面點擊鏈接
<a wicket:id="fooId" href="FooPage">Foo</a>
上:
<html xmlns:wicket="http://wicket.apache.org/">
<body>
<wicket:panel>
<div class="xxx">
<a wicket:id="fooId"
href="FooPage">Foo</a>
</div>
</wicket:panel>
</body>
</html>
當我運行JUnit測試中,我得到以下錯誤:
path: 'label1' does not exist for page: BarPage
我的問題是:如何獲得標籤label1
的正確路徑?
而wicketTester加載哪一頁?我想你是在BarPage上,而標籤在FooPage上。因此錯誤。 – bert
WicketTester加載BarPage和Label在FooPar –