How would I produce JUnit test report for groovy tests, suitable for consumption by Jenkins/Hudson?

后端 未结 4 1235
误落风尘
误落风尘 2021-02-06 05:05

I\'ve written several XMLUnit tests (that fit in to the JUnit framework) in groovy and can execute them easily on the command line as per the groovy doco but I don\'t quite unde

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 05:32

    I find the fastest way to bootstrap this stuff is with Gradle:

    # build.gradle
    apply plugin: 'groovy'
    
    task initProjectStructure () << {
        project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir ->
            dir.mkdirs()
        }
    }
    

    Then run gradle initProjectStructure and move your source into src/main/groovy and tests to test/main/groovy.

    It seems like a lot (really it's <5 minutes of work), but you get lots of stuff for free. Now you can run gradle test and it'll run your tests and produce JUnit XML you can use in build/test-reports in your project directory.

提交回复
热议问题