From 67541a6b1889b7f30c400de1603e1c4c995696f0 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:00:54 +0200 Subject: [PATCH 1/8] Move cucumber tests to dedicated submodule --- .gitmodules | 3 +++ src/tests/cucumber/features/medium_tests.feature | 2 +- src/tests/cucumber/features/short_tests.feature | 12 ++++++------ src/tests/cucumber/features/steps/steps.py | 4 ++-- src/tests/cucumber/simulator-cucumber-tests | 1 + 5 files changed, 13 insertions(+), 9 deletions(-) create mode 160000 src/tests/cucumber/simulator-cucumber-tests diff --git a/.gitmodules b/.gitmodules index 16639d0fb1..9cbb675ee9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,6 @@ [submodule "src/tests/resources/Antares_Simulator_Tests_NR"] path = src/tests/resources/Antares_Simulator_Tests_NR url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR.git +[submodule "src/tests/cucumber/simulator-cucumber-tests"] + path = src/tests/cucumber/simulator-cucumber-tests + url = https://github.com/AntaresSimulatorTeam/simulator-cucumber-tests diff --git a/src/tests/cucumber/features/medium_tests.feature b/src/tests/cucumber/features/medium_tests.feature index 98e8a6fb26..26a8e74ef3 100644 --- a/src/tests/cucumber/features/medium_tests.feature +++ b/src/tests/cucumber/features/medium_tests.feature @@ -2,7 +2,7 @@ Feature: medium tests @fast @medium @incomplete Scenario: 035 Mixed Expansion - Smart grid model 2 - Given the study path is "medium-tests/035 Mixed Expansion - Smart grid model 2" + Given the study path is "simulator-cucumber-tests/035 Mixed Expansion - Smart grid model 2" When I run antares simulator Then the simulation takes less than 15 seconds And the simulation succeeds diff --git a/src/tests/cucumber/features/short_tests.feature b/src/tests/cucumber/features/short_tests.feature index 8a1d65d6c7..b219a0cb11 100644 --- a/src/tests/cucumber/features/short_tests.feature +++ b/src/tests/cucumber/features/short_tests.feature @@ -2,7 +2,7 @@ Feature: short tests @fast @short Scenario: 001 One node - passive - Given the study path is "short-tests/001 One node - passive" + Given the study path is "001 One node - passive" When I run antares simulator Then the simulation takes less than 5 seconds And the simulation succeeds @@ -12,7 +12,7 @@ Feature: short tests @fast @short Scenario: 002 Thermal fleet - Base - Given the study path is "short-tests/002 Thermal fleet - Base" + Given the study path is "002 Thermal fleet - Base" When I run antares simulator Then the simulation takes less than 5 seconds And the simulation succeeds @@ -24,7 +24,7 @@ Feature: short tests @fast @short Scenario: 003 Thermal fleet - Must-run - Given the study path is "short-tests/003 Thermal fleet - Must-run" + Given the study path is "003 Thermal fleet - Must-run" When I run antares simulator Then the simulation takes less than 5 seconds And the simulation succeeds @@ -36,10 +36,10 @@ Feature: short tests @fast @short Scenario: 021 Four areas - DC law - Given the study path is "short-tests/021 Four areas - DC law" + Given the study path is "021 Four areas - DC law-simplified" When I run antares simulator Then the simulation takes less than 20 seconds And the simulation succeeds And the annual system cost is - | EXP | STD | MIN | MAX | - | 7.972e+10 | 2.258e+10 | 5.613e+10 | 1.082e+11 | \ No newline at end of file + | EXP | STD | MIN | MAX | + | 6.5397e+10| 2.97462e+09 | 6.10076e+10 | 6.84837e+10 | \ No newline at end of file diff --git a/src/tests/cucumber/features/steps/steps.py b/src/tests/cucumber/features/steps/steps.py index f49bed8868..a6488068fa 100644 --- a/src/tests/cucumber/features/steps/steps.py +++ b/src/tests/cucumber/features/steps/steps.py @@ -8,12 +8,12 @@ @given('the study path is "{string}"') def study_path_is(context, string): - context.study_path = os.path.join("..", "resources", "Antares_Simulator_Tests_NR" , string.replace("/", os.sep)) + context.study_path = os.path.join("simulator-cucumber-tests", string.replace("/", os.sep)) @when('I run antares simulator') def run_antares(context): context.use_ortools = True - context.ortools_solver = "sirius" + context.ortools_solver = "xpress" context.named_mps_problems = False context.parallel = False run_simulation(context) diff --git a/src/tests/cucumber/simulator-cucumber-tests b/src/tests/cucumber/simulator-cucumber-tests new file mode 160000 index 0000000000..d6b95f44ed --- /dev/null +++ b/src/tests/cucumber/simulator-cucumber-tests @@ -0,0 +1 @@ +Subproject commit d6b95f44edb73213420ac638d2f4f0d1fc7ce14b From cb8b8abbb2d997407e458caa4e2dd55b2fdd3a3b Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:05:07 +0200 Subject: [PATCH 2/8] Update doc --- src/tests/cucumber/readme.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tests/cucumber/readme.md b/src/tests/cucumber/readme.md index 7ed6304d9f..4f6b546851 100644 --- a/src/tests/cucumber/readme.md +++ b/src/tests/cucumber/readme.md @@ -61,10 +61,7 @@ Workflow file: [here](../../../.github/workflows/cucumber-tests/action.yml) ## Under the hood ### Test files -Tests are hosted in the [Antares_Simulator_Tests_NR submodule](https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR) -into the `src/test/resources` folder. Adding or modifying a study should thus change contents of this submodule. +Tests are hosted in the [simulator-cucumber-tests submodule](https://github.com/AntaresSimulatorTeam/simulator-cucumber-tests) into the `src/test/cucmber` folder. Adding or modifying a study should thus change contents of this submodule. ### Code-behind -All Gherkin steps have a code-behind definition called "step definitions". These are defined in the python files under -[features/steps](./features/steps) and use the [behave](https://behave.readthedocs.io/en/latest/) implementation of -cucumber. Feel free to add extra steps for your tests. +All Gherkin steps have a code-behind definition called "step definitions". These are defined in the python files under [features/steps](./features/steps) and use the [behave](https://behave.readthedocs.io/en/latest/) implementation of cucumber. Feel free to add extra steps for your tests. From 63d4af35366a9081db4de04beeae23fbf1ef82b0 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:06:28 +0200 Subject: [PATCH 3/8] Antares_Simulator_Tests_NR -> simulator-cucmber-tests --- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows-vcpkg.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2c73097adb..19051de191 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -146,9 +146,9 @@ jobs: run: | git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests - - name: Init submodule Antares_Simulator_Tests_NR + - name: Init submodule simulator-cucmber-tests run: | - git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests_NR + git submodule update --init --remote --recursive src/tests/cucumber/simulator-cucumber-tests - name: Run named mps tests if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index e5cf8fea3f..193712a423 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -114,9 +114,9 @@ jobs: run: | git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests - - name: Init submodule Antares_Simulator_Tests_NR + - name: Init submodule simulator-cucmber-tests run: | - git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR + git submodule update --init --remote --recursive src/tests/cucumber/simulator-cucumber-tests - name: Enable git longpaths run: git config --system core.longpaths true From d37641b279c98b67a1881d5cf7341ee2eaf24c75 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:09:00 +0200 Subject: [PATCH 4/8] Remove submodule Antares_Simulator_Tests_NR --- .gitmodules | 3 --- src/tests/resources/Antares_Simulator_Tests_NR | 1 - 2 files changed, 4 deletions(-) delete mode 160000 src/tests/resources/Antares_Simulator_Tests_NR diff --git a/.gitmodules b/.gitmodules index 9cbb675ee9..24d833a86e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,9 +5,6 @@ [submodule "vcpkg"] path = vcpkg url = https://github.com/microsoft/vcpkg.git -[submodule "src/tests/resources/Antares_Simulator_Tests_NR"] - path = src/tests/resources/Antares_Simulator_Tests_NR - url = https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR.git [submodule "src/tests/cucumber/simulator-cucumber-tests"] path = src/tests/cucumber/simulator-cucumber-tests url = https://github.com/AntaresSimulatorTeam/simulator-cucumber-tests diff --git a/src/tests/resources/Antares_Simulator_Tests_NR b/src/tests/resources/Antares_Simulator_Tests_NR deleted file mode 160000 index 9983782bc0..0000000000 --- a/src/tests/resources/Antares_Simulator_Tests_NR +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9983782bc07c62f99854b1c7394d320830a40e14 From 0a38553729bff3681747675bcb4c0e9b9abf4e8b Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:19:01 +0200 Subject: [PATCH 5/8] Revert --- src/tests/cucumber/features/steps/steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/cucumber/features/steps/steps.py b/src/tests/cucumber/features/steps/steps.py index a6488068fa..8af02f9874 100644 --- a/src/tests/cucumber/features/steps/steps.py +++ b/src/tests/cucumber/features/steps/steps.py @@ -13,7 +13,7 @@ def study_path_is(context, string): @when('I run antares simulator') def run_antares(context): context.use_ortools = True - context.ortools_solver = "xpress" + context.ortools_solver = "sirius" context.named_mps_problems = False context.parallel = False run_simulation(context) From e508b6837955a8c8d936d189baa50e6befdfabfe Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:32:36 +0200 Subject: [PATCH 6/8] Remove medium features --- .github/workflows/ubuntu.yml | 7 +------ .github/workflows/windows-vcpkg.yml | 7 +------ src/tests/cucumber/features/medium_tests.feature | 15 --------------- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 src/tests/cucumber/features/medium_tests.feature diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 19051de191..49ef677834 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -235,7 +235,7 @@ jobs: batch-name: short-tests os: ${{ env.os }} - - name: Run cucumber on short-tests + - name: Run cucumber tests uses: ./.github/workflows/cucumber-tests with: feature: "features/short_tests.feature" @@ -282,11 +282,6 @@ jobs: batch-name: medium-tests os: ${{ env.os }} - - name: Run cucumber on medium-tests - uses: ./.github/workflows/cucumber-tests - with: - feature: "features/medium_tests.feature" - - name: Run long-tests-1 if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} uses: ./.github/workflows/run-tests diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 193712a423..5235d95e09 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -245,7 +245,7 @@ jobs: batch-name: short-tests os: ${{ env.os }} - - name: Run cucumber on short-tests + - name: Run cucumber tests uses: ./.github/workflows/cucumber-tests with: feature: "features/short_tests.feature" @@ -284,11 +284,6 @@ jobs: batch-name: medium-tests os: ${{ env.os }} - - name: Run cucumber on medium-tests - uses: ./.github/workflows/cucumber-tests - with: - feature: "features/medium_tests.feature" - - name: Run long-tests-1 if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} uses: ./.github/workflows/run-tests diff --git a/src/tests/cucumber/features/medium_tests.feature b/src/tests/cucumber/features/medium_tests.feature deleted file mode 100644 index 26a8e74ef3..0000000000 --- a/src/tests/cucumber/features/medium_tests.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: medium tests - - @fast @medium @incomplete - Scenario: 035 Mixed Expansion - Smart grid model 2 - Given the study path is "simulator-cucumber-tests/035 Mixed Expansion - Smart grid model 2" - When I run antares simulator - Then the simulation takes less than 15 seconds - And the simulation succeeds - And the expected value of the annual system cost is 3.725e+10 - And the minimum annual system cost is 3.642e+10 - And the maximum annual system cost is 4.011e+10 - And the annual system cost is - | EXP | STD | MIN | MAX | - | 3.725e+10 | 1.063e+09 | 3.642e+10 | 4.011e+10 | - # TODO : add steps when we understand what this test is supposed to test \ No newline at end of file From bb276bff885201bacc751bda6d3436a60544feb1 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:58:34 +0200 Subject: [PATCH 7/8] Revert "Remove medium features" This reverts commit e508b6837955a8c8d936d189baa50e6befdfabfe. --- .github/workflows/ubuntu.yml | 7 ++++++- .github/workflows/windows-vcpkg.yml | 7 ++++++- src/tests/cucumber/features/medium_tests.feature | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/tests/cucumber/features/medium_tests.feature diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 49ef677834..19051de191 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -235,7 +235,7 @@ jobs: batch-name: short-tests os: ${{ env.os }} - - name: Run cucumber tests + - name: Run cucumber on short-tests uses: ./.github/workflows/cucumber-tests with: feature: "features/short_tests.feature" @@ -282,6 +282,11 @@ jobs: batch-name: medium-tests os: ${{ env.os }} + - name: Run cucumber on medium-tests + uses: ./.github/workflows/cucumber-tests + with: + feature: "features/medium_tests.feature" + - name: Run long-tests-1 if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} uses: ./.github/workflows/run-tests diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 5235d95e09..193712a423 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -245,7 +245,7 @@ jobs: batch-name: short-tests os: ${{ env.os }} - - name: Run cucumber tests + - name: Run cucumber on short-tests uses: ./.github/workflows/cucumber-tests with: feature: "features/short_tests.feature" @@ -284,6 +284,11 @@ jobs: batch-name: medium-tests os: ${{ env.os }} + - name: Run cucumber on medium-tests + uses: ./.github/workflows/cucumber-tests + with: + feature: "features/medium_tests.feature" + - name: Run long-tests-1 if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} uses: ./.github/workflows/run-tests diff --git a/src/tests/cucumber/features/medium_tests.feature b/src/tests/cucumber/features/medium_tests.feature new file mode 100644 index 0000000000..26a8e74ef3 --- /dev/null +++ b/src/tests/cucumber/features/medium_tests.feature @@ -0,0 +1,15 @@ +Feature: medium tests + + @fast @medium @incomplete + Scenario: 035 Mixed Expansion - Smart grid model 2 + Given the study path is "simulator-cucumber-tests/035 Mixed Expansion - Smart grid model 2" + When I run antares simulator + Then the simulation takes less than 15 seconds + And the simulation succeeds + And the expected value of the annual system cost is 3.725e+10 + And the minimum annual system cost is 3.642e+10 + And the maximum annual system cost is 4.011e+10 + And the annual system cost is + | EXP | STD | MIN | MAX | + | 3.725e+10 | 1.063e+09 | 3.642e+10 | 4.011e+10 | + # TODO : add steps when we understand what this test is supposed to test \ No newline at end of file From 80789c5ab1b53462b5d738b5b56b39eabdb69f9c Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Fri, 27 Sep 2024 16:59:55 +0200 Subject: [PATCH 8/8] Fix path --- src/tests/cucumber/features/medium_tests.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/cucumber/features/medium_tests.feature b/src/tests/cucumber/features/medium_tests.feature index 26a8e74ef3..4378154509 100644 --- a/src/tests/cucumber/features/medium_tests.feature +++ b/src/tests/cucumber/features/medium_tests.feature @@ -2,7 +2,7 @@ Feature: medium tests @fast @medium @incomplete Scenario: 035 Mixed Expansion - Smart grid model 2 - Given the study path is "simulator-cucumber-tests/035 Mixed Expansion - Smart grid model 2" + Given the study path is "035 Mixed Expansion - Smart grid model 2" When I run antares simulator Then the simulation takes less than 15 seconds And the simulation succeeds