Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 276068 - [JUnit] JUnit viewer doesn't recognise <skipped/> node
Summary: [JUnit] JUnit viewer doesn't recognise <skipped/> node
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-13 08:40 EDT by Neale Upstone CLA
Modified: 2009-09-10 14:53 EDT (History)
1 user (show)

See Also:


Attachments
Example Junit xml report (15.61 KB, text/xml)
2009-05-13 08:40 EDT, Neale Upstone CLA
no flags Details
Marks <skipped/> node as an ignored test when importing [file is mod of src from 3.6 nightly 20090905] (8.10 KB, text/plain)
2009-09-09 11:56 EDT, Neale Upstone CLA
markus.kell.r: iplog+
Details
Adds NODE_SKIPPED constant [file is mod of src from 3.6 nightly 20090905] (2.87 KB, text/plain)
2009-09-09 11:57 EDT, Neale Upstone CLA
markus.kell.r: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Neale Upstone CLA 2009-05-13 08:40:57 EDT
Created attachment 135565 [details]
Example Junit xml report

Another JUnit 4 one.

If a JUnit4 test is annotated @Ignore, the resulting xml generated (e.g. when running mvn test) contains <skipped/>

This causes an error when opening the file.

Try opening the attached with E3.5M7, and you'll get: 
 The test run could not be imported from file 'C:\Projects\workspace\abdera\adapters\filesystem\target\surefire-reports\TEST-org.apache.abdera.protocol.server.test.filesystem.FilesystemTest.xml'.
unknown node 'skipped'
Comment 1 Markus Keller CLA 2009-05-13 10:36:02 EDT
The JUnit view understands XML files from the Ant JUnit task and files exported from the JUnit view.

The Ant task just swallows ignored tests. Files from the JUnit view add an attribute 'ignored', e.g.:
<testcase name="ignored" classname="pack.Failures" time="0.0" ignored="true"/>

No plans to add other formats unless the JUnit Ant task output is updated, see
https://issues.apache.org/bugzilla/show_bug.cgi?id=43969
Comment 2 Neale Upstone CLA 2009-05-13 11:52:31 EDT
Mmm.. not sure I follow what you're saying.

Are you saying that E3.5 supports:
- It's own exports
- JUnit4 run from Ant

but that JUnit4 run from Maven is creating the problem by adding that attribute in?

Sorry.. don't have time to go into the code - just trying to get clarity on where things might go with this, e.g. whether it's worth me looking at a patch.

Comment 3 Markus Keller CLA 2009-05-13 12:35:36 EDT
> Are you saying that E3.5 supports:
> - It's own exports
> - JUnit4 run from Ant
> 
> but that JUnit4 run from Maven is creating the problem by adding that attribute
> in?

Yep. The basic problem is that JUnit doesn't specify a standard format for test result files. The Ant people created their own report format for JUnit 3, and other tools took over their format.

Since nobody took the time to update the Ant task to JUnit 4 completely (their JUnit task just wraps JUnit 4 tests into a JUnit4TestAdapter), tools started to add their own elements and attributes to express JUnit 4 features.

We could add support for the <skipped> tag, or be more forgiving and just skip unknown content. It's too late for 3.5, but patches would be welcome for 3.6.

@see TestRunHandler
Comment 4 Neale Upstone CLA 2009-09-09 11:56:53 EDT
Created attachment 146764 [details]
Marks <skipped/> node as an ignored test when importing [file is mod of src from 3.6 nightly 20090905]

(sorry no patch.. I'm behind a firewall blocking CVS access)
Comment 5 Neale Upstone CLA 2009-09-09 11:57:46 EDT
Created attachment 146765 [details]
Adds NODE_SKIPPED constant [file is mod of src from 3.6 nightly 20090905]
Comment 6 Neale Upstone CLA 2009-09-09 12:02:01 EDT
Attachments are a simple and safe change that mirror the skipping of stdout and stderr nodes, except it calls fTestCase.setIgnored(true) to correctly mark the test case in the UI.

Can you get this in for M2, and perhaps even consider for 3.5.2?
Comment 7 Markus Keller CLA 2009-09-10 14:53:00 EDT
Thanks, released to HEAD.

Although the change is small and looks safe, it is an enhancement, not a regression, and not a widely-experienced problem, so I'm afraid this doesn't qualify for 3.5.2.