The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,948 other subscribers

13 Tips for Writing Useful Unit Tests | by Nick Hodges | Better Programming

Posted by jpluimers on 2021/12/21

[Wayback/Archive.is] 13 Tips for Writing Useful Unit Tests | by Nick Hodges | Better Programming (I made direct links to the topics in the below quote):

How you write your tests is as important as writing them

1. Test One Thing at a Time in Isolation
2. Follow the AAA Rule: Arrange, Act, Assert
3. Write Simple “Fastball-Down-the-Middle” Tests First
4. Test Across Boundaries
5. If You Can, Test the Entire Spectrum
6. If Possible, Cover Every Code Path
7. Write Tests That Reveal a Bug, Then Fix It
8. Make Each Test Independent
9. Name Your Tests Clearly and Don’t Be Afraid of Long Names
10. Test That Every Raised Exception Is Raised
11. Avoid the Use of Assert.IsTrue
12. Constantly Run Your Tests
13. Run Your Tests as Part of Every Automated Build

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: