我创建了虚拟项目来弄清楚 Cucumber for android 是如何工作的,并按照这里的“教程”
https://www.jetbrains.com/idea/help/enabling-cucumber-support-in-project.html
如您所见,我正在使用 IntelliJ IDEA IDE,我的功能如下所示:
Feature: Testing
Scenario: Testiranje
Given I am on the 'New Pet' page
And I press "Registrer"
Then I should go to the "Registrer" page
Given I am on the new pet page
和Java文件:
public class ProradiStepDefs
{
@Given("^I am on the 'New Pet' page$")
public void I_am_on_the_New_Pet_page() throws Throwable
{
}
@And("^I press \\\"([^\\\"]*)\\\"$")
public void I_press(String arg1) throws Throwable
{
System.out.println(arg1);
}
@Then("^I should go to the \\\"([^\\\"]*)\\\" page$")
public void I_should_go_to_the_page(String arg1) throws Throwable
{
System.out.println(arg1);
throw new PendingException();
}
@Given("I am on the new pet page")
public void I_am_on_the_new_pet_page() throws Throwable
{
}
}
当我开始 Cucumber java 测试时,我在控制台中得到了这个:
1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.000s
You can implement missing steps with the snippets below:
Given("^I am on the 'New Pet' page$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Given("^I press \"([^\"]*)\"$", (String arg1) -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Then("^I should go to the \"([^\"]*)\" page$", (String arg1) -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Given("^I am on the new pet page$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
Process finished with exit code 0