Commit graph

22 commits

Author SHA1 Message Date
Sipke Schoorstra 4bbdd6f3a7
Configures Flowchart Execution via DI (#7141)
* Introduce `FlowchartExecutionMode` to streamline flowchart execution logic.

- Added `FlowchartExecutionMode` enum to represent execution modes (Default, TokenBased, CounterBased).
- Updated flowchart-related integration and unit tests to use the new execution mode.
- Removed the global `UseTokenFlow` flag in favor of execution-specific configuration via `RunWorkflowOptions`.
- Refactored flowchart-related APIs and test helpers for improved flexibility and modularity.

* Add support for configuring flowchart execution behavior via `FlowchartOptions` and DI.

- Introduced extensions for `FlowchartFeature` to simplify configuration.
- Added DI support for setting default execution modes.
- Refactored flowchart execution logic to prioritize configuration.

* Update default Flowchart execution settings to align with version 3.5.2 behavior

- Changed `DefaultExecutionMode` to `CounterBased`.
- Updated `UseTokenFlow` default to `false`.

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/FlowchartExecutionMode.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/FlowchartFeatureExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/Elsa.Workflows.IntegrationTests/Scenarios/FlowchartNextActivity/Tests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/RunWorkflowOptionsExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor flowchart integration tests for improved formatting and consistency

* Refactor workflow tests and related services to improve reusability and align with updated Flowchart execution behavior

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Options/FlowchartOptions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor flowchart execution logic to use `FlowchartExecutionMode` enum, replacing boolean checks for improved clarity and extensibility.

* Refactor tests and workflow logic to replace boolean `useTokenFlow` with `FlowchartExecutionMode` enum for clarity and consistency.

* Refactor flowchart execution logic to centralize mode-based behavior handling and simplify implementation.

* Remove unnecessary whitespace in Flowchart.cs to improve code formatting

* Remove unnecessary whitespace in FlowJoinTests.cs to improve code formatting

* Update src/common/Elsa.Testing.Shared.Integration/WorkflowTestFixture.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/Flowchart.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-15 10:15:39 +01:00
Sipke Schoorstra e261a91127
Add unit and integration tests for FlowDecision activity to validate branching and nested workflow logic (#7117)
* Add unit and integration tests for `FlowDecision` activity to validate branching and nested workflow logic

- Included integration tests covering `FlowDecision` behavior for conditions, nested decisions, single-path scenarios, and path convergence in flowcharts.
- Added unit tests to verify correctness of outcomes, default behavior, and condition evaluation logic.

* Refactor `FlowDecisionTests` to improve parameterized test coverage, streamline assertions, and enhance test organization by introducing reusable data providers.

* Add `[Collection("FlowchartTests")]` annotation to `FlowDecisionTests` to improve test grouping and execution consistency.
2025-11-27 20:57:38 +01:00
lucas.hipolito 66b94edd61 FlowJoin - Improving unit tests, more DRY + integration test 2025-11-04 10:24:16 +01:00
lukhipolito-nexxbiz 86a5b62c29
Update test/unit/Elsa.Activities.UnitTests/Branching/FlowJoinTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-04 08:53:51 +01:00
lucas.hipolito 8dff68e0f1 Unit test coverage Flow Join activity 2025-11-03 14:01:07 +01:00
lucas.hipolito 0d59ad970a Assertion for null condition 2025-10-27 14:04:55 +01:00
lucas.hipolito b737364a4e Improvements to If unit tests 2025-10-27 13:54:33 +01:00
lucas.hipolito aedcb3a349 Refactoring for improved testing - If activity 2025-10-27 10:23:04 +01:00
lukhipolito-nexxbiz 47905536b4
Update test/unit/Elsa.Activities.UnitTests/Branching/IfTests.cs
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2025-10-23 14:22:33 +02:00
lukhipolito-nexxbiz 743c51e313
Update test/unit/Elsa.Activities.UnitTests/Branching/IfTests.cs
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2025-10-23 14:22:26 +02:00
lucas.hipolito 549e58d355 Reducing double execution in If tests 2025-10-22 09:13:14 +02:00
lucas.hipolito 692c66866e Auto stash before merge of "feat/unit-test-coverage-if" and "develop/3.6.0" 2025-10-21 16:12:52 +02:00
lucas.hipolito 5ba0fbab56 Merge branch 'develop/3.6.0' into feat/unit-test-coverage-if 2025-10-21 15:45:15 +02:00
lukhipolito-nexxbiz 5c655e0a44
Merge pull request #6966 from elsa-workflows/feat/unit-test-coverage-switch
Feat/unit test coverage switch
2025-10-21 15:39:52 +02:00
Sipke Schoorstra d0a4520e7d
Adds unit tests for FlowSwitch activity (#6996)
* Add unit tests for `FlowFork` activity and enhance test utilities

- Introduce `FlowForkTests` to validate activity behavior with various branch configurations.
- Extend `ActivityExecutionContextExtensions` with methods to retrieve and check outcomes.
- Modify `ActivityTestFixture` to ensure activities transition to `Running` status before execution.

* Add unit tests for `FlowSwitch` activity and extend test utilities

- Implement `FlowSwitchTests` to verify behavior based on switch cases, modes, and literal expressions.
- Enhance `ActivityExecutionContextExtensions` with methods to retrieve and check outcomes in execution context.

* Update test guidelines to include examples for checking activity outcomes

- Add unit test examples for validating multiple and default outcomes.
- Extend documentation to describe new `ActivityExecutionContextExtensions` methods: `GetOutcomes` and `HasOutcome`.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify `GetOutcomes` method in `ActivityExecutionContextExtensions`.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 15:36:12 +02:00
Sipke Schoorstra f7b7ea4d73
Add unit tests for FlowFork activity and enhance test utilities (#6995)
* Add unit tests for `FlowFork` activity and enhance test utilities

- Introduce `FlowForkTests` to validate activity behavior with various branch configurations.
- Extend `ActivityExecutionContextExtensions` with methods to retrieve and check outcomes.
- Modify `ActivityTestFixture` to ensure activities transition to `Running` status before execution.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 15:31:31 +02:00
lucas.hipolito 952a946537 Grouping tests into theories 2025-10-21 12:01:24 +02:00
lucas.hipolito ba56fa9f97 Improving cleanliness and usability of unit tests 2025-10-21 11:08:35 +02:00
Sipke Schoorstra ccc2092c8f
Refactor SwitchTests: simplify syntax, replace ActivityTestHelper usage with direct ExecuteAsync method, and clean up unused imports. 2025-10-20 21:34:14 +02:00
Sipke Schoorstra 52a70e5d00
Refactor unit tests for SendHttpRequest and If activities by introducing ExecuteAsync helper.
This update replaces repetitive service configuration and execution logic with streamlined `ExecuteAsync` methods in unit tests. The refactor enhances code readability, reduces redundancy, and improves maintainability across test cases.
2025-10-20 21:13:31 +02:00
lucas.hipolito 954e88bae5 Unit test coverage for If activity 2025-10-14 11:45:21 +02:00
lucas.hipolito 234a2a80c0 Unit test coverage for Switch activity 2025-10-14 10:04:24 +02:00