I do something like

dependencies {
    testCompile ':testng:5.8' // or similar
}

createTask('test', dependsOn: 'testCompile', overwrite: true) {
    ant {
        def taskdefPath =
dependencies.testCompile.resolve().join(File.pathSeparator)
        def taskPath = taskdefPath + File.pathSeparator +
testClassesDir.absolutePath

        taskdef(name: 'testng', classname: 'org.testng.TestNGAntTask',
classpath: taskdefPath)

        testng(classpath: taskPath, haltonfailure: true, suitename: '...',
testname: '...',
                listener: 'org.testng.reporters.JUnitXMLReporter',
outputdir: testResultsDir) {
            classfileset(dir: testClassesDir)
        }
    }
}

  Levi

On Thu, Feb 26, 2009 at 3:00 PM, GaryMcWilliams
<[email protected]>wrote:

>
> Idiot!
>
> ok, remembering that doing a google search rather than just a forum search
> returns more results!
>
> So, Tom Eyckmans is working on all this, so it's not in the current
> release.
> Is there a short-term fix (hint: noob-proof details, if possible!) that I
> can use to get my testNG stuff running?
>
>
>
> GaryMcWilliams wrote:
> >
> > complete noob here trying to use gradle against a small project. Can get
> > it all working except the testng tests. I searched the forum here, got
> > some hits against testng, but nothing that give a poor noob any real
> help!
> > Anyone offer any hints on getting my testNG tests to run?
> >
> > - I note a reference to a plugin contributed for 0.5, but using
> > "usePlugin('testng')" does not get me anywhere.
> > - I also tried a useTestNG() that I came across somewhere (cannot find
> > reference now) but that fails also.
> >
> >
> > build.gradle:
> > usePlugin('java')
> >
> > type = 'jar'
> >
> > version = '1.0'
> > sourceCompatibility = 1.5
> > targetCompatibility = 1.5
> >
> > dependencies {
> >       addMavenRepo()
> >       addFlatDirResolver('lib', new File(rootDir, 'lib'))
> >       compile ':log4j:1.2.12'
> >       testCompile 'org.testng:testng:5.8:jdk15'
> > }
> >
> > running gradle test gives:
> > $ gradle test
> > :init
> > :resources
> > :compile
> > :testResources
> > :testCompile
> > :test
> > [ant:junit] Test play.CounterTest FAILED
> > [ant:junit] Test play.CounterUtilTest FAILED
> > [ant:junitreport] the file
> > d:\dev\jira-stuff\JiraPlay\build\test-results\TESTS-T
> > estSuites.xml is not a valid testsuite XML document
> >
> > Build failed with an exception.
> > Run with -s or -d option to get more details. Run with -f option to get
> > the full
> >  (very verbose) stacktrace.
> >
> > Build file 'd:\dev\jira-stuff\JiraPlay\build.gradle'
> >
> > Execution failed for task :test.
> > Cause: There were failing tests. See the report at
> > d:\dev\jira-stuff\JiraPlay\bu
> > ild\reports\tests.
> >
> > BUILD FAILED
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/testng-tp22224495p22224691.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to