Skip to main content
Version: shouty

Test Strategy

Testing pyramid​

The testing pyramid tells us that we’re better off with fewer end-to-end tests and more unit tests. This is because end-to-end tests are typically:

  • slow
  • brittle
  • difficult to diagnose when they fail

The pyramid also emphasizes that there will always be a certain amount of manual and exploratory testing needed.

Testing pyramid

Testing iceberg​

The testing pyramid doesn’t help us answer the question:

When should I write my test using SpecFlow and when when should I use my unit tests?

We learnt earlier that SpecFlow is primarily a collaboration tool, not a test automation tool. So, the answer to the question is:

When writing the test in business language will help communication.

The overriding question when choosing SpecFlow or your unit testing framework is:

Will the business be interested enough in this scenario to give meaningful feedback?

Testing iceberg

SpecFlow and non Loading... interfaces​

Some of the scenarios that the business are interested in will be written as end-to-end tests. This means that SpecFlow may need to interact with web applications or REST services. SpecFlow doesn’t know anything about HTML or web browsers, so what should we do?

All that SpecFlow can do is run Loading... step definitions and, luckily, we can use any of the Loading... libraries that specialise in interacting with diverse interfaces, such as web browsers or REST services. Some of the more popular libraries are:

We can interact directly with Loading... production code from our SpecFlow step definitions. For direct interaction with other languages there are implementations of Cucumber in several other languages.