diff --git a/src/tests/cucumber/features/modeler-features/epic2/us2.5.feature b/src/tests/cucumber/features/modeler-features/epic2/us2.5.feature index 1ea96d1ca0..34f98db52f 100644 --- a/src/tests/cucumber/features/modeler-features/epic2/us2.5.feature +++ b/src/tests/cucumber/features/modeler-features/epic2/us2.5.feature @@ -3,7 +3,7 @@ Feature: 2.5 - Pure modeler simple studies, with no ports and no timeseries Scenario: 2.5.1: One model with one load and two generators, one timestep Given the study path is "modeler/epic2/us2.5/study_2.5.1" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 160 And the optimal value of variable node1.gen1_p_0 is 80 And the optimal value of variable node1.gen2_p_0 is 20 @@ -11,7 +11,7 @@ Feature: 2.5 - Pure modeler simple studies, with no ports and no timeseries Scenario: 2.5.2: One model with one load and two generators (minP), three timesteps Given the study path is "modeler/epic2/us2.5/study_2.5.2" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 810 And the optimal values of the variables are | component | variable | timestep | value | @@ -23,7 +23,7 @@ Feature: 2.5 - Pure modeler simple studies, with no ports and no timeseries Scenario: 2.5.3: Two libs, one timestep Given the study path is "modeler/epic2/us2.5/study_2.5.3" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 15600 And the optimal values of the variables are | component | variable | timestep | value | @@ -37,7 +37,7 @@ Feature: 2.5 - Pure modeler simple studies, with no ports and no timeseries Scenario: 2.5.4: Test with integer variable Given the study path is "modeler/epic2/us2.5/study_2.5.4" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 540 And the optimal value of variable node1.gen_total_p_0 is 1000 And the optimal value of variable node1.gen_n_on_0 is 4 \ No newline at end of file diff --git a/src/tests/cucumber/features/modeler-features/epic2/us2.8.feature b/src/tests/cucumber/features/modeler-features/epic2/us2.8.feature index 4be774c962..8d7f409de4 100644 --- a/src/tests/cucumber/features/modeler-features/epic2/us2.8.feature +++ b/src/tests/cucumber/features/modeler-features/epic2/us2.8.feature @@ -3,7 +3,7 @@ Feature: 2.8 Scenario: 2.8.1: One model with one load and two generators, one timestep Given the study path is "modeler/1_1" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 160 And the optimal value of variable node1.gen1_p_0 is 80 And the optimal value of variable node1.gen2_p_0 is 20 @@ -11,7 +11,7 @@ Feature: 2.8 Scenario: 2.8.1: One model with one load and two generators, mix of constant and time dependent parameter, one timestep. Given the study path is "modeler/1_2" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 160 And the optimal value of variable node1.gen1_p_0 is 80 And the optimal value of variable node1.gen2_p_0 is 20 @@ -24,9 +24,9 @@ Feature: 2.8 Scenario: 2.8.1: Mixture of constant parameters and time series (2 time steps), With booleans type. Given the study path is "modeler/1_4" When I run antares modeler - Then the simulation succeeds + Then the modeler simulation succeeds And the objective value is 765 And the optimal values of the variables are | component | variable | timestep | value | | node1 | gen1_p | 0-1 | 80-0 | - | node1 | gen2_p | 0-2 | 20-100 | \ No newline at end of file + | node1 | gen2_p | 0-1 | 20-100 | \ No newline at end of file diff --git a/src/tests/cucumber/features/steps/common_steps/modeler_utils.py b/src/tests/cucumber/features/steps/common_steps/modeler_utils.py index e6074450c7..af66d83ba9 100644 --- a/src/tests/cucumber/features/steps/common_steps/modeler_utils.py +++ b/src/tests/cucumber/features/steps/common_steps/modeler_utils.py @@ -3,7 +3,6 @@ import subprocess import os -from common_steps.modeler_output_handler import modeler_output_handler def run_modeler(context): @@ -11,9 +10,7 @@ def run_modeler(context): print(f"Running command: {command}") process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) out, err = process.communicate() - context.output_path = os.path.join( context.study_path , "output") # TODO : fixme parse_output_folder_from_logs(out) context.return_code = process.returncode - context.moh = modeler_output_handler(context.output_path) def build_antares_modeler_command(context): diff --git a/src/tests/cucumber/features/steps/common_steps/steps.py b/src/tests/cucumber/features/steps/common_steps/steps.py index 04382cacdd..de89e7ef1c 100644 --- a/src/tests/cucumber/features/steps/common_steps/steps.py +++ b/src/tests/cucumber/features/steps/common_steps/steps.py @@ -9,6 +9,8 @@ from common_steps.simulator_utils import run_simulation from features.steps.common_steps.assertions import assert_double_close +from common_steps.modeler_output_handler import modeler_output_handler + @given('the study path is "{string}"') @@ -34,6 +36,14 @@ def simu_success(context): assert context.return_code == 0 +@then('the modeler simulation succeeds') +def simu_success(context): + assert context.return_code == 0 + context.output_path = os.path.join(context.study_path, "output") # TODO : fixme parse_output_folder_from_logs(out) + context.moh = modeler_output_handler(context.output_path) + + + @then('the simulation fails') def simu_success(context): assert context.return_code != 0 @@ -155,6 +165,7 @@ def get_value(row, ts): if "-" in ret and not ret.isdigit(): # Handle "80-0" but not single numbers ret = ret.split("-") # Split into a list of strings + print(f" ret = {ret} , ts = {ts}") return float(ret[ts]) # Index and convert to float return float(ret) # Single value case (apply to all timesteps)