HaveComputerWillCode.Com

Welcome!
Life is a Non-Deterministic Finite State Automata
Automation ? (*pGeekiness)++ : Code /eneration;

August 10, 2014

Moksy v1.0 released (Web Service Faking/Stubbing Framework with real HTTP Endpoint)

Filed under: Automation,Programming,Testing — admin @ 12:36 am

Moksy v1.0
Moksy is an open source .Net library for stubbing, mocking and simulating web services (Github,NuGet,License)

Intended to be driven from MsTest (or your favorite testing framework), Moksy will create a real HTTP Server end-point that your system under test or other services can hit.

For example:

	Moksy.Common.Proxy proxy = new Moksy.Common.Proxy(10011);
	proxy.Start();

	var simulation = SimulationFactory.When.I.Get().From("/TheEndpoint").Then.Return.Body("Hello World!").And.StatusCode(System.Net.HttpStatusCode.OK);
	proxy.Add(simulation);

Navigating to http://localhost:10011/TheEndpoint in your browser or hitting that Url from another service will return “Hello World!”.

Key features of Moksy include:

  • Easy to use Fluent API for specifying conditions and responses (known as “Simulations”)
  • Ideal for stubbing services that are incomplete, unreliable, not available for testing or to remove service development from your critical path
  • Moksy can be deployed to your test environment and started from the command line
  • A convenient way to inject faults into your system
  • A dynamic "In Memory Database" is supported for Json objects: just specify a key on the JSon structure and Moksy will support CRUD operations immediately
  • Conditions can include URL’s, headers, property constraints (experimental) and the existence of objects in the database
  • Responses can include the response body, headers, objects and mutated objects

BrekIT recommends RestSharp and JSON.Net for writing your integration tests. Please see Github for more information and examples.

Integrating Moksy into MsTest (or any framework)
Moksy can be added to your test projects via NuGET:

    Install-Package "Moksy"

Create a Unit Test containing the above simulation and you are up and running!

Github Repository
Moksy is 100% open source and can be downloaded from the Github repository here.

More Information
Please see the Github repository for more up to date information and examples on how to use Moksy for your testing.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress