I recently wrote about a framework for Versioning ASP.Net Web API. Continuing on the theme of versioning API’s, I researched how to test the different versions of a Web API, both for unit tests and SpecFlow acceptance tests. Overview As a quick review, the SDammann.WebApi.Versioning package was used for versioning the API and provides methods for selecting the controller that is active for a particular version of the API. At the code level the controller is selected by the name space of the particular version of the controller, e.
One of the important things to consider when building an API is a strategy for versioning the API to manage changes. There are several reasons this is important: To support users (developers) of the API that are using an existing version so as not to force breaking changes on them. To prevent breaking existing versions of the client applications that are using an existing version of the API. Previous versions of the API will normally be maintained for either a period to allow developers and client applications to upgrade or indefinitely.
I previously wrote about the use of SpecFlow in an ASP.Net MVC application with the SimpleBrowser library. I’ve recently been building a project to utilize the ASP.Net Web API to study the best practices of building a “RESTful” API for an application to save research notes and links about multiple projects. Approach Since the Web API is intended to be utilized by a number of types of client applications that support the HTTP protocol (smart phones, tablets, desktop applications, as well as browsers), it is convenient to use a library that is well-suited to use the HTTP verbs used by the Web API.