Improved test (type) in RpslObjectTest by converting into parameterized unit test#958
Improved test (type) in RpslObjectTest by converting into parameterized unit test#958Monilnarang wants to merge 1 commit intoapache:mainfrom
Conversation
|
|
Thanks a lot for taking the time to open this PR. I usually wait to use parameterized tests until there are a lot of test cases and the repeated code starts to get messy. When there are only a few checks, I think regular test lines are easier to read and understand. Parameterized tests can make things harder to follow if they don't really help with keeping the code cleaner or easier to update. In this case, we're just checking the content of a single record at a few positions, so parametrized tests may be an overkill. Here is another example of where we used a provider for parametried test in baremaps: If you are interested in contributing to apache baremaps, please do not hesitate to share your usecase on the mailing list or to start with one of the "good first issues". We will be happy to help. |
e070c9e to
2c93e18
Compare



Summary:
typeand changed name totestTypeElaboration:
objects.get(x).type()) is repeated multiple times with different inputs, making it redundant and the test harder to maintain and extend.To accomplish this, I retrofitted this tests into a parameterized unit test. This reduces duplication, allows easy extension by simply adding new value sets, and makes debugging easier as it clearly indicates which test failed instead of requiring a search through individual assertions.
Also, when run each value set is shown its separate pass/fail status.