[FEATURE REQUEST] Bring JUnit Jupiter Assumptions to RequestBoundaryMethodsTest
to Avoid Test Case Quiet Quit
#2359
Labels
Enhancement
An enhancement to the driver. Lower priority than bugs.
Projects
Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it
When I am go through the test class
RequestBoundaryMethodsTest
, I noticed that many of the test cases in this test class is using the if condition to determine if a test should proceed based on certain preconditions.Here is an example from
testWarnings
:This approach can lead to tests passing under conditions where they're not actually validating the intended functionality.
As I checked, all these test cases shared this design pattern in the
RequestBoundaryMethodsTest
:testModifiableConnectionProperties
testWarnings
testOpenTransactions
testStatements
testThreads
Describe the preferred solution
I would like to propose we adopt the JUnit Jupiter's assumption API to handle such precondition checks. The assumption API allows tests to be skipped when certain conditions are not met, making it clear that the test result is not applicable under those conditions. So here we can use the assumption api to replace the
if
condition without quiet quit. (If the assumption is false the TestAbortedException will be recorded).For instance, the
testWarnings
case can be refactored as follows:This change will make test results more accurately reflect the behavior being tested, as irrelevant tests are skipped rather than falsely passing.
Implementation
The change will be straightforward and involves replacing if statements with Assume.assumeTrue (or other relevant Assume methods) where appropriate for all these test cases
Describe alternatives you've considered
Additional context
Reference Documentations/Specifications
Junit5 Assumption Doc
Reference Implementation
If you feel this suggestion is helpful, I am more than happy to submit a PR to implement the refactoring.
The text was updated successfully, but these errors were encountered: