Skip to content
hsiboy edited this page Jul 13, 2012 · 1 revision

Middleman is a dynamically configurable HTTP proxy and stubbing framework designed to make web browser base integration testing easier.

Imagine that you are developing a web application and this sparkly new application brings together content from a number of different web servers. This might be external advertising, images, videos etc. And that bringing all this rich content together involves JavaScript and perhaps cookies.

But how do you test it?

Now playing about with host files/DNS servers etc is very interesting but is complex to set up, manage and deploy and is not that conducive to Continuous Automated Testing

Architecture

The diagram below shows how middleman fits into the flow of requests between a web browser and the servers that service the requests.

middleman architecture.

Configuration

Middleman can be configured in four ways:

  • Command line parameters
  • middleman.config
  • Web
  • REST interface

Commmand line

middleman [config-port] [config-filename] config-port the numeric port number the middleman configuratiion web server listens on config-filename the name and optional path to a property file containing setup configuration middleman with no parameters is equivolent to:

``middleman 2000 middleman.config

Middleman.config

Unless specified on the command line middleman looks for a file called middleman.config in the current directory. If found the file is read and used to configure the system.

Each middleman instance can provide a number of proxies. Each proxy is bound to a port. The proxies are identified in the properties file as part of the property name identified by {name}.

Property Type Description
proxy.{name}.port Numeric Defines the port number for an HTTP proxy.
proxy.{name}.foo.route URL The host and port of an HTTP proxy for outgoing requests from middleman. e.g. proxy.domain.com:8080
proxy.{name}.debug Numeric The debug logging level. 0,1 or 2

An example config file is included which runs a middleman instance with a control panel on port 2000 and listens on port 8080. It shorts-out common 3rd party web calls, useful for SPOF testing.

Clone this wiki locally