我正在尝试学习Serenity BDD框架,但是遇到一些需要期望的指导的问题。我已经从github下载了serenity-cucumber4-starter-master。
问题:
到目前为止,我的代码:
public class LoginTask implements Task {
private HomepageScreen hp;
@Override
@Step("Landing on Guru Bank Website")
public <T extends Actor> void performAs(T obj) {
obj.attemptsTo(Open.browserOn(hp));
}
}
@RunWith(SerenityRunner.class)
public class CucumberTestSuite {
@Managed(driver = "chrome")
private WebDriver browser;
private Actor john = Actor.named("john");
// =================================================================================
@Before
public void setup() {
john.can(BrowseTheWeb.with(browser));
}
@Test
public void login() throws InterruptedException {
//givenThat(john).can(BrowseTheWeb.with(browser));
System.out.println("Automate web browser");
//givenThat(john).wasAbleTo(LoginTask.);
Thread.sleep(9000);
}
}
givenThat()方法未定义。在哪里获取导入位置?
请帮助。谢谢。
答案 0 :(得分:2)
givenThat()
中定义了net.serenitybdd.screenplay.GivenWhenThen
方法(和其他类似方法)。
import static net.serenitybdd.screenplay.GivenWhenThen.seeThat;