Book Image

Testing with F#

By : Mikael Lundin
Book Image

Testing with F#

By: Mikael Lundin

Overview of this book

Table of Contents (17 chapters)
Testing with F#
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Always refactor your SUT


In the testing pattern red, green, refactor the last part is often forgotten. Once the test goes green, it is easy for the developer to forget about the refactoring part, or just move on because of a pressing deadline.

The refactoring part is the most important part of testing as this is what makes our code high-quality. Some of our system code is very hard to test and will not be enabled for test automation until we have refactored it. It is therefore crucial to refactor after each test so that we don't build technical debt.

One of the greater points of unit testing is to enable refactoring. By having coverage over your features, you will ensure that nothing gets broken after the refactoring is complete. Refactoring is the art of changing the dinner table cloth with all the plates still standing on the table, and to enable that you need to have a test suite to keep you covered.

Writing tests is a way of designing your code, and this is why testing and refactoring go...