Skip to content

Commit a3398af

Browse files
authored
Merge pull request #308599 from wsilveiranz/wsilveiranz-automatedtest-datamaps
[Docs][Update] Update Automated Test Framework documentation
2 parents a856b5a + 465c432 commit a3398af

3 files changed

Lines changed: 207 additions & 5 deletions

File tree

articles/logic-apps/testing-framework/automated-test-sdk.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ description: Reference documentation for the Azure Logic Apps Automated Test SDK
44
services: logic-apps
55
ms.suite: integration
66
author: wsilveiranz
7-
ms.reviewer: estfan, azla
7+
ms.reviewers: estfan, azla
88
ms.topic: concept-article
9-
ms.date: 07/18/2025
9+
ms.date: 12/03/2025
1010
---
1111

1212
# Azure Logic Apps Automated Test SDK
@@ -17,7 +17,7 @@ The SDK contains several key components that work together to provide a complete
1717

1818
| Component | Description |
1919
|-----------|-------------|
20-
| **Test execution** | Core classes for running workflow tests |
20+
| **Test execution** | Core classes for running workflow tests and data map transformations |
2121
| **Mock data** | Classes for creating mock triggers and actions |
2222
| **Test context** | Classes that represent test execution state and context |
2323
| **Results** | Classes that contain workflow execution results and status information |
@@ -28,6 +28,7 @@ The SDK contains several key components that work together to provide a complete
2828
| Class/Enum | Description | Type |
2929
|------------|-------------|------|
3030
| [UnitTestExecutor](unit-test-executor-class-definition.md) | Main entry point for executing unit tests for Standard workflows in Azure Logic Apps | Class |
31+
| [DataMapTestExecutor](data-map-test-executor-class-definition.md) | Provides functionality to compile, generate XSLT, and execute data map tests for Standard workflows | Class |
3132
| [ActionMock](action-mock-class-definition.md) | Represents a mock action for workflow testing. | Class |
3233
| [TriggerMock](trigger-mock-class-definition.md) | Represents a mock trigger for workflow testing. | Class |
3334
| [TestActionExecutionContext](test-action-execution-context-class-definition.md) | Represents the execution context for a specific action in a test workflow. | Class |
@@ -44,12 +45,14 @@ The SDK contains several key components that work together to provide a complete
4445

4546
## Get started
4647

47-
To begin using the Azure Logic Apps Automated Test SDK, set up and run your workflow tests by starting with the [**`UnitTestExecutor`**](unit-test-executor-class-definition.md) class. Create test data with the [**`ActionMock`**](action-mock-class-definition.md) and [**`TriggerMock`**](trigger-mock-class-definition.md) classes, and validate your workflow behavior by examining the [**`TestWorkflowRun`**](test-workflow-run-class-definition.md) results.
48+
To begin using the Azure Logic Apps Automated Test SDK, set up and run your workflow tests by starting with the [**`UnitTestExecutor`**](unit-test-executor-class-definition.md) class. For data map testing and transformations, use the [**`DataMapTestExecutor`**](data-map-test-executor-class-definition.md) class. Create test data with the [**`ActionMock`**](action-mock-class-definition.md) and [**`TriggerMock`**](trigger-mock-class-definition.md) classes, and validate your workflow behavior by examining the [**`TestWorkflowRun`**](test-workflow-run-class-definition.md) results.
4849

4950
## Key concepts
5051

5152
### Test execution flow
5253

54+
#### Workflow testing
55+
5356
1. **Initialize**: Create a **`UnitTestExecutor`** object with your workflow definition and configuration files.
5457

5558
1. **Mock the data**: Create **`TriggerMock`** and **`ActionMock`** objects to simulate external dependencies.
@@ -58,6 +61,16 @@ To begin using the Azure Logic Apps Automated Test SDK, set up and run your work
5861

5962
1. **Validate**: Examine the **`TestWorkflowRun`** result to verify the expected behavior.
6063

