I noticed the approach stopped working in Android Studio 0.5.5 The directory are test when the project start to sync, but somehow reverted later,
On Tuesday, March 18, 2014 9:31:46 AM UTC-7, Nate Bourgoin wrote: > > Mozart, this looks super similar to > https://github.com/sababado/gradle-android-add-dir > > In both cases, it works for just a moment the reverts its status. Is this > working on the Android Studio 0.5 / android gradle plugin 0.9? > > On Wednesday, January 8, 2014 8:59:25 PM UTC-5, Mozart Petter wrote: >> >> Hey Renzo, >> I'm using it, and on my setup I just set a dependency on the build task >> for it: >> >> task addTest(dependsOn: 'build') { >> ... >> } >> >> It works fine. :) >> >> On Wednesday, January 8, 2014 10:57:21 PM UTC+9, Renzo Fernando >> Crisóstomo Medina wrote: >>> >>> Your task is amazing! Thanks! Are you running it manually or setting it >>> as a dependency for another task called by the IDE? >>> >>> On Friday, November 22, 2013 1:37:15 PM UTC-5, Bernd Bergler wrote: >>>> >>>> I created a custom gradle task which inserts the test directly into the >>>> iml file. >>>> its quite a hack but it works ;) >>>> >>>> task addTest() { >>>> >>>> def src = ['src/test'] >>>> def file = file("Project.iml") >>>> >>>> doLast{ >>>> def parsedXml = (new XmlParser()).parse(file) >>>> def node = parsedXml.component[1].content[0] >>>> src.each{ >>>> def path = 'file://$MODULE_DIR$/'+"${it}" >>>> def set = node.find { it.@url == path} >>>> if( set == null) { >>>> new Node(node, 'sourceFolder', [ 'url' >>>> :'file://$MODULE_DIR$/'+"${it}", 'isTestSource':"true"]) >>>> def writer = new StringWriter() >>>> new XmlNodePrinter(new PrintWriter(writer)).print(parsedXml) >>>> file.text = writer.toString() >>>> } >>>> } >>>> } >>>> } >>>> >>>> >>>> On Saturday, November 9, 2013 2:02:30 PM UTC+1, David Laurell wrote: >>>>> >>>>> Hi, >>>>> >>>>> Up until now we could mark different directories as test source root >>>>> so we would get auto complete stuff in junit test classes. Now this >>>>> option >>>>> seems to have disappeared. >>>>> >>>>> I'm using the gradle-android-test-plugin to write unit tests with >>>>> Robolectric. The tests are put in src/main/test and we could do the >>>>> following hack to get Android Studio to resolve the dependencies in the >>>>> test classes: >>>>> >>>>> testCompile 'junit:junit:4.10' >>>>> testCompile 'org.robolectric:robolectric:2.1.+' >>>>> testCompile 'com.squareup:fest-android:1.0.+' >>>>> >>>>> //Used for Android Studio so it finds the references >>>>> instrumentTestCompile 'junit:junit:4.10' >>>>> instrumentTestCompile 'org.robolectric:robolectric:2.1.+' >>>>> instrumentTestCompile 'com.squareup:fest-android:1.0.+' >>>>> >>>>> I would rather that Android Studio could resolve the testCompile >>>>> dependencies and mark junit directories as test source roots too. Then we >>>>> can have both instrumentTests on a device and running local junit tests >>>>> out >>>>> of the box! >>>>> >>>>> Anyone have any solutions for this? >>>>> >>>> -- 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.
