You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a @visibleForTesting way to override commonly modified template values in apps created by tests (such as AGP version) #153399
These test won't accurately test the state of our current templates if the templates change. Perhaps we could refactor the flutter tool to expose something like _overwriteFromTemplate at a @visibleForTesting level for the purposes of integration tests? So that we aren't relying on the specific text content of the gradle build files, but rather just on the versions that we are intending to overwrite.
This functionality is not a feature to lower the maintenance effort it is a feature that will increase the fidelity of our testing that ensures a broad range of AGP/Gradle/Kotlin values continue to work and not regress.
cc @christopherfujino, does this seem like a reasonable suggestion to you/do you know if any other platforms modify versions/values that are in template outputs in integration tests?
I would add that I think there's value in both testing a brand new app built from the current templates (I think this is what the build tests do?) as well as testing a hard-coded app configuration, so that we know when we're breaking existing apps. Whether what we're currently doing is the optimal strategy is absolutely something we should examine more carefully.
I would add that I think there's value in both testing a brand new app built from the current templates (I think this is what the build tests do?) as well as testing a hard-coded app configuration, so that we know when we're breaking existing apps.
I agree, I think we should still have both. I guess what I am asking for is slightly different than either of those two: the ability to easily write tests that confirm that someone can, for a given template format, change Gradle/AGP/compileSdk/etc... versions around and still build successfully (which is essentially what the tests in
changed the title [-]Consider refactoring integration tests with hardcoded template files[/-][+]Add a `@visibleForTesting` way to override commonly modified template values in apps created by tests (such as AGP version)[/+]on Dec 17, 2024
Activity
gmackall commentedon Aug 14, 2024
cc @christopherfujino, does this seem like a reasonable suggestion to you/do you know if any other platforms modify versions/values that are in template outputs in integration tests?
christopherfujino commentedon Aug 14, 2024
Can you clarify more what this would do?
I would add that I think there's value in both testing a brand new app built from the current templates (I think this is what the build tests do?) as well as testing a hard-coded app configuration, so that we know when we're breaking existing apps. Whether what we're currently doing is the optimal strategy is absolutely something we should examine more carefully.
cc @andrewkolos
gmackall commentedon Aug 14, 2024
Sure, the thought is that for tests like the ones that use this method:
flutter/packages/flutter_tools/test/src/android_common.dart
Line 142 in 51c6402
instead of defining the gradle file content as a string that we then use to override existing files:
We would do something along the lines of
I agree, I think we should still have both. I guess what I am asking for is slightly different than either of those two: the ability to easily write tests that confirm that someone can, for a given template format, change Gradle/AGP/compileSdk/etc... versions around and still build successfully (which is essentially what the tests in
flutter/dev/devicelab/bin/tasks/android_java11_dependency_smoke_tests.dart
Line 36 in 51c6402
[-]Consider refactoring integration tests with hardcoded template files[/-][+]Add a `@visibleForTesting` way to override commonly modified template values in apps created by tests (such as AGP version)[/+]