64+
#### Data map testing
65+
66+
1. **Initialize**: Create a **`DataMapTestExecutor`** object with your logic app project path.
67+
68+
1. **Generate XSLT**: Compile your data map definition to XSLT using the **`GenerateXslt()`** method.
69+
70+
1. **Execute**: Run the transformation using the **`RunMapAsync()`** method with sample input data.
71+
72+
1. **Validate**: Examine the transformation output to verify the expected results.
73+
6174
### Mock objects
6275

6376
Mock objects let you simulate external dependencies and control the data flow in your tests.
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
title: DataMapTestExecutor class
3+
description: Learn about the DataMapTestExecutor class in the Azure Logic Apps Unit Testing SDK.
4+
services: logic-apps
5+
ms.suite: integration
6+
author: wsilveiranz
7+
ms.reviewers: estfan, azla
8+
ms.topic: reference
9+
ms.date: 12/03/2025
10+
---
11+
12+
# DataMapTestExecutor class
13+
14+
This class provides functionality that compiles, generates XSLT, and executes data map tests for Standard logic app workflows in single-tenant Azure Logic Apps. The class serves as the main entry point for testing data transformations with data maps.
15+
16+
## Namespace
17+
18+
**`Microsoft.Azure.Workflows.UnitTesting`**
19+
20+
## Usage
21+
22+
You can use the **`DataMapTestExecutor`** class to generate XSLT from data map definitions and execute data transformations:
23+
24+
```csharp
25+
using Microsoft.Azure.Workflows.Data.Entities;
26+
27+
// Initialize with app directory path
28+
var executor = new DataMapTestExecutor("path/to/logic-app-project");
29+
30+
// Generate XSLT from map name
31+
var xslt = await executor.GenerateXslt("MyDataMap");
32+
33+
// Generate XSLT from map content
34+
var generateXsltInput = new GenerateXsltInput { MapContent = mapContent };
35+
var xsltContent = await executor.GenerateXslt(generateXsltInput);
36+
37+
// Execute data map transformation by map name
38+
var inputData = System.Text.Encoding.UTF8.GetBytes(xmlInput);
39+
var result = await executor.RunMapAsync("MyDataMap", inputData);
40+
41+
// Execute data map transformation with XSLT content
42+
var result = await executor.RunMapAsync(xsltContent, inputData);
43+
```
44+
45+
## Constructors
46+
47+
### DataMapTestExecutor(string)
48+
49+
Initializes a new instance of the **`DataMapTestExecutor`** class by using the logic app project root path.
50+
51+
#### Parameters
52+
53+
| Name | Type | Description | Required |
54+
|------|------|-------------|----------|
55+
| appDirectoryPath | string | The logic app project root path | Yes |
56+
57+
#### Example
58+
59+
```csharp
60+
var executor = new DataMapTestExecutor("C:\\MyLogicApp");
61+
```
62+
63+
## Properties
64+
65+
### AppDirectoryPath
66+
67+
The logic app project root directory path.
68+
69+
| Property | Type | Description | Required |
70+
|----------|------|-------------|----------|
71+
| AppDirectoryPath | string | The root path of the logic app project | Yes |
72+
73+
## Methods
74+
75+
### GenerateXslt(string)
76+
77+
Compiles a data map and generates XSLT. The operation uses the map name to find the data map.
78+
79+
#### Parameters
80+
81+
| Name | Type | Description | Required |
82+
|------|------|-------------|----------|
83+
| mapName | string | The data map file name without the LML extension | Yes |
84+
85+
#### Returns
86+
87+
**`Task<byte[]>`**: A task representing the asynchronous operation that returns the generated XSLT content as a byte array.
88+
89+
#### Exceptions
90+
91+
- **`ArgumentException`**: Thrown when the data map file doesn't exist in the expected path.
92+
93+
#### Example
94+
95+
```csharp
96+
var executor = new DataMapTestExecutor("C:\\MyLogicApp");
97+
var xslt = await executor.GenerateXslt("OrderToInvoice");
98+
```
99+
100+
> [!NOTE]
101+
>
102+
> This method looks for the data map file in the path: `{appDirectoryPath}\Artifacts\MapDefinitions\{mapName}.lml`
103+
104+
### GenerateXslt(GenerateXsltInput)
105+
106+
Compiles a data map and generates XSLT from the provided map content.
107+
108+
#### Parameters
109+
110+
| Name | Type | Description | Required |
111+
|------|------|-------------|----------|
112+
| generateXsltInput | GenerateXsltInput | The input containing data map content | Yes |
113+
114+
#### Returns
115+
116+
**`Task<byte[]>`**: A task representing the asynchronous operation that returns the generated XSLT content as a byte array.
117+
118+
#### Example
119+
120+
```csharp
121+
var mapContent = await File.ReadAllTextAsync("CustomMap.lml");
122+
var generateXsltInput = new GenerateXsltInput { MapContent = mapContent };
123+
var xslt = await executor.GenerateXslt(generateXsltInput);
124+
```
125+
126+
### RunMapAsync(string, byte[])
127+
128+
Executes a data map by applying the given XSLT to sample input data. The operation uses the map name to find the XSLT.
129+
130+
#### Parameters
131+
132+
| Name | Type | Description | Required |
133+
|------|------|-------------|----------|
134+
| mapName | string | The data map XSLT file name without the extension | Yes |
135+
| inputContent | byte[] | The content to transform | Yes |
136+
137+
#### Returns
138+
139+
**`Task<JToken>`**: A task representing the asynchronous operation that returns the transformed output as a JSON token.
140+
141+
#### Example
142+
143+
```csharp
144+
var xmlInput = "<Order><Item>Widget</Item></Order>";
145+
var inputData = System.Text.Encoding.UTF8.GetBytes(xmlInput);
146+
var result = await executor.RunMapAsync("OrderToInvoice", inputData);
147+
Console.WriteLine(result.ToString());
148+
```
149+
150+
> [!NOTE]
151+
>
152+
> This method looks for the XSLT file in the path: `{appDirectoryPath}\Artifacts\Maps\{mapName}.xslt`
153+
154+
### RunMapAsync(byte[], byte[])
155+
156+
Executes a data map by applying the given XSLT content to sample input data.
157+
158+
#### Parameters
159+
160+
| Name | Type | Description | Required |
161+
|------|------|-------------|----------|
162+
| xsltContent | byte[] | The data map XSLT content | Yes |
163+
| inputContent | byte[] | The input content to be transformed | Yes |
164+
165+
#### Returns
166+
167+
**`Task<JToken>`**: A task representing the asynchronous operation that returns the transformed output as a JSON token.
168+
169+
#### Example
170+
171+
```csharp
172+
// First generate XSLT
173+
var xslt = await executor.GenerateXslt("OrderToInvoice");
174+
175+
// Then execute transformation
176+
var xmlInput = "<Order><Item>Widget</Item></Order>";
177+
var inputData = System.Text.Encoding.UTF8.GetBytes(xmlInput
178+
var result = await executor.RunMapAsync(xslt, inputData);
179+
Console.WriteLine(result.ToString());
180+
```
181+
182+
## Related content
183+
184+
- [UnitTestExecutor Class Definition](unit-test-executor-class-definition.md)
185+
- [ActionMock Class Definition](action-mock-class-definition.md)
186+
- [TriggerMock Class Definition](trigger-mock-class-definition.md)
187+
- [TestWorkflowRun Class Definition](test-workflow-run-class-definition.md)

articles/logic-apps/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,9 @@ items:
616616
- name: TriggerMock class
617617
href: testing-framework/trigger-mock-class-definition.md
618618
- name: UnitTestExecutor class
619-
href: testing-framework/unit-test-executor-class-definition.md
619+
href: testing-framework/unit-test-executor-class-definition.md
620+
- name: DataMapTestExecutor class
621+
href: testing-framework/data-map-test-executor-class-definition.md
620622
- name: Azure Policy built-ins
621623
displayName: samples, policies, definitions
622624
href: ./policy-reference.md

0 commit comments

Comments
 (0)