Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Confidently Insured

Confidently Insured

Insurance is a confusing (mine-) field where terms and policies mean something entirely different from terms and policies. To remain confident we have to adapt our behaviour and let our test suite do the work for us.

Using DDD, BDD and TDD we will discover, design and implement this risky business with one goal in mind: Test Driven To Do's! Let the system tell you what to do next. TDTD will keep your pace steady, energy up and stress down.

Quite a claim? Relax, TDTD has you covered!

pelshoff

June 27, 2022
Tweet

More Decks by pelshoff

Other Decks in Programming

Transcript

  1. @pelshoff @pelshoff Today • Insurance premiums are fun • BDD

    * DDD * TDD => TDTD (or TDETDSFMC) • Run the tests • Solo? Pair? Mob? Photo by Blake Weyland on Unsplash
  2. @pelshoff @pelshoff Today 1. A testing refresher 2. A vicious

    debate on testing habits 3. An intro into insurance premiums 4. Writing some scenarios together, or skip to… 5. Going at it in groups, pairs or solo 6. Reflect on the content and the form Photo by Blake Weyland on Unsplash
  3. @pelshoff @pelshoff You will need • An editor (PHPStorm, VSCode,

    …) (duh) • A unit testing framework (PHPUnit, NUnit, …) • A behaviour testing framework (Behat, Specflow, …) • Pen, paper, postits… Miro? • Excel? • Curiosity • The confidence will come :-P Photo by Blake Weyland on Unsplash
  4. @pelshoff @pelshoff Confidence “Testing is all about confidence. When I'm

    working, I need to be confident that I haven't broken anything, and that the code that I just wrote works as expected. When I'm working, that's ALL I need to test for.” – Alan Holub https://twitter.com/allenholub/status/1538561251868954624 Photo by Daniel Mingook Kim on Unsplash
  5. @pelshoff @pelshoff Test automation benefits Module life cycle Having Changing

    Building Spiking / Designing Debugging Delivering Deleting..?
  6. @pelshoff @pelshoff Test automation drawbacks Module life cycle It’s quite

    hard It’s quite hard It’s quite hard It’s quite hard It’s quite hard It’s quite hard It’s quite hard
  7. @pelshoff @pelshoff Test automation benefits Module life cycle Having Changing

    Building Spiking / Designing Debugging Delivering Deleting..?
  8. @pelshoff @pelshoff /tests/features/FeatureTesting/testingOneSingle.feature Feature: writing scenarios In order to have

    working software that does what I need As a customer of a software dev team I want to write almost-natural-language executable specs Scenario: Running a pending scenario Given an editor that allows me to create flat files And a tool that can run features When I create a feature file And I run the scenario Then I get a pending result Scenario: Running a scenario that was not yet implemented Given an editor that allows me to create flat files And a tool that can run features And I create a feature file When I add context And I run the scenario Then I get a failed result
  9. @pelshoff @pelshoff Saint Anthony of Padua Taking the Habit of

    the Franciscan Order | 37.547 | The Walters Art Museum
  10. @pelshoff @pelshoff Case: Premium “Yes Hello I would like one

    insurance please” “That’ll be £365”
  11. @pelshoff @pelshoff Case: Premium Rating engine Broker platform/Manual Renewal Quote

    Policy Invoice Premium might be prorated Remember commission and IPT One for full term, or one per month
  12. @pelshoff @pelshoff The Goal Build a system that can generate

    invoices for policies • Capture policy life cycle, generate invoices • Correct info is paramount - mistakes can cost us our license • Please don’t markup an invoice, we’ll use an external service provider • Please don’t build a rating engine, assume the cover is rated • In fact: focus, assume YAGNI, ask “is it ok if we leave X out?”
  13. @pelshoff 4. Scenarios As a User I want to pay

    for my insurance So that my insurance is paid for
  14. @pelshoff @pelshoff /tests/features/FeatureTesting/eventsAreCaptured.feature Feature: capturing events In order to map

    my understanding of the domain As a dev team I want to turn an event storm into an executable spec Scenario: Outcome pertaining to C Given event A has happened And event B has happened When the circumstances will lead to C And the command that triggers C or D fires Then event C has happened (with details X, Y & Z) Scenario: Outcome pertaining to E Given event A has happened And event B has happened When the circumstances will lead to D And the command that triggers C or D fires Then event D has happened And event E has happened (with details X, Y & Z)
  15. @pelshoff @pelshoff Wall of text When a customer wants insurance,

    we quote them for their situation and their desired cover. If we can offer the cover ourselves, our rating engine determines the premium. If we place the risk through a broker platform or one of the insurers we have good connections with, we get the premium from them. When the customer accepts the quote we bind the policy and, from the effective date on, the customer will be on cover. We send them an invoice for the full term, unless they want to pay per month. At the end of the term the policy may be renewed. By default the new term will have the same premium as the previous term. Sometimes a customer wants to adjust their policy mid-term. In that case we quote them for their updated situation and if they accept we continue the term with the new version and the customer gets an invoice for the adjustment. If the customer does not want to renew their policy, we mark the policy as lapsed. In some situations we allow the customer to cancel their policy. In that case they get the premium for the cancelled time back.
  16. @pelshoff @pelshoff Todo Build a system that can generate invoices

    for policies • Capture policy life cycle, generate invoices • Correct info is paramount - mistakes can cost us our license • Please don’t markup an invoice, we’ll use an external service provider • Please don’t build a rating engine, assume the cover is rated • In fact: focus, assume YAGNI, ask “is it ok if we leave X out?”