Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 474132

Summary: [Tests] Move test suite of o.e.ui.tests and migrate progress jobs to JUnit 4
Product: [Eclipse Project] Platform Reporter: Alexander Kurtakov <akurtakov>
Component: UIAssignee: Alexander Kurtakov <akurtako>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, Lars.Vogel, nobody, psuzzi
Version: 4.5   
Target Milestone: 4.6 M2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/53050
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4100c90a8b9e169fbda136878f33cefbbc3a98b4
https://git.eclipse.org/r/53755
https://git.eclipse.org/r/53758
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=9650a451af8866afab65d01a119398e3b253dc70
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8f5fb7ab69b1d58548433700030f850e26f91e0b
Whiteboard:
Bug Depends on:    
Bug Blocks: 436344, 474832    

Description Alexander Kurtakov CLA 2015-08-03 06:54:24 EDT
Full migration will be significant effort but there are some easy wins that can be done whenever someone has to touch a test for some other reason.
Comment 1 Lars Vogel CLA 2015-08-03 06:58:33 EDT
We have automatic conversion tools available for simple cases. See http://codemodify.vogella.com/
Comment 2 Eclipse Genie CLA 2015-08-03 07:07:19 EDT
New Gerrit change created: https://git.eclipse.org/r/53050
Comment 3 Lars Vogel CLA 2015-08-03 07:17:50 EDT
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/53050

Thanks Alexander. Please give our vogella test migration tool a try, it should be as simple as "Convert to JUnit 4" from the context menu to do this work.
Comment 4 Alexander Kurtakov CLA 2015-08-03 07:32:59 EDT
(In reply to Lars Vogel from comment #3)
> (In reply to Eclipse Genie from comment #2)
> > New Gerrit change created: https://git.eclipse.org/r/53050
> 
> Thanks Alexander. Please give our vogella test migration tool a try, it
> should be as simple as "Convert to JUnit 4" from the context menu to do this
> work.

Will do, next time I have to convert some tests. Wouldn't it make it easier to find if available in JDT directly.
Comment 5 Lars Vogel CLA 2015-08-03 07:49:47 EDT
(In reply to Alexander Kurtakov from comment #4)
> Will do, next time I have to convert some tests. Wouldn't it make it easier
> to find if available in JDT directly.

Not sure that that conversion is something JDT wants or should have. It is a one-time thing IMHO.
Comment 6 Lars Vogel CLA 2015-08-12 12:32:52 EDT
I relabeled the bug report, as Alexander only migrated a few tests.
Comment 8 Lars Vogel CLA 2015-08-12 12:34:14 EDT
Thanks Alexander
Comment 9 Dani Megert CLA 2015-08-13 03:53:33 EDT
This causes a mix of JUnit 3 and JUnit 4 which surfaces a bug in JUnit and hence results in test failures in our official build:

http://download.eclipse.org/eclipse/downloads/drops4/N20150812-2000/testresults/html/org.eclipse.e4.core.tests_linux.gtk.x86_64_8.0.html

See https://wiki.eclipse.org/Eclipse/Testing/JUnit4_Changes#JUnit-4-style_test_suites on how to workaround this.
Comment 10 Dani Megert CLA 2015-08-14 03:28:17 EDT
Please either fix this or revert the change for the next build.
Comment 11 Lars Vogel CLA 2015-08-14 04:36:08 EDT
(In reply to Dani Megert from comment #10)
> Please either fix this or revert the change for the next build.

Do we have a bug report for the failing tests only showing as "Initialization error" instead of the test name?
Comment 12 Dani Megert CLA 2015-08-14 04:45:36 EDT
(In reply to Lars Vogel from comment #11)
> (In reply to Dani Megert from comment #10)
> > Please either fix this or revert the change for the next build.
> 
> Do we have a bug report for the failing tests only showing as
> "Initialization error" instead of the test name?

We can use this bug report since the change is responsible for the problem.

To reproduce locally add the JUnit4TestAdapter to the suite, e.g.
public class XYZTestSuite {
	public static Test suite() {
		return new JUnit4TestAdapter(XYZTestSuite.class);
	}
}
and run it with the JUnit 3 runner.
Comment 13 Eclipse Genie CLA 2015-08-14 05:18:23 EDT
New Gerrit change created: https://git.eclipse.org/r/53755
Comment 14 Lars Vogel CLA 2015-08-14 05:44:33 EDT
(In reply to Eclipse Genie from comment #13)
> New Gerrit change created: https://git.eclipse.org/r/53755

This one converts as many test suites to JUnit 4.
Comment 15 Eclipse Genie CLA 2015-08-14 05:50:36 EDT
New Gerrit change created: https://git.eclipse.org/r/53758
Comment 16 Lars Vogel CLA 2015-08-14 05:51:01 EDT
(In reply to Eclipse Genie from comment #15)
> New Gerrit change created: https://git.eclipse.org/r/53758

This one adds the @RunWith annotation to the remaining JUnit3 test suites.
Comment 17 Lars Vogel CLA 2015-08-14 05:53:49 EDT
Adding the following to UiTestSuite and running it via a JUnit3 runner as suggested by Dani, was successful.

public static Test suite() {
 return new JUnit4TestAdapter(UiTestSuite.class);
}
Comment 20 Lars Vogel CLA 2015-08-14 07:40:46 EDT
Next batch test run will show if all errors are fixed, locally everything worked
Comment 21 Dani Megert CLA 2015-08-14 07:56:48 EDT
(In reply to Lars Vogel from comment #20)
> Next batch test run will show if all errors are fixed, locally everything
> worked

Thanks Lars!