Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression tests output doesn't show which testcase is being run and for which scenario (1D/2D) #226

Open
niketagrawal opened this issue Aug 20, 2024 · 1 comment
Assignees

Comments

@niketagrawal
Copy link
Collaborator

niketagrawal commented Aug 20, 2024

Current behavior

The regression tests implemented in aeolis/tests/regression_tests/ checks whether whether running the simulation for the following cases produces the same netCDF file consistently across other code changes in the repository

  • 1D/case1_small_waves
  • 1D/case2_larger_waves
  • 1D/case3_erosion_avalanching
  • 2D/Barchan_dune

The testcases include

  • check whether netCDF file is created as part of the simulation
  • check whether aeolis.log file created as part of the simulation
  • check whether the array shape, dimension, and array values in the netCDF file produced are the same as the ones stored in a reference output for the same model configuration file.

Currently, the pytest output doesn't show the pass/fail status of testcase for each of the cases making it difficult to understand the test output and debug it in case of a failure.

Desired behavior

Display pass/fail status of each testcase per scenario in the pytest output.

Fix

  • The desired behavior can be achieved by breaking the large test into individual testcases and using parametrization.
  • A proof of concept is implemented in the branch fix-226-regression-tests
  • Check out the above branch and execute pytest -v on the command line.
  • The pytest output that this implementation produces is the following:

aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_netCDF_creation[1D_case1_small_waves] PASSED                                         [  5%]
aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_log_file_creation[1D_case1_small_waves] PASSED                                       [ 10%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_shape[1D_case1_small_waves] PASSED                                                    [ 15%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_dimension[1D_case1_small_waves] PASSED                                                [ 20%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case1_small_waves] FAILED                                                   [ 25%]
aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_netCDF_creation[1D_case2_larger_waves] PASSED                                        [ 30%]
aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_log_file_creation[1D_case2_larger_waves] PASSED                                      [ 35%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_shape[1D_case2_larger_waves] PASSED                                                   [ 40%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_dimension[1D_case2_larger_waves] PASSED                                               [ 45%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case2_larger_waves] FAILED                                                  [ 50%]
aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_netCDF_creation[1D_case3_erosion_avalanching] ERROR                                  [ 55%]
aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_log_file_creation[1D_case3_erosion_avalanching] ERROR                                [ 60%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_shape[1D_case3_erosion_avalanching] ERROR                                             [ 65%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_dimension[1D_case3_erosion_avalanching] ERROR                                         [ 70%]
aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case3_erosion_avalanching] ERROR


========================================================================== short test summary info ==========================================================================
FAILED aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case1_small_waves] - AssertionError: Array values of the parameter 'zs' are expected to remain consistent across simulations for the same model parameter file for 1D case1_small_waves
FAILED aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case2_larger_waves] - AssertionError: Array values of the parameter 'zs' are expected to remain consistent across simulations for the same model parameter file for 1D case2_larger_waves
FAILED aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[2D_Barchan_dune] - AssertionError: Array values of the parameter 'time' are expected to remain consistent across simulations for the same model parameter file for 2D Barchan_dune
ERROR aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_netCDF_creation[1D_case3_erosion_avalanching] - KeyError: 'Cs'
ERROR aeolis/tests/regression_tests/test_simulation.py::TestOutputFileGeneration::test_log_file_creation[1D_case3_erosion_avalanching] - KeyError: 'Cs'
ERROR aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_shape[1D_case3_erosion_avalanching] - KeyError: 'Cs'
ERROR aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_dimension[1D_case3_erosion_avalanching] - KeyError: 'Cs'
ERROR aeolis/tests/regression_tests/test_simulation.py::TestnetCDFContent::test_array_values[1D_case3_erosion_avalanching] - KeyError: 'Cs'
===================================================== 3 failed, 34 passed, 5004 warnings, 5 errors in 125.60s (0:02:05) =====================================================
@Sierd
Copy link
Collaborator

Sierd commented Sep 28, 2024

@niketagrawal, this works well. I committed some changes to the branch to make the tests pass (mainly updating the expected outputs. I don't think we should test for case 3. The erosion module seems a bit buggy still. @ncohn maybe you can comment, is the erosion module robust enough for running generic tests?

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

No branches or pull requests

2 participants