Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This SDK provides a comprehensive framework for unit testing Standard workflows in single-tenant Azure Logic Apps. You can create mock operations and data, run workflows in isolation, and validate execution results.
The SDK contains several key components that work together to provide a complete testing solution:
| Component | Description |
|---|---|
| Test execution | Core classes for running workflow tests and data map transformations |
| Mock data | Classes for creating mock triggers and actions |
| Test context | Classes that represent test execution state and context |
| Results | Classes that contain workflow execution results and status information |
| Error handling | Classes for managing test errors and exceptions |
SDK classes and enums
| Class/Enum | Description | Type |
|---|---|---|
| UnitTestExecutor | Main entry point for executing unit tests for Standard workflows in Azure Logic Apps | Class |
| DataMapTestExecutor | Provides functionality to compile, generate XSLT, and execute data map tests for Standard workflows | Class |
| ActionMock | Represents a mock action for workflow testing. | Class |
| TriggerMock | Represents a mock trigger for workflow testing. | Class |
| TestActionExecutionContext | Represents the execution context for a specific action in a test workflow. | Class |
| TestExecutionContext | Represents the execution context for a test workflow. | Class |
| TestIterationItem | Represents an iteration item in a test workflow execution. | Class |
| TestWorkflowRun | Represents the result of a workflow test execution. | Class |
| TestErrorInfo | Contains detailed information about errors that occur during workflow testing. | Class |
| TestErrorResponseAdditionalInfo | Contains more information about error responses in workflow testing. | Class |
| TestWorkflowOutputParameter | Represents an output parameter from a workflow test execution. | Class |
| TestWorkflowRunActionRepetitionResult | Represents the result of an action repetition in a workflow test run. | Class |
| TestWorkflowRunActionResult | Represents the result of an action execution in a workflow test run. | Class |
| TestWorkflowRunTriggerResult | Represents the result of a trigger execution in a workflow test run. | Class |
| TestWorkflowStatus | Defines the possible status values for a test workflow execution. | Enum |
Get started
To begin using the Azure Logic Apps Automated Test SDK, set up and run your workflow tests by starting with the UnitTestExecutor class. For data map testing and transformations, use the DataMapTestExecutor class. Create test data with the ActionMock and TriggerMock classes, and validate your workflow behavior by examining the TestWorkflowRun results.
Key concepts
Test execution flow
Workflow testing
Initialize: Create a
UnitTestExecutorobject with your workflow definition and configuration files.Mock the data: Create
TriggerMockandActionMockobjects to simulate external dependencies.Execute: Run the workflow using the
RunWorkflowAsync()method.Validate: Examine the
TestWorkflowRunresult to verify the expected behavior.
Data map testing
Initialize: Create a
DataMapTestExecutorobject with your logic app project path.Generate XSLT: Compile your data map definition to XSLT using the
GenerateXslt()method.Execute: Run the transformation using the
RunMapAsync()method with sample input data.Validate: Examine the transformation output to verify the expected results.
Mock objects
Mock objects let you simulate external dependencies and control the data flow in your tests.
TriggerMock: Simulates workflow triggers, such as HTTP requests, timers, and so on.ActionMock: Simulates workflow actions, such as API calls, database operations, and so on.
Test results
The SDK provides the following detailed information about test execution:
| Item | Description |
|---|---|
| Status | Overall workflow execution status |
| Actions | Individual action execution results |
| Errors | Detailed error information if execution fails |
| Output | Workflow output parameters and values |
Best practices
- Create comprehensive mock data that covers both success and failure scenarios.
- Improve test readability by using meaningful names for your mock objects.
- Validate both successful execution paths and error handling scenarios.
- Organize your test files in a clear directory structure.
- Use appropriate timeout values for your specific workflow requirements.