4. qu’apporte-t-elle ?
➡ Une meilleure compréhension du besoin
4
Besoin
Critères
d’acceptation
Tests
d’acceptation
Développement
Equipe métier
Equipe projet
5. ➡ Un complément au Test Driven Development (TDD)
5
TEST QUI RÉUSSIT
TEST
QUI ÉCHOUE
Refactoring
TDD Test
d’Acceptation
qu’apporte-t-elle ?
8. Rebels should be able to win the warAnd
Le Gherkin
7
Given
When
Then
Scenario:Luke succeed to destroy the death star
"Luke" is flying an X-wing
He drops his torpedoes
The death star should be destroyed
And His vessel has torpedoes
Feature: Destroy the death star
9. public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
@When("^He drops his torpedoes$")
public void heDropsHisTorpedeos() throws Throwable {
// Your test goes here
}
@Then(« ^The death star should be destroyed$")
public void theDeathStarShouldBeDestroyed() throws Throwable {
// Your test goes here
}
}
Cucumber-jvm
8
10. public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
@When("^He drops his torpedoes$")
public void heDropsHisTorpedeos() throws Throwable {
// Your test goes here
}
@Then(« ^The death star should be destroyed$")
public void theDeathStarShouldBeDestroyed() throws Throwable {
// Your test goes here
}
}
Cucumber-jvm
8
Expression
régulière
11. public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
public class RecipeStepdefs {
@Given("^"([^"]*)" is flying an X-wing$")
public void userIsFlyingAnXwing(String user) throws Throwable {
// Your test goes here
}
@When("^He drops his torpedoes$")
public void heDropsHisTorpedeos() throws Throwable {
// Your test goes here
}
@Then(« ^The death star should be destroyed$")
public void theDeathStarShouldBeDestroyed() throws Throwable {
// Your test goes here
}
}
Cucumber-jvm
8
Expression
régulière
Given "Luke" is flying an X-wing
12. Cucumber-jvm - Java 8
9
public class RecipeJava8Stepdefs implements En {
public RecipeJava8Stepdefs() {
Given("^"([^"]*)" is flying an X-wing$", () -> {
// Your test goes here
});
When("^He drops his torpedoes$", () -> {
// Your test goes here
});
Then(« ^The death star should be destroyed$", () -> {
// Your test goes here
});
}
}
14. # language: fr
11
# language: fr
Fonctionnalité: Faire une course de racer
En tant que pilote
Je souhaite participer à une course
Afin de gagner
Scénario: Je participer à une course
Etant donné que "Luke" a un module de course
Lorsqu’il participe à la course
Alors il gagne
15. implémentation
12
@Etantdonné("^que "([^"]*)" a un module de course$")
public void queAUnModuleDeCourse(String personnage) throws Throwable {
// TODO
}
@Lorsqu("^il participe à la course$")
public void ilParticipeALaCourse() throws Throwable {
// TODO
}
@Alors("^il gagne$")
public void ilGagne() throws Throwable {
// TODO
}