Hi,
some remarks to your setup:
1. IMHO the best location for the xslt transformation of testng output
would be directly after the test execution. you can achieve this by
adding a doLast action to your test task:
------------
test << {
ant.xslt(in:
'/Users/douglasbullard/Documents/JavaStuff/Google_Code/IvyTools/branches/gradle/build/reports/tests/testng-results.xml',
style:
'/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/src/main/resources/testng-results.xsl',
out:
'/Users/douglasbullard/Documents/JavaStuff/Google_Code/IvyTools/branches/gradle/build/reports/tests/index.html',
classpath:
'/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/lib/saxon-8.7.jar'
)
}
------------
2. To replace your hard coded paths can be replaced by using the
convention properties of the java plugin (documented at
http://gradle.org/0.9.1/docs/userguide/java_plugin.html#N11AC1):
------------
test << {
ant.xslt(in: "${testReportDir.absolutePath}/testng-results.xml",
style:
'/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/src/main/resources/testng-results.xsl',
out: "${testReportDir.absolutePath}/index.html",
classpath:
'/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/lib/saxon-8.7.jar'
)
}
------------
3. to be a bit more flexible on resolving the dependency to the xslt
classpath you can add a custom configuration to your build file and
resolve the classpath dynamically (e.g. from mavenCentral):
------------
repositories{
mavenCentral()
}
configurations{
xslt
}
dependencies{
xslt "net.sf.saxon:saxon:8.7"
}
test << {
ant.xslt(in: "${testReportDir.absolutePath}/testng-results.xml",
style:
'/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/src/main/resources/testng-results.xsl',
out: "${testReportDir.absolutePath}/index.html",
classpath: configurations.xslt.asPath
)
}
4. If its necessary you can resolve the xsl file the same dynamic way we
resolve the classpath above
regards,
René
Am 11.01.11 20:05, schrieb Bullard, Douglas:
> I’m a Gradle newbie, trying to convert my TestNG output into something
> prettier. In Ant I use a nice xsl transform that does the job nicely. I’m
> trying to convert this to Gradle, but get a really nasty stylesheet exception
> when I try to pass in needed parameters.
>
> Here’s how it looks in Ant:
>
> <xslt in="@{testNgOutputDir}/testng-results.xml”
> style="${lib.test.formatTestNg}/testng-results.xsl”
> out="@{outputDir}/index.html”>
> <param name="testNgXslt.outputDir" expression="@{outputDir}/“/>
> <param name="testNgXslt.sortTestCaseLinks" expression="true”/>
> <param name="testNgXslt.testDetailsFilter"
> expression="FAIL,SKIP,PASS”/>
> <classpath refid="classpath.testng.format”/>
> </xslt>
>
>
> I’m trying to get something like:
> task formatTestResults << {
> ant.xslt(in:
> '/Users/douglasbullard/Documents/JavaStuff/Google_Code/IvyTools/branches/gradle/build/reports/tests/testng-results.xml',
> style:
> '/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/src/main/resources/testng-results.xsl',
> out:
> '/Users/douglasbullard/Documents/JavaStuff/Google_Code/IvyTools/branches/gradle/build/reports/tests/index.html',
> classpath:
> '/Users/douglasbullard/Documents/JavaStuff/testng-xslt-1.1.1/lib/saxon-8.7.jar'
>
> )
> }
>
> As I mentioned, this doesn’t seem to be accepting any of the things I’ve
> tried for passing the pararms (outputDir, sortTestCaseLinks, and
> testDetailsFilter) - what’s the right way to pass this from Gradle to Ant?
> Or, is there another way to do this in pure Gradle? Nested syntax in Ant
> always kills me...
>
>
> Any help is greatly appreciated.
>
>
> Douglas Bullard
> Sr. Java App. Engineer
> Nike, Inc.
> 503.671-6261
>
> That which makes us great, also destroys us
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
--
------------------------------------
Rene Groeschke
[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email