With ServiceCommand tests you can send HTTP request. Normally, this would be used in Bridge context to send requests to the Bridge API or to the xUML Runtime API via REST. However, this test can also be used to send a requests to an arbitrary target that understands HTTP.

To add a ServiceCommand test to your test suite, select ServiceCommand from the list of tests actions (see Creating Additional Tests).

Fill in the fields according to the description below.
FieldDescriptionExample
ServiceSpecify the name of the Bridge service you want to send a requests to.
NameSpecify the name of the test.
ProtocolSpecify the protocol.HTTP or HTTPS
HostSpecify the host, the service has been deployed to.localhost
Port

Specify the port of the recipient, e.g. Bridge port or control port of the service you want to send a requests to.

8080 or 29027
URL PathSpecify the URL path of the request target, e.g. the Bridge API./bridge/rest/services/xuml/PurchaseOrderExample
Request FileSpecify a path to a file that contains data for PUT or POST requests.
HTTP Header FileSpecify a path to a HTTP header file, if you need HTTP headers, e.g. for authentication. The file should have the extension .httpheader.
MethodSpecify a HTTP method, default is POST, if nothing is specified.GET
Variable StoreSpecify a path to a file that stores variable values. Refer to Working With a Variable Store for more details.
Variable NameSpecify the name of the variable to store to the variable store. Refer to Working With a Variable Store for more details.
Variable XPath ExpressionSpecify an XPath expression to extract a value from the request response to store it to the variable store. Refer to Working With a Variable Store for more details.

For requests that occasionally do not return a response body, like e.g. PUT requests, it is not required to compare the results of the test. In this case, you can remove the compare step on tab General.

Working With a Variable Store

You can use a variable store with ServiceCommand tests to pass data from one test to others.

  1. The first ServiceCommand test stores a value from the test response to the variable store using
    • Variable XPath Expression to extract the value from the response
    • Variable Name to specify the name of the variable the value is stored to
    • Variable Store to save the variable and its value to a file
  2. The second ServiceCommand test replaces placeholders in the request file with values from the variable store using
    • Variable Store to load the variable values from file

    This way, the variable value is used in the request of the second test.

Storing Variables to a Variable Store

Specify Variable XPath Expression, Variable Name and Variable Store in a ServiceCommand test. The value extracted by the XPath expression will be stored in the file specified by Variable Store under name of Variable Name.
You need at least one ServiceCommand test with this settings to store a value.

Retrieving Variables From a Variable Store

Specify an existent Variable Store in one or more subsequent ServiceCommand test to retrieve values that have been previously stored. All occurrences of variables in form of ${variable name} in a given request file will be replaced by the value from the variable store.

Thus, you can only use variable stores with requests that use a request file. You cannot replace path variables of a REST request with values from a variable store.

  • No labels