Using custom groovy parser in WarningsNG plugin with jenkins TestHarness

213 views
Skip to first unread message

Josef

unread,
Sep 2, 2020, 2:54:19 AM9/2/20
to job-dsl-plugin

Hi,
I'm currently building a Jenkins infrastructure based on JobDSL and using a test infrastructure based on the Jenkins JobDsl Gradle example.

Now, I get a problem when trying to use a custom groovy parser in the recordIssue statement. While it works on the real Jenkins installation, the unit test fails because the Jenkins test environment does not recognise this custom parser.

DSL statement that fails:
publishers {
  recordIssues {
   tools {
   groovyScript {
    parserId("Codesonar")
    pattern("build/analysis.xml")
   }
  }
}

Unit test error message:
Expected no exception to be thrown, but got 'java.lang.IllegalArgumentException'
Expected no exception to be thrown, but got 'java.lang.IllegalArgumentException'
    at spock.lang.Specification.noExceptionThrown(Specification.java:118)
    at sswcty.jenkins.JobScriptsSpec.test script #file.name(JobScriptsSpec.groovy:47)
Caused by: java.lang.IllegalArgumentException: Could not instantiate {parserId=Codesonar, pattern=build/analysis.xml} for io.jenkins.plugins.analysis.warnings.groovy.GroovyScript: java.lang.reflect.InvocationTargetException

Can anybody give me a hint how I can configure the test environment so that a custom groovy script parser for the Warnings NG plugin is recognised by the test environment?

Thanks,
Josef



Reply all
Reply to author
Forward
0 new messages