Edit

Share via


Azure Logic Apps Automated Test SDK

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
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
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. Create test data with the ActionMock and TriggerMock classes, and validate your workflow behavior by examining the TestWorkflowRun results.

Key concepts

Test execution flow

  1. Initialize: Create a UnitTestExecutor object with your workflow definition and configuration files.

  2. Mock the data: Create TriggerMock and ActionMock objects to simulate external dependencies.

  3. Execute: Run the workflow using the RunWorkflowAsync() method.

  4. Validate: Examine the TestWorkflowRun result to verify the expected behavior.

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.