0

I've been trying to set up Jenkins to work with my C# project to do automated testing and code coverage. I've got the testing working and code coverage files generating and converting using CoverageConverter.exe (not using any plugins--just straight batch files and raw EXEs), but when I add the MSTest post-build step to get the data to display in Jenkins, I get the following error:

[MSTEST-PLUGIN] Processing test results in file(s) **/*.trx
MSTest: D:\Jenkins\jobs\Framework\workspace\TestResults\james_CD 2016-03-18 20_05_13.trx
ERROR: Step ‘Publish MSTest test result report’ aborted due to exception: 
java.lang.NoClassDefFoundError: hudson/maven/MavenBuild
    at hudson.plugins.emma.EmmaPublisher.perform(EmmaPublisher.java:103)
    at hudson.plugins.mstest.MSTestPublisher.perform(MSTestPublisher.java:134)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
    at hudson.model.Run.execute(Run.java:1763)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: java.lang.ClassNotFoundException: hudson.maven.MavenBuild
    at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
    at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
    at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 11 more

Despite the error, the 'Test Result Trend' graph shows on the project page and appears to be correct, and there is a section for 'Code Coverage Trend', but that has a broken image link.

I'm running the tests and code coverage using the following batch snippet:

@ECHO "`nRunning tests`n---------------------------" 
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" TestFramework\bin\Release\TestFramework.dll /EnableCodeCoverage /Settings:TestFramework\Settings.testsettings /Logger:trx
@ECHO %ERRORLEVEL%
REM @IF %ERRORLEVEL% NEQ 0 EXIT 1

@ECHO "`n`nConverting code coverage results`n---------------------------" 
@IF EXIST emma\. rd emma /s /q >nul
md emma
del emma\temp.coverage /Q >nul
for /R TestResults %%f in (*.coverage) do copy "%%f" emma\temp.coverage /B /Y
"C:\Program Files\JenkinsUtilities\CoverageConverter\CoverageConverter.exe" /in:emma\temp.coverage /out:emma\coverage.xml /xsl:"C:\Program Files\JenkinsUtilities\MSTestCoverageToEmma.xsl"
goto END

I copied the basic process from another Jenkins system where a similar project is working, but can't find any relevant differences between the systems.

I have already tried: 1. Updating Java 2. Updating Jenkins 3. Uninstalling and reinstalling the MSBuild, MSTest, MSTest Runner, and VSTest Runner, and Maven Integration plugins.

I feel like I'm really close at this point, but I have very little experience with Java, so I'm at a loss to correct this error at this point. Can anyone help me diagnose the ClassNotFoundException?

James
  • 3,551
  • 1
  • 28
  • 38

1 Answers1

0

After desperately combing through logs and installing Eclipse (on another machine) to peek into the java files, it started unexpectedly working. It may have been related to installing the JaCoCo plugin, which I also installed when I noticed that the Emma Line Coverage plugin I had previously installed to display the results says that it was superceded by the JaCoCo plugin.

James
  • 3,551
  • 1
  • 28
  • 38