-
Notifications
You must be signed in to change notification settings - Fork 14
Invoke Workflow action
This is an example of JSON request and response message content for a mocked Invoke Workflow action.
The name of the invoked workflow is located in the host.workflow.id
field. An invoked workflow must have a HTTP trigger and any HTTP request headers are located in the headers
field and the request body is located in the body
field.
{
"host": {
"workflow": {
"id": "managed-api-connector-test-workflow"
}
},
"headers": {
"Content-Type": "application/json",
"DataSource": "customers",
"Priority": false
},
"body": {
"id": 54624,
"title": "Mr",
"firstName": "Peter",
"lastName": "Smith",
"dateOfBirth": "1970-04-25",
"address": {
"addressLine1": "The Old Station",
"addressLine2": "High Street",
"addressLine3": "",
"town": "Some Town",
"county": "Some County",
"postcode": "AB12 6ZZ",
"countryCode": "UK",
"countryName": "United Kingdom"
}
}
}
The response must match the response that would have been generated by the invoked workflow. For example, this code mocks a response using the Fluent API that returns plain text:
testRunner
.AddMockResponse("Invoke-Workflow",
MockRequestMatcher.Create()
.UsingPost())
.RespondWith(
MockResponseBuilder.Create()
.WithSuccess()
.WithContentAsPlainText("Upsert is successful"));
Failure scenarios can be triggered by returning a response with a non-success status code. If response content is used, this must match the response that would have been generated by the invoked workflow for the failure scenario. For example, this code mocks a response using the Fluent API that returns a HTTP 404 (Not Found) status code and no response content:
testRunner
.AddMockResponse("Invoke-Workflow",
MockRequestMatcher.Create()
.UsingPost())
.RespondWith(
MockResponseBuilder.Create()
.WithNotFound());
- Home
- Using the Testing Framework
- Test Configuration
- Azurite
- Local Settings File
- Test Execution Logs
- Stateless Workflows
- Handling Workflow Dependencies
- Fluent API
- Automated testing using a DevOps pipeline
- Summary of Test Configuration Options
-
Example Mock Requests and Responses
- Call a Local Function action
- Invoke Workflow action
- Built-In Connectors:
- Service Bus
- SMTP
- Storage Account
- SQL Server