Luc Feys wants to merge 2 commits from /u/lufecir/dbunit/ to master, 2021-10-31
Hello,
As mentioned in ticket 425, I would like to have the logic that executes the verification of database tables against expected datasets (that currently resides in DefaultPrepAndExpectedTestCase) to be extracted into a separate Operation, so it can be used in any test flow, with being forced to use the PrepAndExpectTestCase flow.
So I did a first implementation of this:
Results
Some remarks
But before I continue to work on this, I would first like to hear what think of the idea and if it would be considere to be taken into the main development track.
| Commit | Date | |
|---|---|---|
|
[408e80]
(verification_operation)
by
F225: refactor DefaultPrepAndExpectedTestCase.configureTest |
2019-03-25 13:38:55 | Tree |
| 2019-03-15 10:30:43 | Tree |
Deprecate the methods you suggest; we can discuss further when noted.
Changing configureTest breaks backwards compatibility; you can overload it tho.
I noticed your branch does not have the latest DefaultPrepAndExpectedTestCase changes.
Please rebase and squash adjustments. However, please keep separate focused commits for each class extraction (only 1 identified so far) and other improvements (e.g. deprecations, configureTest change).
Thanks for the feedback:
Thanks.
Yes, thanks for keeping refactorings separate - one commit for extracting verify operation (perhaps "F225: Extract VerifyOperation") and another for refactoring configureTest (perhaps "F225: refactor DefaultPrepAndExpectedTestCase.configureTest"). And any further refactorings...
I'm curious as to your design/plans/thinking with having VerifyOperation extend AbstractOperation. (it obviously lines up with setup/teardown operations, wondering if you have further ideas)
At some point, we'll need doc page changes as well. What are your thoughts for those?
Will have a look at your remarks with regard to commit-1 and commit-2. Not sure about the 'all lines difference' for 'DefaultPrepAndExpectedTestCase' it shows indeed CRLF as line endings, but this is the same for all files I checkout. Git converts the line endings again when I commit.
About the design for VerifyOperation: when I started on this, I did not really know what functionalities would be needed from the base Operation classes, so I started from AbstractOperation, but it turned out I did not really need any of the functionalities in that base class.
This operation does not make any changes to the database, so does not really line up with the Insert/Update/Delete operations that extend AbstractOperation. So I guess it could just as well extend DatabaseOperation, in order for it to have the same 'execute' API as the other Operations.
I also thought about somehow making a difference between 'readonly' (Verify) and 'modifying' (Insert/Update/Delete) database operations, but I see no distinctive differences between them with regard to exposed API, so not sure that would add any value.
Not sure what you mean with 'my thoughts on the doc page changes'. Should the docs not just describe the provided functionality?
Will be picking this up again next week. Have nice weekend.
Last edit: Luc Feys 2019-03-22
Thanks for checking... I no longer see the problem so that's good. I don't know what happened...
That's my thinking, but wasn't sure of your plans. Probably better to not link them; do it in the future if a reason found.
See what the final need is and adjust accordingly.
Agreed. Start without it and see if something realizes.
Yes... I was thinking of where and what. e.g. extracting Verifier can mean it is a core component, usable by others, therefore perhaps on the components page (?). But depending, we may want to create a new page as well. I try to plan docs along with the feature/fix so it isn't an afterthought or missed. Sometimes, working on the docs along with the change enables discovering other facets to include or avoid in the code.
Further, (regarding my refactoring DefaultPrepAndExpectedTestCase comment on the feature ticket), my initial notes are to extract some or all of these:
Creating these interfaces enables a default implementation and then easy substitution of parts by anyone as needed; Strategy pattern for them.
Verifier may be the only one we can make and name generically, using it outside of just PrepAndExpectedTestCase. I haven't analyzed, perhaps Cleanup could as well.
So deciding packages, class names, and doc locations (augmenting and new) help define intentions/what we should do, and therefore the feature and the path to take.
I have implemented all proposed modifications to the two commits, with the following remarks:
Some additional thoughts/questions:
About your questions:
I see 'VerifyTableDefinition' and 'ValueComparer' are already core components, which are closely related to the VerifyOperation, but I somehow feel like VerifyOperation belongs on a higher level. The classes/interfaces in core components are quite low level building blocks, which VerifyOperation is not.
That sounds like a good idea, although I personally did not use PrepAndExpectedTestCase yet, as my main focus so far has been on the verification logic only. So - besides the extraction of the Verification logic - I have no suggestions yet for potential improvements or limitations of the current approach that I ran into.
packages:
docs
Last edit: Luc Feys 2019-03-25
Well I certainly let you down on this one. I apologize...
If you are still interested in this, please let me know as my time is better now. Understood if you are not; I will move forward with PrepAndExpectedTestCase improvements and will include your ideas and work on this one.