Separate Implementation Of Unit Test Steps From Integration Test Steps

« Table of Contents »
Previous « Code!

The Behaviour Specification Handbook

The Implementation Process

Separate Implementation Of Unit Test Steps From Integration Test Steps

When implementing the automated tests, it is better to separate all the implementation steps of Unit Tests from the implementation of Integration Test steps, as having the code for both types of steps in the same code file can quickly become confusing. If you imagine a code file that mixes the concepts of mock objects with real calls to actual implementation, you can imagine the type of confusion that could ensue. For everyone’s benefit, please keep them in separate files and classes!

I recommend a file naming convention of “[FeatureFileName]UnitSteps” for the Unit Test step implementation, and “[FeatureFileName]IntegrationSteps” for the Integration Test step implementation. With SpecFlow, it is dead simple to apply a “Scope” attribute to each different class, so that the code in that class is scoped only to scenarios that have a “@UnitTest” or “@IntegrationTest” tag.


Next » Review Test Outputs