Hi Victor,

Thanks for your answer! I looked at the code you suggested and made the
code that executes JUnit tests generate the proper XML files. And when I
add the "Publish JUnit results" step at the job those results now indeed
show up as planned ;-) The strange thing is that the "Test result trend"
chart does not show immediately, it does after a while - but that seems to
be a know problem.

So for now my plugin seems fully functional - showing unstable when tests
fail and with some extra config it will show test results and trends nicely
- thanks to you ;-)

Next step is to remove the need to add that build step manually.. I'll look
into that JUnitResultArchiver class more to understand what it does.

Frits


On Sat, Mar 3, 2012 at 12:53 PM, Victor Polyansky <
victor.polyan...@gmail.com> wrote:

> Hi Frits,
>
> As for JUnit results, look at hudson.tasks.junit.JUnitResultArchiverclass.
> It uses JUnitParser to parse provided xml's and adds TestResultAction to
> the build.
> TestResultAction extends hudson.tasks.test.AbstractTestResultAction
> which provides links to results, charts, etc.
>
> But may be you would like to use the existing *'Publish JUnit results' *at
> the job configuration?
> In this case, you only need to find out where generated JUnit reports are
> stored and put their
> paths to a job configuration.
>
> Victor.
>
> суббота, 3 марта 2012 г. 1:00:36 UTC+4 пользователь Frits написал:
>
>> Hi group,
>>
>> I am building a Jenkins plugin to compile Eclipse workspaces out-of-
>> the-box, without Maven. But I have some questions:
>>
>> * When JUnit tests fail in the build I want to mark the build as
>> unstable. So in my class's public boolean perform(AbstractBuild build,
>> Launcher launcher, BuildListener listener) method I end with:
>>
>>                         int utc = jtr.getFailedTestCount();
>>                         if(utc > 0) {
>>                               **  listener.finished(Result.**UNSTABLE);
>>                               **  listener.error(utc + " junit tests
>> have failed");
>>                               **  System.out.println("Return UNSTABLE: "
>> + utc);
>>                         }
>>                         return true;
>>
>> However the job remains to be marked as SUCCESFUL as can be seen on
>> the console:
>>
>> Return UNSTABLE: 44
>> Mar 2, 2012 9:40:27 PM hudson.model.Run run
>> INFO: test #54 main build action completed: SUCCESS
>>
>> How can I mark a build as unstable? I want my yellow balls...
>>
>> * An Eclipse workspace consists of different modules (projects) also,
>> just like Maven. I would like to present most information from an
>> Eclipse build in the same way as a Maven build, as a set of modules
>> that failed/tested/worked etc. But I seem to be unable to find generic
>> infrastructure for this- it looks like all of this is maven specific.
>> Is that true? (Then I can stop searching ;-)
>>
>> * Similarly I want to show the JUnit test results in the same way as
>> the Maven test results. Like the failure history on the job's page
>> ("Test Result Trend") and the links to the individual module results.
>> Is code for that reusable in Jenkins and where could I find that?
>>
>> Hope someone can answer...
>>
>> Greetings,
>>
>> Frits Jalvingh
>>
>

Reply via email to