-
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
base: main
Are you sure you want to change the base?
Conversation
@@ -19,12 +19,13 @@ test each and every part manually. You clicked on the nice TestMyCode (TMC) butt | |||
There is a catch though: Out there in the real world, there won't be any button doing that magic for you, nor will some teacher or school | |||
provide the tests for you, so [red]*you will be on your own*.# | |||
|
|||
But fret not! Writing tests is typically much simpler than writing the actual code. At least, it is when you follow a basic set of steps: | |||
But fret not! Writing tests is typically much simpler than writing the actual code. At least it is, when you know the anatomy of a test: |
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.
@@ -14,6 +14,18 @@ toc: true | |||
|
|||
:imagesdir: /prc2_web/ | |||
|
|||
== Clean tests |
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.
I think FIRST principles are helpful, not sure where they fit in best
- week 1 seems pretty cramped already?
- in week 2 it might give us a nice opportunity to revisit some fundamentals like TDD and AAA ?
@@ -36,7 +50,7 @@ makes the application valuable, the rest is either plumbing or already available | |||
|
|||
[WARNING] | |||
[red]*Never* let the business code _create_ its own persistence or or service object. You would | |||
[big red]*loose control* over what flows between service and business class, | |||
[red]*loose control* over what flows between service and business class, | |||
and makes it [red]_unobservable_, which is bad from the testing standpoint. | |||
|
|||
Instead hand the service or resource to the business, or give it some provider of a resource. |
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.
In the part below, I don't like that we focus on a class, rather than behavior (of a class).
What behavior is it we're testing/designing?
Also, I find it somewhat hard to read (I think there are different meanings used to the word 'business').
I'd suggest either:
- delete it
- work out a better option (I might give it an attempt later)
Summary
I'd be happy to revert changes/move them - I'll comment inline my 'why'