I use specs2 to write Scala test, and have some questions about how to write the description.
Suppose I have a test scenario, that:
Given: a button
When: I click on it
Then: it will show a dialog with "Hello world" text
I have several ways to write the test in specs2,
1.
"a dialog with 'Hello world' text" should {
"be shown if I click on the given button" in {
// click on the button and checking dialog
}
}
2.
"When I click on the given button, it" should {
"show a dialog with 'Hello world' text" in {
// click on the button and checking dialog
}
}
3.
"When I click on the given button, a dialog with 'Hello world' text" should {
"be shown" in {
// click on the button and checking dialog
}
}
I'm not sure which one is the best, or is there any better way?
Aucun commentaire:
Enregistrer un commentaire