data-factory-testing-framework


Namedata-factory-testing-framework JSON
Version 0.2.8 PyPI version JSON
download
home_pageNone
SummaryA stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory.
upload_time2024-05-01 08:32:24
maintainerNone
docs_urlNone
authorArjen Kroezen
requires_python<3.13,>=3.9
licenseMIT
keywords fabric datafactory unit-testing functional-testing azure
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](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).

> 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:

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

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

```python
    # 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](docs/basic/repository_setup.md)
2. [Installing and initializing the framework](docs/basic/installing_and_initializing_framework.md)
3. [State](docs/basic/state.md)
4. [Activity testing](docs/basic/activity_testing.md)
5. [Pipeline testing](docs/basic/pipeline_testing.md)

> 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.

### Advanced :microscope:

1. [Debugging your activities and pipelines](docs/advanced/debugging.md)
2. [Development workflow](docs/advanced/development_workflow.md)
3. [Overriding expression functions](docs/advanced/overriding_expression_functions.md)
4. [Framework internals](docs/advanced/framework_internals.md)

## Examples :memo:

More advanced examples demonstrating the capabilities of the framework:

Fabric:

1. [Batch job example](examples/fabric/batch_job/README.md)

Azure Data Factory:

1. [Copy blobs example](examples/data_factory/copy_blobs/README.md)
2. [Batch job example](examples/data_factory/batch_job/README.md)

## 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](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto: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](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
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.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "data-factory-testing-framework",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "fabric, datafactory, unit-testing, functional-testing, azure",
    "author": "Arjen Kroezen",
    "author_email": "arjenkroezen@microsoft.com",
    "download_url": "https://files.pythonhosted.org/packages/f5/ae/9d0f2f08eb6b86ee047f22c5480aec96b4a86f9e561314731bffe234be32/data_factory_testing_framework-0.2.8.tar.gz",
    "platform": null,
    "description": "# Data Factory - Testing Framework :hammer_and_wrench:\n\nA 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).\n\n> The framework is currently in _Public Preview_ and is not officially supported by Microsoft.\n\n## Features :rocket:\n\nThe framework evaluates pipeline and activity definitions which can be asserted. It does so by providing the following features:\n\n1. 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.\n2. Test an activity with a specific state and assert the evaluated expressions.\n3. Test a pipeline run by verifying the execution flow of activities for specific input parameters and assert the evaluated expressions of each activity.\n\n> The framework does not support running the actual pipeline. It only gives you the ability to test the pipeline and activity definitions.\n\n### High-level example :bulb:\n\nGiven a `WebActivity` with a `typeProperties.url` property containing the following expression:\n\n```datafactoryexpression\n@concat(pipeline().globalParameters.BaseUrl, variables('Path'))\n```\n\nA simple test to validate that the concatenation is working as expected could look like this:\n\n```python\n    # Arrange\n    activity = pipeline.get_activity_by_name(\"webactivity_name\")\n    state = PipelineRunState(\n        parameters=[\n            RunParameter(RunParameterType.Global, \"BaseUrl\", \"https://example.com\"),\n        ],\n        variables=[\n            PipelineRunVariable(\"Path\", \"some-path\"),\n        ])\n\n    # Act\n    activity.evaluate(state)\n\n    # Assert\n    assert \"https://example.com/some-path\" == activity.type_properties[\"url\"].result\n   ```\n\n## Why :question:\n\nData 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:\n\n* Runs locally with immediate feedback\n* Easier to cover a lot of different scenarios and edge cases\n* Regression testing\n\n## Concepts :books:\n\nThe following pages go deeper into different topics and concepts of the framework to help in getting you started.\n\n### Basic :seedling:\n\n1. [Repository setup](docs/basic/repository_setup.md)\n2. [Installing and initializing the framework](docs/basic/installing_and_initializing_framework.md)\n3. [State](docs/basic/state.md)\n4. [Activity testing](docs/basic/activity_testing.md)\n5. [Pipeline testing](docs/basic/pipeline_testing.md)\n\n> 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.\n\n### Advanced :microscope:\n\n1. [Debugging your activities and pipelines](docs/advanced/debugging.md)\n2. [Development workflow](docs/advanced/development_workflow.md)\n3. [Overriding expression functions](docs/advanced/overriding_expression_functions.md)\n4. [Framework internals](docs/advanced/framework_internals.md)\n\n## Examples :memo:\n\nMore advanced examples demonstrating the capabilities of the framework:\n\nFabric:\n\n1. [Batch job example](examples/fabric/batch_job/README.md)\n\nAzure Data Factory:\n\n1. [Copy blobs example](examples/data_factory/copy_blobs/README.md)\n2. [Batch job example](examples/data_factory/batch_job/README.md)\n\n## Limitations :warning:\n\nThe framework has the following limitations at the moment:\n\n1. 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.\n2. The framework does not support automatic type conversion of arguments passed to functions in expressions.\n\n> These limitations are top priority to be resolved in the future.\n\n## Contributing :handshake:\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks :tm:\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A stand-alone test framework that allows to write unit tests for Data Factory pipelines on Microsoft Fabric and Azure Data Factory.",
    "version": "0.2.8",
    "project_urls": null,
    "split_keywords": [
        "fabric",
        " datafactory",
        " unit-testing",
        " functional-testing",
        " azure"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e973be86ffe5558eeb7789ed0f8f3547e28ea32af7bd70b64e0ccdd1baa1d5e",
                "md5": "0b90f46f5418fae53abe218a7c544bce",
                "sha256": "927592ab99926ca66af9a114f3f20d95ec94b2aed85c53a07df90cb8226db746"
            },
            "downloads": -1,
            "filename": "data_factory_testing_framework-0.2.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b90f46f5418fae53abe218a7c544bce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 72778,
            "upload_time": "2024-05-01T08:32:22",
            "upload_time_iso_8601": "2024-05-01T08:32:22.655733Z",
            "url": "https://files.pythonhosted.org/packages/7e/97/3be86ffe5558eeb7789ed0f8f3547e28ea32af7bd70b64e0ccdd1baa1d5e/data_factory_testing_framework-0.2.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5ae9d0f2f08eb6b86ee047f22c5480aec96b4a86f9e561314731bffe234be32",
                "md5": "c00ccaa58d2e116608ff9d2b3d2e54be",
                "sha256": "2aa484fd1317324887ce4c6f3869e7e0e00f6c44155f8dfec5830de68db813e1"
            },
            "downloads": -1,
            "filename": "data_factory_testing_framework-0.2.8.tar.gz",
            "has_sig": false,
            "md5_digest": "c00ccaa58d2e116608ff9d2b3d2e54be",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 35028,
            "upload_time": "2024-05-01T08:32:24",
            "upload_time_iso_8601": "2024-05-01T08:32:24.565785Z",
            "url": "https://files.pythonhosted.org/packages/f5/ae/9d0f2f08eb6b86ee047f22c5480aec96b4a86f9e561314731bffe234be32/data_factory_testing_framework-0.2.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-01 08:32:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "data-factory-testing-framework"
}
        
Elapsed time: 0.29634s