Showing posts with label jedit. Show all posts
Showing posts with label jedit. Show all posts

Monday, March 7, 2011

More jEdit mode-ulation

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:
Given that the User is on the website
and the User is registered with the email 'kyle@example.com' and password '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.
Looks like this in jEdit:


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 website
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' |
)
jEdit would show:

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)

Tuesday, March 1, 2011

jEdit mode-ulation

I've been playing around with jEdit mode files again. Came up with one I've committed to jEdit core, and another one I've been using with my work on TeamMochi. Both work really well with folding set to 'indent', and wrap style set to 'soft'.

The first one is a simple outline mode file which sets up syntax highlighting.

Text from WikiPedia
 As I mentioned, this mode file has been committed to jEdit core, and is available in the jEdit daily builds (1). I've also made the individual mode file available as well (2).

The second mode file is one for "domain" type text. Again, just simple syntax highlighting for what I consider a simple domain specific language (DSL).

This one is not available in jEdit core, but I've uploaded it to the daily-build server also (3).

Cheers.
Eric

(1) jEdit Daily Build (trunk)
(2) outline.xml (right click, and save as)
(3) domain.xml (right click, and save as)