dogmatiq / dogmatiq/testkit

Add utilities for testing with UUIDs

Open
#159 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1
Forks
1
Avg merge
2m
Merged PRs (30d)
1

Description

It's common to need to generate UUIDs for use within messages within tests, however when there is a test failure due to an incorrect UUID it can be hard to understand what the UUID refers to.

We could add a UUID generator to Test that obtains a UUID by "name", and logged about the UUIDs it generates in the test output. We could even annotate the diff output next to a UUID to show their "name".

I'm imagining usage something like the following:

test := testkit.Begin(t, app)
depositID := testkit.UUID("deposit ID")

test.Expect(
    testkit.ExecuteCommand(StartDeposit{
        TransactionID: depositID,
    }),
    assert.EventRecorded(DepositStarted{
        TransactionID: depositID,
    }),
)

This would result in log output something like:

Generated UUID for "deposit ID" (2a5c9fe5-29af-4f5b-a51d-8c306cfea9af)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating the Test utilities and the existing testkit.Begin, testkit.ExecuteCommand, and test.Expect entry points, then determine where a testkit.UUID helper belongs. Done should include named UUID generation with the illustrated log output; UUID annotations in diff output are proposed but not specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.