-
Notifications
You must be signed in to change notification settings - Fork 90
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
Suppress successfully matched rows. #203
Conversation
@marcusrehm, thanks for the pull request. Here's some initial feedback:
|
} | ||
else { | ||
return new dbfit.fixture.CompareStoredQueries(environment,symbol1, symbol2, false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be simplified to
return new dbfit.fixture.CompareStoredQueries(environment,symbol1, symbol2, "showwrongrowsonly".equals(normalname));
I'd also like to at least have a testcase in the common FitNesse test suite that exercises this feature. |
Hi Jake, I did the rebase and update the website folder with documentation, but is 2014/1/9 Jake Benilov notifications@github.com
|
For large amounts of rows, find rows with wrong matches can be difficult, in these cases should be better hide successfully matched rows. To accomplish it you can use `show wrong rows only`. | ||
|
||
|compare stored queries|fromtable|fromdual|show wrong rows only| | ||
|name |n? | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a trailing |
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, apologies, what I meant was "could you please align this", thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
thanks, I've left some comments on the documentation.
sorry, what I meant was the core tests, that are included in the test suites for several database adapters. |
this.symbol1 = symbol1; | ||
this.symbol2 = symbol2; | ||
this.showWrongRowsOnly=showWrongRowsOnly; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white space around =
sign here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before reformatting and rebase, the file was this way.
Sorry, I didn't notice before.
I found a problem when trying to test that. I'm running tests like these: https://gist.github.com/javornikolov/8369736 I'm comparing same queries on same test page ( Seems the issue exists even without |
@javornikolov that's worrying. |
@marcusrehm I've had some thoughts about my earlier comment. I think having a magic string to enable successful row suppression might cause problems for users. For example, if the user mistypes the string:
(missing I think it'll be better to instead do the following (similar to how it's done for
that way, if the user mistypes, then they get an exception for fitnesse. What do you think? |
This is because of the static |
@benilovj , I thought about that too, but as it is a minor change I thought it best not to create a new method just to it, but as you said, it's better gets an exception than gets no warning and the behavior is not expected. So I'm gonna change code to create a new method. Any suggestions about the name? Could be "Compare Stored Queries And Hide Matched Rows"? |
|
And what if we let as it is now and rise a exception if the user types it wrong? Could be an option too. |
A new keyword is more consistent with how this has been done in other places (see execute statement) and the implementation is slightly nicer, so I'd prefer that option. |
I'll reformat whitespace in |
Here it is: suppress-succesfully-matched-rows-cleanup 384cd38
The existing |
This made me think of some more general scenarios when multiple options are a available. E.g. - if we compare queries we may want: But for a start I agree it's good to be consistent with the other similar fixtures. |
@benilovj , @javornikolov I did the rebase and created the CoreTests\CommonSuite\StoreAndCompareQueriesHideMatchingRows test too. |
|
||
!|Store Query|select * from TESTTBLA|q2| | ||
|
||
# Should appear no rows since both queries match all rows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, this raises an interesting point. In the "success" case, no rows are returned from Compare Stored Queries Hide Matching Rows
. In some cases, this will mean that there are no green cells in the test at all. Perhaps it's worth returning a green "summary" row if all rows are green. @javornikolov thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It's very strange when no rows are displayed and every thing is fine.
Can we make the test summary that appears at the top of resulting page
stays fixed with the breadcrumb?
2014/1/13 Jake Benilov notifications@github.com
In
FitNesseRoot/DbFit/AcceptanceTests/CoreTests/CommonSuite/StoreAndCompareQueriesHideMatchingRows/content.txt:+|N |TWON |
+|1 |2 |
+|2 |4 |
+|3 |6 |
+
+!|Insert|TESTTBLA|
+|N |TWON |
+|1 |2 |
+|2 |4 |
+|3 |6 |
+
+!|Store Query|select * from TESTTBL|q1|
+
+!|Store Query|select * from TESTTBLA|q2|
+
+# Should appear no rows since both queries match all rows.Now, this raises an interesting point. In the "success" case, no rows are
returned from Compare Stored Queries Hide Matching Rows. In some cases,
this will mean that there are no green cells in the test at all. Perhaps
it's worth returning a green "summary" row if all rows are green.
@javornikolov https://github.com/javornikolov thoughts?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/203/files#r8830783
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A summary would be useful. Even without this hiding of matching rows: recently I had a case with too wide table where exception is in right-most column, outside of my screen (needed scrolling to see it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just committed a summary for the CompareStoredQueriesAndHideMatchingRows
, now when no erros are found and no rows are displayed the result table will have a green line with the summary information containing totals of right, wrongs and exceptions, just like the one that appears at the top of the page.
Hmm. My idea here was to just replace with the cleanup branch instead of merging it and fighting with some conflicts. The hope was to get rid of the superfluous noise related to reformatting, etc. @marcusrehm, can you try again - this time pick from
And then you can continue working on top of that. |
OK. But it still relies on having specific number of rows in the rendered table which is a bit brittle. (Some day we may want to have an additional row for some reason). How about pushing that summary as first row on the table - seems more stable approach. (And if we want to re-use that for other kind of tests /not hiding rows/ -> first row is easier to see). @marcusrehm , what do you think? |
Good ideia @javornikolov! I can add the summary on top of the table and let also at bottom too. What do you think? |
Actually, in the context of current feature (hiding matching rows): I think a single summary header (or footer) would be enough. We can think of further enhancements of larger test tables when we target the other kinds of fixtures (in separate pull request(s)). |
@@ -155,6 +155,10 @@ public Fixture compareStoredQueries(String symbol1, String symbol2) { | |||
return new dbfit.fixture.CompareStoredQueries(environment, symbol1, symbol2); | |||
} | |||
|
|||
public Fixture compareStoredQueriesHideMatchingRows(String symbol1, String symbol2) { | |||
return new dbfit.fixture.CompareStoredQueriesHideMatchingRows(environment, symbol1, symbol2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some trailing space here.
.last() is safer for attaching summary as last row
I added 2 commits on https://github.com/dbfit/dbfit/tree/supress-matching-rows with whitespace reformatting and changed summary row attachment to a bit safer version. These 2 be merged and I think this PR is good enough to merge to master. @benilovj, @marcusrehm? |
@javornikolov do you propose that we merge this PR and then put your commits on top on master? Alternatively if you want to open a PR on https://github.com/dbfit/dbfit/tree/supress-matching-rows then we can merge that one and close this one. |
It's best to have that as single merge I think. I opened separate PR. (I can't find ability in GH for changing, adding source/target branch for a PR...). |
Hi guys, sorry for the late reply, but my little daughther (20 days) didn't Yes, I agree with you. I think it is good to merge to master. The other improvements we talk about can be in future PR.
|
@marcusrehm, if you're here you may merge (no rebase this time) from my branch: just do |
Done @javornikolov! Yours commits are now on my master branch. |
|
||
public void doTable(Parse table) { | ||
super.doTable(table); | ||
if (counts.wrong == 0 && counts.exceptions == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the thinking behind only showing this when everything's OK? Is there a particular reason why we don't want to show the summary when matching fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are hiding successfully matched rows, in the case of all rows were matched there is nothing to display, so displaying just the table header would lead the user to wrong interpretation of results as we discussed earlier, so a summary was added to advise that no errors were found.
When matching fails the behavior is exactly the same as ComparedStoredQueries
, so the summary is not needed.
Apart from the comment about the conditional summary logic, this looks OK. I'm not crazy about the fact that we're writing new code without unit tests. The FitNesse-level test only really shows that covers the happy path doesn't crash, and doesn't test any of the logic around mismatches, and doesn't pick up when the fixture doesn't display properly. The number of times that something regressed during the development of this change showed how easy it is to break things when there isn't a test harness to catch you. In the spirit of moving matters forward, I will merge this change when the last comment is resolved, however for the next part of work I kinda feel unit tests are going to be the pre-requisite to getting it into the library. |
I agree with you. In fact I found that there is no unit tests for fixtures while I was looking for a example to right it to |
It's a sisyphean task - the core is pretty hard to test at the moment. I think a better strategy is to:
|
@marcusrehm @javornikolov I would probably like to remove the conditional logic for showing the summary row - any objections? |
I agree on that. In case of mismatches - it would still help identifying the number of matched ones. |
One of the goals around the on-going PR #213 was to help for easier testing. An idea for a test with not only happy paths: CompareStoredQueriesMatcherTest.testMismatchWithRightWrongSurplusAndMissing. |
I agree with you. I will remove the condition to show summary and will commit it. |
…w summary information only when all rows matched. Now it will be shown every time test execute.
@benilovj @javornikolov . Done! Should I merge with upstream/master? |
Suppress successfully matched rows.
merged, thanks @marcusrehm and @javornikolov |
If the parameter "show wrong rows only" is passed as a fourth row in Compared Stored Queries, only the rows with unmatched values will be displayed.
This change does not affect existing tests, If the parameter is not passed, the fixture asumes it as false.
The usage is:
|Compare Stored Queries|query1|query2|show wrong rows only|