-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Compare whole table for snapshot testing #866
Comments
The two examples have only 10 rows. They are not sub-setted if not in pre-processing, as intended. The only post-processing is sorting. Besides the examples, there are random subsettings happening at times, I agree, but they are principally used to avoid unreadable feedback and uselessly enormous PRs for minimal practical updates. Note that with the recent introduction of snapshots, we have already done a great enhancement as before the structure (e.g. indentation) was NOT tested at all. That is why using snapshot_value would be going back (see reference afterward). Nonetheless, I agree that we can do better in snapshot testing by selecting smartly what to test instead of random subsetting, but I do not think the overhead of setting local options would do us any good. I think it would also be good to test smart selections of tables instead of entire tables as it would also help to have context-aware testing (which is also faster and feedback is more readable). Still, I argue that this should be introduced incrementally, also through the introduction of regression tests when new features or bugs are introduced/fixed.
|
Some clarifications from my side
No. Both has 600 rows (1 2). We are doing just print of 10 rows (that's the default value) which means that more than 98% of rows is not checked. Add to this hidden columns (11 printed out of 51) then we came to the conclusion that almost whole table is not checked.
Exactly! We need to decide whether we want to test it all...
Yes I am aware that |
my apologies I did not notice it was the printout only! It makes sense a lot then, also checking 600 lines is a bit of an overkill for that function tests probably. I will think about it a bit more, for the moment smart or random sampling seems the best way to me. |
I have noticed that for some of the snapshot tests (example 1 2) we are comparing
tibble
object using default print method that results in only small subset of table being printed out - on default it is just 10 rows. I feel it's not necessarily correct as a discrepancy might occur in e.g. row 11 and this won't be caught. We need to set appropriate options in the testthat setup so as to compare all values. Alternatively we can useexpect_snapshot_value()
instead ofexpect_snapshot()
if that's respect all values.The text was updated successfully, but these errors were encountered: