Rest Service mocks
The Rest Service impersonation feature allows you to create a rest service simulator- mockservice .
Benefits
Restmockservices can be used for example:
- prototyping of Web Services --Generate a complete static simulation execution from the request in a few seconds. This allows you to implement and test the client faster than you need to wait for the actual solution build.
- Client testing/development --Create the actions required by the simulation implementation and set up many alternative responses (including scripts, attachments, and custom HTTP headers). The client can be developed for mockservice and tested without getting a real service. Responses can be randomly or in a selected XPath expression for incoming requests
- test-driven development --Create functional and load tests for mockservice or before actual service implementations
Mockservices adhere to the standards that clients can use as if they were real services.
Script
The mockservices can be further expanded by scripting more dynamically. By adding a script, you can simulate any expected behavior, including (but not limited to) dynamic results, random errors, fixed response variables, and so on.
Mockservice Model
Mockservices provides analog services to expose any number ofmockactions In turn, each can contain any number ofmockresponse :
Mockservice looks like this:
in this example, Mockservice contains two Action , a Get and post. If we open the post operation, we can seereaction It contains:
show method and Resource Path , list of all mockresponses . dispatch--"sequence "In this case, it indicates that when Mockservice receives a request, the response will be used once, in the order listed, from the beginning to the end, and then restarted.
Look at the reaction of "success":
Mockresponse will return the request contains configuration information: a HTTP status Code any custom Header information, Body Response .
REST Service Mocking