Skip to content

Local Settings file

Mark Abrams edited this page Apr 17, 2023 · 2 revisions

Each Logic App includes a mandatory settings file. The default name for this file is local.settings.json. The testing framework can be configured to use a different settings file if required, using the localSettingsFilename option in the testConfiguration.json file:

"localSettingsFilename": "local.settings.unitTests.json"

Overriding Settings Values in a Test

The testing framework will use the Logic App's settings file for each workflow that is tested. There may be a scenario where a test case wants to exercise a scenario which requires different values for one or more settings. An example would be a feature flag that needs to be enabled to allow testing of the feature.

A test author can implement this by using the WorkflowTestBase.CreateTestRunner(Dictionary<string, string>) overload when creating the TestRunner and passing a dictionary containing the settings to be overridden and their values.

Here is an example:

var settingsToOverride = new Dictionary<string, string>()
{
  { "DefaultAddressType", "physical" },
  { "EnableV2Functionaity", "true" }
};

using (TestRunner testRunner = CreateTestRunner(settingsToOverride))

The test execution log will include logging to show when local settings have been overridden:

Updating local settings file with test overrides:
    DefaultAddressType
      Updated value to: physical
    EnableV2Functionaity
      Updated value to: true
Clone this wiki locally