Mockup Web Service
Notice
The Mockup Web Service is not designed for productive use. This web service should only be used for temporary tests.
The Mockup Web Service is a dummy service with a limited ability to simulate the behavior of a third-party web service. This web service can be used if a third-party web service is not available but a corresponding client component is to be tested.
Depending on configuration, the Mockup Web Service can accept requests via any URL path. Based on rules that must be defined, the Mockup Web Service responds to these requests with predefined content.
Property | Description |
|---|---|
MockupService.Activate | Boolean value enabling or disabling the Mockup Web Service Default value: |
MockupService.UrlBasePath | URL base path that precedes all requests sent to the Mockup Web Service (optional) Since the service accepts requests under all URL paths, a measure which we recommend taking is that of limiting requests to those that begin with a specific path (e.g., The |
MockupService.Rule[].Method MockupService.Rule[].Path* | HTTP method(s) and URL path as filter criteria for a rule Use these methods to select rules that are applied to an incoming request. The other properties of a given rule are used to form the response. The configured rules are evaluated in the order in which they have been defined. The first rule that matches the request will be used. The The If, for example, a base path |
MockupService.Rule[].Content MockupService.Rule[].ContentFile | If the response is to include body content, define it as a string in |
MockupService.Rule[].Header[] | Definition of specific HTTP headers that are set in the response Each entry is composed of the following individual parameters:
|
MockupService.Rule[].StatusCode | Numerical HTTP status value that is returned Enter the numerical value here as text (as the value can also be defined dynamically using variables). Default value: |
MockupService.Rule[].Delay | Delay value in milliseconds. This value is used to artificially slow down the response in order to simulate long-running requests. Default value: |
MockupService.Rule[].ErrorRate | Error rate as an integer percentage (between The error rate can be used to simulate a processing error. A request is answered with an error, with the specified probability. Configure the status value and the body content for the error case using the following Default value: |
MockupService.Rule[].ContentOnError MockupService.Rule[].ContentFileOnError MockupService.Rule[].StatusCodeOnError | Properties analogous to These properties are used in the event that an error response is artificially generated via |
The values of the .Content, .ContentFile, .Header[], and .StatusCode properties can be generated dynamically for each request by including variables. For the .ContentFile property, both the file path and the content of the file can be generated dynamically if the file in question is a text file. For the .Header[] property, only the second sub-parameter Value can be generated dynamically.
The only variables available are those which are extracted from the content of the incoming request (described below). They are inserted into the property values by means of pure text replacement. For this, use the syntax %VariableName% for text variables.
URL path: the variable
%Path[n]%can be used for accessing the sub-elements of the URL path, starting with the base pathMockupService.UrlBasePath.nstands for the sequential number of the element. For example, for a path/Mockup/Tests/Test1,%Path[2]%would result inTests.URL parameters: these are available as variables under the name specified in the URL. For example, for a parameter list
? param1=value1, the variable would be called%Param1%.Header value: the names of the values in the HTTP header of the request can also be used as variables.
Body content: the entire content of the HTTP body is available as a contiguous string in the
%Body%variable. This can only be used for textual content and not for binary content.
Notice
The following special feature should be noted for URL parameters and header values: As, within the program, variable names are limited to certain permitted characters (letters, numbers and underscore), the original name can be adapted automatically. For example, the header value ContentType will become the variable name %ContentType%.