Coder Social home page Coder Social logo

carlossardo / data-factory-testing-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/data-factory-testing-framework

0.0 0.0 0.0 3.66 MB

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

License: MIT License

Shell 0.07% JavaScript 0.12% Python 99.80%

data-factory-testing-framework's Introduction

Data Factory - Testing Framework

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

Features

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

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

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

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

Basic

  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

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

Examples

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

Contributing

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 [email protected] with any additional questions or comments.

Disclaimer

This unit test framework is not officially supported. It is currently in an experimental state and has not been tested with every single data factory resource. It should support all activities out-of-the-box but has not been thoroughly tested, please report any issues in the issues section and include an example of the pipeline that is not working as expected.

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.

Trademarks

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.

data-factory-testing-framework's People

Contributors

arjendev avatar leonardhd avatar microsoftopensource avatar jayachithra avatar liliamleme avatar ydaponte avatar microsoft-github-operations[bot] avatar microsoft-github-policy-service[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.