Bug 206750 - [JUnit] Running JUnit tests in ANT should bring up the JUnit UI
Summary: [JUnit] Running JUnit tests in ANT should bring up the JUnit UI
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-18 09:25 EDT by Johan Walles CLA
Modified: 2007-10-19 08:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Walles CLA 2007-10-18 09:25:08 EDT
Build ID: M20070921-1145

Steps To Reproduce:
1. Create some JUnit tests
2. Make sure you can run them using an ANT launcher
3. Run the JUnit tests through an ANT launcher

Expected behavior:
The same UI that appears when running JUnit tests through a JUnit launcher should pop up and track the progress.

Current behavior:
I have to manually read and parse the text output from ANT + JUnit in a console view.

More information:
The reason I can't just use the Eclipse JUnit launcher is that ANT sets up some prerequisites (like starting WebLogic) before running some of my tests.

Don't know who should own this, I'll take my chances with JDT UI.
Comment 1 Markus Keller CLA 2007-10-18 12:13:50 EDT
In 3.3 or later, you can already import xml files generated by the Ant JUnit task:

1. run junit ant task with
		<junit printsummary="yes">
			<formatter type="xml"/>
			...
  
2. optionally create a summary:
		<junitreport todir="${result}">
			<fileset dir="${result}">
				<include name="TEST-*.xml"/>
			</fileset>
		</junitreport>

3. in JUnit view, open the menu on the 'Test Run History' button, choose Import..., and select the generated TEST-yourTest.xml or TESTS-TestSuites.xml file.

You won't get progress reporting with this, but at least you can browse the tests more easily.


Possible enhancements:
- Make it easier to open test result files:
  - support drag and drop of test result files into the JUnit view
  - support opening test result files by double-click or via a file link
      in the Console view


A full-fledged solution would be this (however, JDT/UI has currently no resources to implement this):
- Write a JUnitResultFormatter for clients to use in their <junit> tasks.
- Formatter is informed about test progress and can post results to the JUnit view.
- Open question: how can we feed the data from the formatter to the JUnit view (probably need some socket connection like in the RemoteTestRunner/-Client), but this is difficult to set up for external Ant launches).
Comment 2 Markus Keller CLA 2007-10-18 12:20:55 EDT
Another approach could be an Ant task that opens the generated xml files in Eclipse after the tests have finished. Drawbacks:
- clients must manually add the task to the Ant classpath
- no progress
- telling a running Eclipse instance to open a file is difficult, see bug 4922 and bug 178927
Comment 3 Johan Walles CLA 2007-10-19 08:33:20 EDT
See also related bug 206879.