Simple problems, simple solutions, great joy

  • Post category:JavaUI

I’ve been coding for many, many years. I started when I was 13, and that is decades ago. Software development was different back then; programs ran on a single PC, claiming it completely, with text based interfaces (windows were drawn with characters), and maybe, just maybe, there was a shared storage, because some PC had it’s drive shared.

It was also the time when there were not many existing software systems. You had WordPerfect (no WYSIWYG), I remember some kind of simple spreadsheet, and basic bookkeeping software. But that was about it. The world, and all the potential software had, was wide open.

So in the years that followed I wrote many systems. Small ones, to solve small but real problems; an address register for myself, a CRM tool for the local gym, a similar one for the dance school. What a time! It was not much work, especially after MSAcesss was introduced, you got a lot of functionality for the amount of effort you had put in.


Continue ReadingSimple problems, simple solutions, great joy

Given When Then

  • Post category:BDDtesting

I have a love-hate relationship with Gherkin, the syntax underpinning Cucumber tests. On the one hand I love the readability, on the other I find the binding of the sentences to step definitions flaky, and the lack of formal structure in those sentences worries me. Like the Maven vs Gradle debate, I’m a fan of structure; it keeps stuff from derailing quickly. (Maven FTW.)

So when I decided to give Cucumber another go for one of my hobby projects, I attempted to get some structure in (more on that later on). But the result was that I wrote this:

    public void test() {
        Scenario.of("Modify Vacation Hours")

Which is the Java equivalent of this Cucumber test:

      Scenario: Modify Vacation Hours
        Given a rosterperiod 2022-09-19 exists
        And user peter is logged in
        When the overview is accessed
        And the vacation hours for peter on 2022-09-19 is set to 20
        Then the vacation hours for peter on 2022-09-19 should be 20
        And the week totals for peter in rosterperiod 2022-09-19 should be 20,0,0,0,0,0
        And the running week totals for peter in rosterperiod 2022-09-19 should be 20,20,20,20,20,20
        And an event with who "peter", what "SetVacationHours", user "peter", rosterdate 2022-09-19 and detail substring "hours=20" should exist

And I started wondering if the Java version is readable enough. Because it damn well fixes all my issues I have with Cucumber.

What do you think?


Continue ReadingGiven When Then