Changes in SWT can cause breakage in platform ui. As such it's good to run some platform ui tests before patch submission. There are many different test suites in platform ui, but generally only a few are directly affected by swt. In general, if SWT causes a higher level test case to fail, we should seek to create an equivalent SWT jUnit test case and fix that one, this would avoid future regressions.
The relevant tests are located inside eclipse.platform.ui repository:
- Project: org.eclipse.ui.tests, folder: "Eclipse JFace Tests", Package: "org.eclipse.jface.tests", AllTests.java
- Project: org.eclipse.ui.tests, folder: "Eclipse UI Tests", Package: "UiTestSuite.java" (this one takes a while to run)
- Project: org.eclipse.e4.ui.tests.css.swt, folder: "src", Package: "org.eclipse.e4.ui.tests.css.swt", CssSwtTestSuite.java
These tests are run as "JUnit plugin test" not as regular "JUnit test".
You might consider bookmarking these files as it takes time to find them.
Note, there are many more tests, but these are the most interesting for SWT developers.
Getting all the tests to work is sometimes not quite straight forward as there are number of dependent projects from various repositories that need to be open alongside the test projects. Also when you open a test project, when it asks if you want to open dependent projects, it doesn't always open all dependent projects. Some have to be opened by hand. You may find it useful to create a problem view that only shows you the problems of the selected project.
Importing relevant repositories
The list of repos: http://git.eclipse.org/c/ contains a heading "Platform", which lists all repos. The once that we're interested in are:
git clone http://git.eclipse.org/gitroot/platform/eclipse.platform.ui.git # Import all projects. (Not all are needed, but there are too many to pick by hand)
git clone http://git.eclipse.org/gitroot/platform/eclipse.platform.releng.git # You only need to import: org.eclipse.test.performance
git clone http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/ # Import all if lazy or just the following: # org.eclipse.core.contenttype # org.eclipse.core.jobs # org.eclipse.core.runtime # org.eclipse.core.tests.harness < Note: This project isn't auto-opened. You need to open it manually or add it as dependency. git clone http://git.eclipse.org/gitroot/platform/eclipse.platform.resources.git # Here you'll want to import selectively as there is variability among platforms: # org.eclipse.core.filesystem # org.eclipse.core.filesystem.<YOUR_PLATFORM> (ex .linux.x86_64) # org.eclipse.core.resources
You can of course also import all projects from all repositories, but I would avoid importing platform specific packages that don't match your platform. (Ex win32 on Linux), for workspace hygiene reasons.
When you open the testing projects, if some of the dependent projects don't open also (ex the filesystem, or harness) you probably want to configure eclipse to also open the dependent projects by going into project properties -> Java Build Path -> Projects.
Installing relevant eclpise plugins
In order for some of the errors to go away you need to install Hamcrest and mockito plugin dependencies from orbit.
To do so:
- Navigate to orbit's download site, click on the newest: http://download.eclipse.org/tools/orbit/downloads/
- Look for the "Orbit Build Repository" link, typically has 'repository' appended to it, like:
http://download.eclipse.org/tools/orbit/downloads/drops/R20160520211859/__repository/__ # Example for Neon.
- This will be your eclipse update site. Add it to Eclipse update site, then from the list install all plugins form category: "Orbit Bundles By Scope: Testing"
You need to clean and rebuild your workspace after opening many projects for some errors to go away.
By now you should not have any errors in your workspace and tests can be run. As usual, these can be run on Gtk3/Gtk2 like snippets by setting SWT_GTK3=1.
Vogella blog (see for API baseline errors): http://blog.vogella.com/2013/07/10/unit-testing-of-the-eclipse-jface-ui-toolkit/ Eclipse testing: https://wiki.eclipse.org/Eclipse/Testing