You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This unit test framework is not officially supported.
18
-
It is currently in an experimental state and has not been tested with every single data factory resource.
19
-
It should support all activities out-of-the-box but has not been thoroughly tested,
20
-
please report any issues in the issues section and include an example of the pipeline that is not working as expected.
21
-
22
-
If there's a lot of interest in this framework, then we will continue to improve it and move it to a production-ready state.
3
+
A stand-alone test framework that allows to write unit tests for Data Factory pipelines on [Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/data-factory/) and [Azure Data Factory](https://learn.microsoft.com/en-us/azure/data-factory/concepts-pipelines-activities?tabs=data-factory).
23
4
24
5
## Features
25
6
26
-
Goal: Validate that the evaluated pipeline configuration with its expressions is behaving as expected on runtime.
27
-
28
-
1. Evaluate expressions with their functions and arguments instantly by using the framework's internal expression parser.
29
-
2. Test a pipeline or activity against any state to assert the expected outcome.
30
-
A state can be configured with pipeline parameters, global parameters, variables and activity outputs.
31
-
3. Simulate a pipeline run and evaluate the execution flow and outcome of each activity.
32
-
4. Dynamically supports all activity types with all their attributes.
33
-
34
-
> Pipelines and activities are not executed on any Data Factory environment,
35
-
> but the evaluation of the pipeline configuration is validated locally.
36
-
> This is different from the "validation" functionality present in the UI,
37
-
> which only validates the syntax of the pipeline configuration.
38
-
39
-
## Why
40
-
41
-
Data Factory does not support unit testing out of the box.
42
-
The only way to validate your changes is through manual testing or running e2e tests against a deployed data factory.
43
-
These tests are great to have, but miss the following benefits that unit tests, like using this unit test framework, provide:
44
-
45
-
* Shift left with immediate feedback on changes - Evaluate any individual data factory resource
46
-
(pipelines, activities, triggers, datasets, linked services etc..), including (complex) expressions
47
-
* Allows testing individual resources (e.g. activity) for many different input values to cover more scenarios.
48
-
* Less issues in production - due to the fast nature of writing and running unit tests,
49
-
you will write more tests in less time and therefore have a higher test coverage.
50
-
This means more confidence in new changes, fewer risks in breaking existing features (regression tests),
51
-
and thus far fewer issues in production.
52
-
53
-
> Even though Data Factory is UI-driven writing unit tests, and might not be in the nature of it.
54
-
> How can you be confident that your changes will work as expected,
55
-
> and that existing pipelines will not break, without writing unit tests?
56
-
57
-
## Getting started
58
-
59
-
### Start writing tests with a Dev Container
60
-
61
-
To get started using the tests, refer to the following [README](./examples/README.md)
62
-
63
-
### Start writing tests without a Dev Container
64
-
65
-
1. Set up an empty Python project with your favorite testing library
66
-
2. Install the dotnet runtime from [here](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
67
-
Using only the runtime and not the SDK should be sufficient.
68
-
This is required to run some expression functions on dotnet just like in Data Factory.
69
-
3. Set up an empty Python project with your favorite testing library
4. Install the package using your preferred package manager:
7
+
The framework evaluates pipeline and activity definitions which can be asserted. It does so by providing the following features:
74
8
75
-
Pip: `pip install data-factory-testing-framework`
9
+
1. Evaluate expressions by using the framework's internal expression parser. It supports all the functions and arguments that are available in the Data Factory expression language.
10
+
2. Test an activity with a specific state and assert the evaluated expressions.
11
+
3. Test a pipeline run by verifying the execution flow of activities for specific input parameters and assert the evaluated expressions of each activity.
76
12
77
-
5. Create a Folder in your project and copy the JSON Files with the pipeline definitions locally.
13
+
> The framework does not support running the actual pipeline. It only gives you the ability to test the pipeline and activity definitions.
body = create_batch_activity.type_properties["body"].get_json_value()
147
-
assert"123"== body["JobId"]
148
-
assert"Job-123"== body["JobName"]
149
-
assert"version1"== body["Version"]
150
-
151
-
with pytest.raises(StopIteration):
152
-
next(activities)
153
-
```
154
-
155
-
> See the [Examples](/examples) folder for more samples
156
-
157
-
## Registering missing expression functions
158
-
159
-
As the framework is interpreting expressions containing functions, these functions are implemented in the framework,
160
-
but there may be bugs in some of them. You can override their implementation through:
45
+
Data Factory does not support unit testing, nor testing of pipelines locally. Having integration and e2e tests running on an actual Data Factory instance is great, but having unit tests on top of them provides additional means of quick iteration, validation and regression testing. Unit testing with the _Data Factory Testing Framework_ has the following benefits:
> If you are a not that experienced with Python, you can follow the [Getting started](docs/basic/getting_started.md) guide to get started with the framework.
64
+
65
+
### Advanced
166
66
167
-
## Tips
67
+
1.[Debugging your activities and pipelines](docs/advanced/debugging.md)
As the framework is dynamically parsing and interpreting data factory resource files, it can be challenging to identify which objects you are working with. It is recommended to use the debugger during development of your tests to get a better idea of what activities are being returned and to understand the structure of the activity and its properties.
This page will be used to describe the internals of the testing framework. It will be used to document the architecture, design decisions, and implementation details of the framework.
0 commit comments