1

I don't even know where to begin. JUnit plugin is installed and is running in some scripts (I couldn't find those, it's a large project, but the statistic page indicates 28 usages). But, the pipeline code junit "foo.xml" fails with

java.lang.NoSuchMethodError: No such DSL method 'junit' found among steps

Followed by 100,500 lines of usual nonsense.

Is there anything special I need to do to "enable" this plugin? Jenkins wiki lists it as "required" (whatever that means). The example Jenkinfile that illustrates the usage of this plugin never imports anything. Nonexistent debugging and ninja-style documentation don't really help getting to the culprit of this problem.


When I tried to replace junit 'foo.xml' with step([$class: 'JUnitResultArchiver', testResults: './foo.xml']). This "step" produced the following output:

Recording test results

And failed the build without any further messages. Neither in console nor in the logs collected by the pipeline.

mkobit
  • 43,979
  • 12
  • 156
  • 150
wvxvw
  • 8,089
  • 10
  • 32
  • 61
  • try junit testResults: 'foo.xml' – Ram Nov 20 '17 at 10:20
  • @RamKamath same exact result. – wvxvw Nov 20 '17 at 11:32
  • could you please update the pipeline snippet where it is actually invoked, and also version number of your JUnit plugin? – Ram Nov 20 '17 at 11:50
  • @RamKamath I don't have access to version information. It doesn't matter where I use `junit` step. Any place I put it leads to the same error. I'll ask the DevOps to look at the version, but I doubt it will help... there's not a single example in the Jenkins' site it calls "documentation" where functionality of `junit` was assumed not to exist. – wvxvw Nov 20 '17 at 12:01
  • Am not sure what is causing this problem. However, make sure that jenkins was restarted after installing Junit plugin. – Ram Nov 20 '17 at 12:21
  • @RamKamath JUnit plugin comes pre-packaged with Jenkins. I believe one must work very hard to uninstall it... But Jenkins has obviously used this plugin successfully in 28 different projects which ran for several years (while Jenkins was also upgraded during that time). There is not a single chance that Jenkins worked all these years w/o being restarted (Java programs in general don't run that long without crashing). – wvxvw Nov 20 '17 at 14:14
  • The first example failing is strange, it would generally point to older plugins being loaded but I am not sure. The second example, are you possibly being affected by https://issues.jenkins-ci.org/browse/JENKINS-6268? – mkobit Nov 20 '17 at 17:52
  • @mkobit our IT is slow and incompetent, so I still don't have the information about the plugin version. Neither do I have the permissions to view those other projects / Jenkins plugin configuration. Re' bug you refer to: seems unlikely, since the message printed is different, but it is possible that there is some misunderstanding on the part of `JUnitResultArchiver` since the reports are produced by `pytest` rather than the genuine Java's JUnit. Regardless, would you know of a way to programmaticaly verifying the version of a plugin? – wvxvw Nov 21 '17 at 07:27
  • The issue can happen on any test framework that produces JUnit-style XML test outputs. I hit it with Gradle building twice and test output was up-to-date so file modification time didn't change. Jenkins `junit` step then decided to fail (dumb default behavior). It was difficult to debug because the build output only had the message you posted above. RE plugin versions: I think all variants require you to have either _Admin_ or _Run Scripts_ permissions (can try answers in https://stackoverflow.com/questions/9815273). Maybe the path to XML file doesn't exist, or isn't a valid Ant pattern? – mkobit Nov 21 '17 at 13:54

0 Answers0