Yes, I'd like to see libraries published that offer some nice advanced mocks or implementation of the Android classes for testing purpose. I think we'll definitively want to figure out how to allow developing these.
The Studio part is a big problem indeed. We're investigating the amount of work it's going to require. The first step for 1.1 was to have gradle support in a normal project and get feedback, and we'll keep improving from there. On Tue, Feb 3, 2015 at 10:38 PM, Jake Wharton <[email protected]> wrote: > I'm open to other solutions and suggestions. As far as I can tell (as a > nearly-completely uninformed poker-arounder in the code), IDEA's model > doesn't allow the ability to vary the platform SDK between the main and > test source sets which would otherwise allow this to work the way you would > hope. I believe Gradle should have no problem, however (although it is > currently not doing so for test compilation as of rc1). > > On Tue Feb 03 2015 at 10:32:04 PM Jake Wharton <[email protected]> > wrote: > >> Since test classes are compiled against the platform jar, we are unable >> to subclass some of the platform types which have final methods, are final >> classes, or have non-visible constructors. The jar that is on the >> classpath at test execution time does not have these restrictions. >> >> Because of this fact, mocking is the only approach that currently works >> for common classes like Uri and Parcel. While doable, it's extremely >> annoying due to the large surface area of these API and others like it. >> >> A possibility to alleviate some of this pain would be to allow library >> projects to compile against the test version of the platform jar. With >> this, fakes could be written and compiled as libraries without the normal >> restrictions (albeit with fair warning that this represents a deviation >> from the normal understood stability of platform public APIs). These >> test-only libraries could then be added as testCompile dependencies which >> would not be subject to the compilation problems of the regular platform >> jar but correctly apply at execution time to the test platform jar. >> >> Thoughts? >> > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
