Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions DESIGN_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# The Design Guide - How to design tests, and how to review them

This is not a rule book, just a compilation of guidelines, tips, and thoughts.

## Atomic tests

While atomic test cases are a great way of designing test at unit test level,
for End-to-End tests it might not be great Return of Investment. But please consider
atomic test case design principles in your test design.

* Is it possible to extract some portion of my test into fixture/setup?
* Could some of it be reused by multiple test cases?
* Is that possible to do, while not destroying tests runtime or making complex fixture desing?

Just considering the principles, might give you an idea of new test cases, that
might be useful to write.

## Commits

1. Consider using https://www.conventionalcommits.org/en/v1.0.0/ (.gitmessage)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Consider using https://www.conventionalcommits.org/en/v1.0.0/ (.gitmessage)
1. Consider using https://www.conventionalcommits.org/en/v1.0.0/ (.gitmessage)
1. Run `make reformat` and `make commit-acceptance` locally to catch code analysis or formatting issues before committing and pushing
1. Sign off commits by adding the `-s` flag (`git commit -s`)
1. Optionally, sign commits with the `-S` flag (`git commit -S`) if you have a GPG or SSH key configured — this verifies commit authenticity on GitHub


## Creating PRs

1. To promote quality code, request 2 reviewers
1. Link relevant issues, and/or summarize the changes
1. Consider providing a verification steps in the PR description (might have a tool for that)
Comment on lines +24 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. To promote quality code, request 2 reviewers
1. Link relevant issues, and/or summarize the changes
1. Consider providing a verification steps in the PR description (might have a tool for that)
1. To promote quality code, request 2 reviewers
1. Link relevant issues, and/or summarize the changes
1. Consider providing a verification steps in the PR description (might have a tool for that)
1. Ensure CI checks pass before opening a PR (e.g., DCO sign-off, code analysis, GitGuardian)
1. Use a draft PR to share work in progress and gather early feedback before marking it ready for review


## Reviewing PRs

1. Focus on readability
1. Is the test placed in correct path?
1. Consider test structure and design, can it be improved without impacting runtime?
1. Is the test easy to debug on Failure or Error?

### precommit hook

Consider using some secret guarding precommit hooks in your git setup, to prevent secret leaking.

### .gitmessage

Currently optional, you may use a file (conventionally) named `.gitmessage`,
and configure your git to use it as a commit message template.

For example `.gitmessage`:

```text
# test:
# test():

# Description:


# Footer:


# See also: https://www.conventionalcommits.org/en/v1.0.0/
```

And git configuration:

```shell
git config commit.template=.gitmessage
```

next time you commit, your editor will be prefilled with the templates, and as
usual, anything that is a comment `#` will be ignored.