Repository navigation
Add example test, update example READMEs - #91130
Conversation
HansMuller
left a comment
There was a problem hiding this comment.
LGTM although I'm concerned about creating an implicit test template for examples that relies on golden image testing.
There was a problem hiding this comment.
Not sure what "with composition and overrides" refers to here. Can we test layout and (input) behavior?
There was a problem hiding this comment.
Just that you can subclass the examples to override things, or wrap them with something to help test them.
Can we test layout and (input) behavior?
Yes, you can do any kind of testing we can normally do, you just need know that you probably shouldn't modify the example to make it more testable. E.g. I wouldn't add a @visibleForTesting method to an example, or extra parameters to override things (like adding a Platform argument to override the current platform), since it complicates the example without a clear benefit to the reader.
There was a problem hiding this comment.
Creating the first test as a golden image test is likely to ensure that all samples end up with such a test and the disadvantages of golden image testing are well known. Maybe we want to make the example test archetype check specific aspects of the LayoutBuilder example?
There was a problem hiding this comment.
Yeah, good point, I just wanted to show that we can do those. I modified this to test the layout behavior of the widgets.
933ae41 to
2f0a752
Compare
Description
This updates the README.md in examples/api, and adds a "token" test in the test directory, establishing a pattern for writing tests.
I also deleted the README.md in the snippets directory, since it is redundant with the examples one now.
Tests