A small group of my fellow developers at eHarmony Inc. have been trying out ATDD (Acceptance Test Driven Development) with quite a bit of success, I hear. They've been using Spock to create their tests.
I too have been trying out ATDD, more specifically BDD (Behavior Driven Development) while developing TeamMochi. I found myself writing out behavioral tests in plain text first before moving them over to something like Spock. Again, I found myself doing so in my favorite text editor jEdit, and given my recent trials with jEdit's mode files, I created another mode file to help myself with creating these tests.
The mode file supports the main keywords like, "given", "when", "then", and some extra ones like: "where", "if", "and", "but", and "should". It also supports variable placeholders, and some simple markup for variable data.
All this boils down to a simple syntax highlighted user story using the normal BDD language.
Eg. A basic story like:
You'll notice that I borrowed the entity recognition from my 'domain' mode. Any word that starts with a capital appears as a label in jEdit.
This might be something given to you by the Product Owner, or preferably something you and the Product Owner came up with together.
But the developer might want to take it a step further and supply data which can be used in the test.
This is where variable placeholders, and the simple markup comes in to play.
We might for instance replace the actual email address and password in the previous example with variables, then create a "where" clause with a table of valid email addresses, and passwords for test accounts.
The text would look something like this:
It also supports key, value pair markup like so:
I don't have any plans of including this mode file in jEdit core, but I've uploaded it to the daily-build server (1).
Enjoy :)
(1) behavior-test.xml (right click and save as)
I too have been trying out ATDD, more specifically BDD (Behavior Driven Development) while developing TeamMochi. I found myself writing out behavioral tests in plain text first before moving them over to something like Spock. Again, I found myself doing so in my favorite text editor jEdit, and given my recent trials with jEdit's mode files, I created another mode file to help myself with creating these tests.
The mode file supports the main keywords like, "given", "when", "then", and some extra ones like: "where", "if", "and", "but", and "should". It also supports variable placeholders, and some simple markup for variable data.
All this boils down to a simple syntax highlighted user story using the normal BDD language.
Eg. A basic story like:
Looks like this in jEdit:Given that the User is on the websiteand the User is registered with the email 'kyle@example.com' and password 'password'When the user attempts to login with his registered email and passwordThen the User should be logged in and taken to his dashboard.
You'll notice that I borrowed the entity recognition from my 'domain' mode. Any word that starts with a capital appears as a label in jEdit.
This might be something given to you by the Product Owner, or preferably something you and the Product Owner came up with together.
But the developer might want to take it a step further and supply data which can be used in the test.
This is where variable placeholders, and the simple markup comes in to play.
We might for instance replace the actual email address and password in the previous example with variables, then create a "where" clause with a table of valid email addresses, and passwords for test accounts.
The text would look something like this:
Given that the User is on the websitejEdit would show:
and the User is registered with a valid email and password
When the user attempts to login with his registered ${email} and ${password}
Then the User should be logged in and taken to his dashboard.
Where (
|= email =|= password =|
| 'kyle@example.com' | 'password' |
| 'kenny@example.com' | 'password' |
)
It also supports key, value pair markup like so:
I don't have any plans of including this mode file in jEdit core, but I've uploaded it to the daily-build server (1).
Enjoy :)
(1) behavior-test.xml (right click and save as)
No comments:
Post a Comment