New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for orderBy in multiple tables #149
Comments
We can fix that, thanks for the feedback
All tables, so you must use a common column to all tables involved in expected dataset, otherwise how would order by work for different columns? which one takes priority on the ordering when more than one column is present on a table? do you have a better solution for that?
I think that is the default when |
I agree that would be better if we could specify table and column in order by I'm just not sure if there is a simple way to do that without polluting/making the API harder to use |
Maybe it makes sense to apply the specified "orderBy" column-list top down in the expected dataset, depending upon occurrence/existence:
Example:
orderBy={"id", "uuid"}
in expected-fo.yml:
table1:- id: 1
name: "Foo1"
table2:- uuid: "fdfsd-fdfsd-fdfds"
name: "Foo2"
table3:- id: 3 uuid: "abc-def-ghj" name: "Foo3"
shouldn't throw any exception but:- sort table1 by "id"- sort table2 by "uuid"- sort table3 by "id", then "uuid"
Am Freitag, 23. August 2019, 13:50:50 MESZ hat Rafael M. Pestano <notifications@github.com> Folgendes geschrieben:
I agree that would be better if we could specify table and column in order by I'm just not sure if there is a simple way to do that without polluting/making the API harder to use
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi @jenskreidler, thank you again for the helpful insight! I think it is definitely doable and also backward compatible which is great. Anyone else agree/disagree? |
No that's not the default. #76 highlights the original problem. Here's the docs on spring-test-dbunit NON_STRICT_UNORDERED, and the original PR that spawned it for more insight into the problem and the solution it provides. I would like to object to the renaming of this issue as well, because I'd much rather have unordered comparisons than to support multiple orderBy. |
This is why the existing implementation is critically flawed. I'd much rather see a |
Hi @cphillipszg,
so please, state what you need because "major issue with orderBy" also doesn't say much.
Well I think "critically flawed" is a bit harsh, it works for most case, actually it would be nice to have a failing test where current |
Fixed according to @jenskreidler comment. |
orderBy as written compares every
orderBy
against every table in the expected data set. If theorderBy
column doesn't exist in one of the provided tables it will NPE.For example:
The implementation of
orderBy
is critically flawed. Which tables shouldorderBy
apply to? Should users be forced to supply one file per table and each array index mapped to anorderBy
index? In that case, how would you handle ordering multiple columns for multiple tables?DbUnit had
DatabaseAssertionMode.NON_STRICT_UNORDERED
which worked exactly as expected: it compares records without respect to ordering. Can't we please just have that? 😭The text was updated successfully, but these errors were encountered: