DrawerTest无法找到符号变量仪表板

时间:2013-03-20 13:37:28

标签: playframework-2.0

我试图在http://www.playframework.com/documentation/2.1.0/JavaGuide6上关注播放2.1教程,但我坚持使用这行代码

@Test
public void newProject() throws Exception {
    drawer.group("Personal").newProject();
    dashboard.await().until(drawer.group("Personal").hasProject("New project"));
    dashboard.await().until(drawer.group("Personal").project("New project").isInEdit());
}

我把这段代码放在test / views / DrawerTest.java上,但是在运行游戏测试时遇到了这个错误:

zentasks/test/views/DrawerTest.java:32: cannot find symbol
[error] symbol  : variable dashboard
[error] location: class views.DrawerTest
[error]         dashboard.await().until(drawer.group("Personal").hasProject("New project"));

请帮帮我。 感谢

1 个答案:

答案 0 :(得分:2)

您可以尝试更改DrawerTest类,如下所示:

public Drawer drawer;
public Dashboard dashboard; // <------ Add this

@Before
public void setUp() {
    start();
    Login login = browser.createPage(Login.class);
    login.go();
    login.login("bob@example.com", "secret");
    dashboard = browser.createPage(Dashboard.class); // <------ Add this
    drawer = dashboard.drawer(); // <------ Change this
}