Skip to content

Conversation

@imdj360
Copy link

@imdj360 imdj360 commented Dec 4, 2025

Add optional parameters to Initialize() method allowing tests to use custom-named configuration files (local.settings.json, parameters.json, connections.json) located in the test project instead of the Logic App project.

Key Features:

  • Optional parameters: localSettingsFilename, parametersFilename, connectionsFilename
  • File resolution checks test project first, then falls back to Logic App project
  • Enables unified test suites across environments (DEV/QA/PROD) using the same test code with different configuration files
  • Maintains full backward compatibility with existing tests

Changes:

  • Added Initialize() method overload with optional configuration parameters
  • Added ResolveConfigurationFilePath() helper method for file resolution
  • Updated ProcessLocalSettingsFile(), ProcessParametersFile(), and ProcessConnectionsFile() to accept custom filenames
  • Created example test classes demonstrating the feature
  • Updated project version to 1.13.0

Examples:

  • parameters-dev.json, parameters-qa.json, parameters-prod.json
  • local.settings-custom.json, connections-custom.json

Add optional parameters to Initialize() method allowing tests to use
custom-named configuration files (local.settings.json, parameters.json,
connections.json) located in the test project instead of the Logic App
project.

Key Features:
- Optional parameters: localSettingsFilename, parametersFilename, connectionsFilename
- File resolution checks test project first, then falls back to Logic App project
- Enables unified test suites across environments (DEV/QA/PROD) using the same
  test code with different configuration files
- Maintains full backward compatibility with existing tests

Changes:
- Added Initialize() method overload with optional configuration parameters
- Added ResolveConfigurationFilePath() helper method for file resolution
- Updated ProcessLocalSettingsFile(), ProcessParametersFile(), and
  ProcessConnectionsFile() to accept custom filenames
- Created example test classes demonstrating the feature
- Updated project version to 1.13.0

Examples:
- parameters-dev.json, parameters-qa.json, parameters-prod.json
- local.settings-custom.json, connections-custom.json
- Add optional parameters to Initialize() for custom config filenames:
  * localSettingsFilename: Custom local settings file
  * testProjectPath: Path to test project directory
  * parametersFilename: Custom parameters file
  * connectionsFilename: Custom connections file

- Configuration file resolution precedence:
  * Initialize() parameter → testConfiguration.json → default
  * Custom files search test project first, then Logic App project
  * Custom files are copied to standard names for Logic App runtime

- Consolidate duplicate file processing logic:
  * Created ProcessConfigurationFile() helper method
  * Enhanced ResolveConfigurationFilePath() to return tuple with source info
  * Reduced code duplication by ~60% in file processing section

- Fix testConfiguration.json structure:
  * Move localSettingsFilename to root level (not inside workflow section)
  * Ensures proper configuration loading for default test behavior

- Copy behavior:
  * Custom files from test project are copied to testConfiguration.json
@imdj360
Copy link
Author

imdj360 commented Dec 4, 2025

@shadhajSH @mark-abrams @sanket-borhade

Could you take a look at this PR. This PR adds flexible support for custom configuration files in LogicAppUnit test projects, allowing a single test suite to target multiple Logic App projects. It introduces optional Initialize() parameters, improved file-resolution logic, and consolidated config-processing code. Default behavior remains unchanged, and new sample tests demonstrate how custom configs can be used effectively. All existing tests pass, with no breaking changes introduced.

image image

@mark-abrams
Copy link
Collaborator

Hi @imdj360 , thank you for your contribution. I will take a look.

@mark-abrams mark-abrams self-requested a review December 5, 2025 20:22
@imdj360
Copy link
Author

imdj360 commented Dec 6, 2025

@mark-abrams - Could you please validate these findings? The issue appears to be platform-dependent and unrelated to the custom configuration code changes in this PR.

image image

Testing Update - macOS Verification
I've verified the inline script test failure on macOS with the following results:

Main Branch (v1.12.0) - Baseline Test
LogicAppUnit: net6.0
Test Project: net8.0
Result: ❌ InlineScriptWorkflowTest_When_Successful FAILS with identical error

PR #54 Branch (dynamicparameterjson)
LogicAppUnit: net6.0
Test Project: net8.0
Custom Config Tests: ✅ ALL PASS (4/4)
HTTP Tests: ✅ ALL PASS (8/8)
Inline Script Test: ❌ SAME ERROR as main branch
Conclusion
✅ The inline script test failure is NOT caused by PR #54

This issue:

Pre-exists on main branch v1.12.0
Is platform-specific (Windows passes, macOS/Linux fails)
Root cause: Azure Workflows Extension Bundle v1.149.59 has internal dependencies compiled for .NET 6.0, causing assembly version conflicts when running on .NET 8.0 runtime on macOS/Linux
PR #54 adds custom configuration file support and all related functionality works correctly. The inline script failure is a separate, pre-existing platform compatibility issue that affects main branch as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants