EPATADA icon indicating copy to clipboard operation
EPATADA copied to clipboard

Improve test for TADA_PairForCriteriaCalc

Open hillarymarler opened this issue 1 year ago • 4 comments

In test-CriteriaComparison.R, test occasionally fails when the random test df does not contain any of the characteristics (pH, temp, salinity, chloride) to be paired. Test needs to be updated to re-run TADA_RandomTestingData until a data set containing one or more of the paired characteristics is found.

hillarymarler avatar Sep 13 '24 15:09 hillarymarler

@hillarymarler @cristinamullin

Would it make sense for test_that() in test-CriteriaComparison.R to contain any paired parameter argument (with TADA_DataRetrieval() ) options rather than run TADA_RandomTestingData() for testdat1?

Or would we want to continually re-run the TADA_RandomTestingData for a particular reason when running a test function?

wokenny13 avatar Sep 16 '24 17:09 wokenny13

I included tryCatch() and try() base functions to handle rerunning TADA_RandomTestingData() for testdat1 if they do not contain any paired parameters needed to run TADA_PairForCriteriaCalc. These changes have been made within the WQXunitRef pull request.

The test_that will attempt to run up to 10 times in a for loop (can make this iteration larger, but if the dataset does not include the paired parameter after a certain amount of times, this may be an external/internal error that may be outside of the CriteriaCalc functions and will slow down the check process if the loop runs for too long).

Reviewing and testing of this logic should be done to ensure it works as intended.

wokenny13 avatar Sep 17 '24 20:09 wokenny13

That sounds like a great solution! Is PR #522 ready for review or are there still additional changes you would like to make first?

hillarymarler avatar Sep 18 '24 13:09 hillarymarler

That sounds like a great solution! Is PR #522 ready for review or are there still additional changes you would like to make first?

#522 is ready for review

wokenny13 avatar Sep 18 '24 13:09 wokenny13