MFC icon indicating copy to clipboard operation
MFC copied to clipboard

Improve test code coverage

Open sbryngelson opened this issue 2 years ago • 1 comments

Thanks to @okBrian we now have test code coverage (the badge is in the MFC readme). However, we are only at 50% or so. See the lines of code not covered by the test suite here: https://app.codecov.io/github/MFlowCode/MFC/tree/master/src

One fun idea that, in part, addresses this, is using a fuzzer across the inputs to be sure the user does use initial conditions (case.py variables) that are nonsense or incompatible.

sbryngelson avatar Jun 07 '24 15:06 sbryngelson

We have had several great PRs that improve the code and pass the tests, without hurting performance. We even have #881 from @Malmahrouqi3 to benchmark on Frontier as well. This is great.

I've noticed in my own experimentation, plus reviewing these PRs, that my biggest concern is that we just don't have enough tests. A lot of code is untouched by the test suite. Codecov is not the perfect tool here, because it has a little trouble parsing fypp -> f90, so it marks some lines as not covered that are actually covered. Still, there are things like the output files, the probes, data transfer between simulation -> post_process, and so on.

The code is not so hard to refactor, but there are some areas that are concerning. I suspect that #914 is a side effect of me or someone else's PR (I could be wrong). This case simply wasn't tested in CI appropriately.

There is a tango required to get decent tests without overfitting to specific computers or spending 10 hours in CI running (plus another 10 hours queuing in some cases). But I would rather have good tests so we can more confidently refactor and add features than be cavalier about merging quite important changes into the code.

An example is #907 from @XZTian64 or #855 (and similar) from @Malmahrouqi3 and #901 from me. I'm not fully confident that nothing will go wrong in merging these, despite the tests. The ones that involve writing probes or post_process are most concerning at the moment, I think.

sbryngelson avatar Jul 02 '25 14:07 sbryngelson

there's probably a sharper way to do this now... will leave it alone for the moment and restart an issue if i have an idea

sbryngelson avatar Mar 17 '26 22:03 sbryngelson