On 29/04/2011, at 5:40 AM, phil swenson wrote: > I was told this is what the > org.gradle.integtests.fixtures.TestResources class if for. Can't find > any doc on it tho.... ideas?
This is an internal class used by Gradle's integration tests. You should not be using it in your own tests. The only test utility class that Gradle provides at the moment is ProjectBuilder. > > > > On Wed, Apr 27, 2011 at 6:12 PM, Adam Murdoch > <[email protected]> wrote: >> >> On 28/04/2011, at 10:00 AM, phil swenson wrote: >> >> I am writing a Gradle Plugin Test I'm writing (first plugin ever for me). >> >> one of the methods looks like (notice the hard-coded path): >> >> @Test >> public void testLoadExportTemplate() { >> //TODO make this relational to the project >> LocalizationPluginConvention pluginConvention = >> project.convention.plugins["config"] >> String command = >> plugin.buildBatchCommand("/Users/phil/dev/sag/bas_core/trunk/modules/plugins-localization/src/main/groovy/com/sag/bas/plugins/export.template", >> pluginConvention) >> >> String expectedBatchCommand = <A bunch of XML> >> String expectedXmlAsText = new >> XmlSlurper().parseText(expectedBatchCommand).text() >> String actualXmlAsText = new XmlSlurper().parseText(command).text() >> assert expectedXmlAsText == actualXmlAsText : "batch commands >> don't match" >> println "wows!" >> } >> >> >> My question is how do I get rid of the hard-coded path >> "/Users/phil/dev/sag/bas_core/trunk/modules/plugins-localization/src/main/groovy/com/sag/bas/plugins/export.template"? >> It is stored in my gradle src tree.... Note I want it to work from >> gradle AND from my IDE. >> >> Gradle runs tests with the working directory set to the project directory. >> The IDEs do a similar thing. In both instances the working directory is >> configurable. So, you could use a relative path in your test. >> Or, another option would be to add the template file as a resource and load >> it using ClassLoader.getResource(). >> >> -- >> Adam Murdoch >> Gradle Co-founder >> http://www.gradle.org >> VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting >> http://www.gradleware.com >> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > -- Adam Murdoch Gradle Co-founder http://www.gradle.org VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting http://www.gradleware.com
