O'Reilly logo

Testing with F# by Mikael Lundin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data-driven testing

One important aspect when doing integration testing is to be able to test with a diversity of data. This might at times render a lot of repetition, for example, we might want to run the same exact test but with other input values. Instead of writing a unique test for each and every test case, you can write a general test and supply the data for the test separately.

In order to demonstrate this, go back to our address register and query it for addresses. This is what our SUT will look like:

type dbSchema = SqlDataConnection<"Data Source=.;Initial Catalog=Chapter05;Integrated Security=SSPI;"> // find an address by a search string let searchAddress q (db : dbSchema.ServiceTypes.SimpleDataContextTypes.Chapter05) = query { for address ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required