mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-28 03:25:55 +08:00
Added another quote for AAA
This commit is contained in:
@ -59,3 +59,16 @@ test('Should be classified as premium', () => {
|
||||
From the book [XUnit Patterns](http://xunitpatterns.com/Four%20Phase%20Test.html):
|
||||
|
||||
> It is important for the test reader to be able to quickly determine what behavior the test is verifying. It can be very confusing when various behaviors of the system under test (SUT) are being invoked, some to set up the pre-test state (fixture) of the SUT, others to exercise the SUT and yet others to verify the post-test state of the SUT. Clearly identifying the four phases makes the intent of the test much easier to see.
|
||||
|
||||
|
||||
### "A useful technique [...] is that writing the Assert first is a great place to start."
|
||||
From the article [Arrange, Act, Assert](https://xp123.com/articles/3a-arrange-act-assert/) by Bill Wake which first observed and named the pattern
|
||||
|
||||
> **Where to Begin?**
|
||||
>
|
||||
> You might think that the Arrange is the natural thing to write first, since it comes first.
|
||||
When I’m systematically working through an object’s behaviors, I may write the Act line first.
|
||||
>
|
||||
> But a useful technique I learned from Jim Newkirk is that writing the Assert first is a great place to start. When you have a new behavior you know you want to test, Assert First lets you start by asking “Suppose it worked; how would I be able to tell?” With the Assert in place, you can do what Industrial Logic calls “Frame First” and lean on the IDE to “fill in the blanks.”
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user