Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Testing with f#

You're reading from   Testing with f# Deliver high-quality, bug-free applications by testing them with efficient and expressive functional programming

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher Packt
ISBN-13 9781784391232
Length 286 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Mikael Lundin Mikael Lundin
Author Profile Icon Mikael Lundin
Mikael Lundin
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. The Practice of Test Automation FREE CHAPTER 2. Writing Testable Code with Functional Programming 3. Setting Up Your Test Environment 4. Unit Testing 5. Integration Testing 6. Functional Testing 7. The Controversy of Test Automation 8. Testing in an Agile Context 9. Test Smells 10. The Ten Commandments of Test Automation Index

Setting up and tearing down databases

When you're working in a greenfield project and have a favorable situation of designing a database from the ground up, you have complete control over your database when it comes to integration tests, if you do it correctly.

While working on a greenfield project where database development is part of the project, you should adopt fluent migrations as a part of the development cycle. Writing change scripts for database changes has been around for a very long time, but it was Ruby on Rails that popularized migrations as a part of the software development lifecycle, and this has been adopted by .NET in the FluentMigrator library.

Let's start by adding a reference to the FluentMigrator library in our project:

Setting up and tearing down databases

Now we can write our first migration:

open FluentMigrator

type Email = { FromAddress : string; ToAddress : string; Subject : string; Body : string }

[<Migration(1L)>]
type CreateEmailTable () =
    inherit Migration()

    let tableName...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image