Skip to main content

A stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory.

Project description

Data Factory - Testing Framework :hammer_and_wrench:

A stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory.

The framework is currently in Public Preview and is not officially supported by Microsoft.

Features :rocket:

The framework evaluates pipeline and activity definitions which can be asserted. It does so by providing the following features:

  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.
  2. Test an activity with a specific state and assert the evaluated expressions.
  3. Test a pipeline run by verifying the execution flow of activities for specific input parameters and assert the evaluated expressions of each activity.

The framework does not support running the actual pipeline. It only gives you the ability to test the pipeline and activity definitions.

High-level example :bulb:

Given a WebActivity with a typeProperties.url property containing the following expression:

@concat(pipeline().globalParameters.BaseUrl, variables('Path'))

A simple test to validate that the concatenation is working as expected could look like this:

    # Arrange
    activity = pipeline.get_activity_by_name("webactivity_name")
    state = PipelineRunState(
        parameters=[
            RunParameter(RunParameterType.Global, "BaseUrl", "https://example.com"),
        ],
        variables=[
            PipelineRunVariable("Path", "some-path"),
        ])

    # Act
    activity.evaluate(state)

    # Assert
    assert "https://example.com/some-path" == activity.type_properties["url"].result

Why :question:

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:

  • Runs locally with immediate feedback
  • Easier to cover a lot of different scenarios and edge cases
  • Regression testing

Concepts :books:

The following pages go deeper into different topics and concepts of the framework to help in getting you started.

Basic :seedling:

  1. Repository setup
  2. Installing and initializing the framework
  3. State
  4. Activity testing
  5. Pipeline testing

If you are a not that experienced with Python, you can follow the Getting started guide to get started with the framework.

Advanced :microscope:

  1. Debugging your activities and pipelines
  2. Development workflow
  3. Overriding expression functions
  4. Framework internals

Examples :memo:

More advanced examples demonstrating the capabilities of the framework:

Fabric:

  1. Batch job example

Azure Data Factory:

  1. Copy blobs example
  2. Batch job example

Limitations :warning:

The framework has the following limitations at the moment:

  1. The framework reimplements the Data Factory expression language in Python. This means that it might not be 100% accurate with the actual Data Factory language, especially when it comes to xml functions.
  2. The framework does not support automatic type conversion of arguments passed to functions in expressions.

These limitations are top priority to be resolved in the future.

Contributing :handshake:

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks :tm:

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Project details


Release history Release notifications | RSS feed

This version

0.2.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_factory_testing_framework-0.2.7.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file data_factory_testing_framework-0.2.7.tar.gz.

File metadata

File hashes

Hashes for data_factory_testing_framework-0.2.7.tar.gz
Algorithm Hash digest
SHA256 16fe9ced03aaca84793ba17b05386ca2dc29dd12e255b62f3d5f69df3bddcb35
MD5 301d54a3700a469da8c14a3b994ef0c2
BLAKE2b-256 8d5ec95a488931083a217459b7c786bf8fc57e0c14bff1e99e45b33934539939

See more details on using hashes here.

File details

Details for the file data_factory_testing_framework-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for data_factory_testing_framework-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 137801d4c00a4a6399454866305fc446668767febfcff8b1b94d1bdcdba43548
MD5 6698d93f1b22125f28141b6078a5ed68
BLAKE2b-256 c33c436322341183f1851eef4fee3d4453621e149775f62ae27b9059f5b4df2c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page