Showing posts from 2021

Unit Tests - Keeping them clean and simple

  Tests should be split up by behaviour One behaviour, one test. This means don't test more than one thing in a test. Ideally there should be Acceptance Criteria clarifying each expected behaviour. This gives you a solid starting point, but Unit tests can expand on these scenarios by covering edge cases. Telltale signs of breaking this guideline include: Multiple "Act" steps (this is a big sign) Multiple asserts throughout a test Multiple unrelated asserts at the end of a test Data is being changed after the Act step Using the word "correct" in your test name - indicates vague expectations Don't be afraid to create lots of test methods for a single scenario or unit under test, testing various behaviours. When writing unit tests, you can make a new class for each scenario, this gives you power over the TestInitialize/Cleanup methods, allowing you to keep your tests cleaner. Readability is Everything The number one thing to rem

Writing Good Acceptance Criteria

As discussed in my last article , Writing good Acceptance Criteria gives the Agile team clarity and helps them work towards a common goal, saving time and effort while increasing quality. Now I'd like to dig into the details of how to write good Acceptance Criteria. Behaviour Driven vs Procedural Driven Mindsets Many of us may be used to writing/seeing procedural driven tests; step by step instructions with actions and expected results. Procedure-driven tests are often imperative and trace a path through the system that covers multiple behaviors. As a result, they may be unnecessarily long, which can delay failure investigation, increase maintenance costs, and create confusion. Acceptance criteria, and indeed Behaviour Driven tests, should instead be behaviour driven. This means they should be Declarative , specifying how a system should behave in a particular scenario. Procedural/Imperative: Given the user opens a web browser And the user navigate

What's the best gaming controller?

I've tried all the game controllers. They all have such major pros and cons. If someone could put all the good features into one controller, it would be amazing. Xbox I owned the Duke , and I didn't mind it, but I have decent sized hands and it still felt like a bowl with buttons so when they brought out the newer controller I felt it was a good move. Ever since then Xbox controllers have been the most natural, comfortable controller out there, without question. I had a 360 controller for over a decade and a half across the Xbox 360 and PC, and it just worked.  I love the convex thumbsticks, I'm cool with the offset sticks, the buttons have always felt solid and the triggers get smoother with every release. It's a solid controller in every way, the D-pad on the new Series S controller is clicky but robust, the whole thing is comfortable and high quality. I love the Xbox controllers. They are now, however, missing some significant features. Switch What can I say. They ar

The Importance of Good Acceptance Criteria

Acceptance Criteria can be seen as a chore, a convoluted, verbose set of prose with the sole purpose of satisfying "the business". At best, its value is underestimated and it is often written as a vague list of requirements. Given the right attention, Acceptance Criteria can be extremely valuable to all members of a Scrum team. Before it can be done correctly, we have to understand its value. So what exactly is the point of Acceptance Criteria? Purpose of Acceptance Criteria To define boundaries Acceptance criteria help development teams define the boundaries of a user story. In other words, acceptance criteria help you confirm when the application functions as desired. To reach consensus Having acceptance criteria synchronises the development team with the client. The team knows exactly what conditions should be met, just as the client knows exactly what to expect from the developed functionality. To allow for accurate planning and es

In Coding, Nothing is Trivial

Imagine you're reviewing some code, as part of a Pull Request, and the developer has misspelt a variable. Or added a magic string instead of a constant. Or put the expected/actual parameters in an assertion the wrong way around (although it kinda doesn't matter because they're the same)? You can politely comment on it, and perhaps they will fix it up. But sometimes you might be met with resistance.  "It's not that important." To a degree, they're right. These are pretty trivial observations. There are probably bigger things to address, such as the logic, the architecture, the test coverage etc.  However, in coding, these trivial issues tend to come back to bite you, either as bugs, or as maintenance headaches. You don't want to nag people. You don't want to become a "clean code nazi". But you can firmly assert that you think a mistake is being made and that a potential issue could arise.  There are some things in coding that are a persona