Skip to content

Using the Testing Framework

Mark Abrams edited this page Jul 27, 2023 · 6 revisions

The WorkflowTestBase class is an abstract base class that contains functionality to set up and configure the testing framework. All test classes must inherit from this base class. This example uses test attributes for MSTest to define a test class and the test initialization and clean-up methods:

[TestClass]
public class MyWorkflowTest : WorkflowTestBase
{
    [TestInitialize]
    public void TestInitialize()
    {
        Initialize("../../../../LogicAppUnit.Samples.LogicApps", "my-test-workflow");
    }

    [ClassCleanup]
    public static void CleanResources()
    {
        Close();
    }
}

The Initialize() method is used to configure a workflow for testing. The path to the Logic App's root folder and the name of the workflow are passed as parameters. The actions performed by this method to prepare the workflow for testing are described in later sections.

The Close() method is used to free up the resources used by the testing framework, once all tests in the test class have completed.

Once the WorkflowTestBase class has been configured in the test class, the next step is to write the tests. A popular approach is to split the test into three parts, based on the AAA (Arrange, Act, Assert) pattern:

Clone this wiki locally