-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TDD / Testability #19
Open
lenntt
wants to merge
5
commits into
main
Choose a base branch
from
testability
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bb807d9
docs: add tarlinder reference
lenntt fb3b162
docs: switch wk03 order: testability, then mocks
lenntt 48ecc47
docs: I dont want to give the impression AAA are (mental) steps
lenntt 745f32a
docs: finding a place for F.I.R.S.T. principles of testing
lenntt 81689b7
chore: year is 2025
lenntt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ date: 2022-02-01T14:17:33+01:00 | |
draft: false | ||
images: [] | ||
slug: "parameterized-tests" | ||
menu: | ||
menu: | ||
docs: | ||
parent: "" | ||
weight: 020 | ||
|
@@ -14,6 +14,18 @@ toc: true | |
|
||
:imagesdir: /prc2_web/ | ||
|
||
== Clean tests | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think FIRST principles are helpful, not sure where they fit in best
|
||
Bad tests are anything but a pleasure to work with. They are slow, hard to understand, and hard to maintain. | ||
In order to write clean tests, we follow the F.I.R.S.T. principles of tests: | ||
|
||
// Source: Clean code, Robert C. Martin | ||
|
||
- **Fast**: Tests should run quickly. | ||
- **Independent**: Tests should not depend on each other. When the state of one test affects the outcome of another, it can be hard to understand why a test fails and makes it harder to run single tests or run tests in parallel. | ||
- **Repeatable**: Tests should be repeatable in any environment. This means that tests should not depend on external resources like databases, network, or file systems. | ||
- **Self-Validating**: Tests should be able to determine if they pass or fail without human intervention. This means that the test should contain assertions that determine if the test passes or fails. | ||
- **Timely**: Tests should be written before the code they test. This is the essence of Test-Driven Development (TDD). If you write tests after the code, you might find out the code is hard to test. | ||
|
||
include::{topics}/parameterizedtests.adoc[] | ||
|
||
[TIP] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAA is more of an organisation-thingy.
In TDD, a helpful trick to learn can be to start with thinking of the 'Assert' part.
I'd therefore avoid thinking of them in steps.