asp.net

Testing Versioned API’s in ASP.Net Web API

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.

Versioning ASP.Net Web API

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.

Using SpecFlow to Test the ASP.Net Web API

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.

Using SimpleBrowser with SpecFlow for BDD with ASP.NET MVC

The SpecFlow project provides a useful way to integrate BDD (Behavior Driven Development) testing into .NET projects using the Gherkin language. The main idea is that the project specs or user stories are written in user language and then are linked to actual tests that are automatically executed as the project is developed. There are several possible ways to implement this with ASP.NET MVC to automate the testing with the browser.