Skip to content

Devel GTK platformTests

Simeon Andreev edited this page Feb 23, 2023 · 1 revision

About

Changes in SWT can cause breakage in Platform UI. As such it's good to run some Platform UI tests before a major 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.

Relevant tests

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.

Workspace setup

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: https://github.com/orgs/eclipse-platform/repositories contains a heading "Platform", which lists all repos. The once that we're interested in are:

   git clone https://github.com/eclipse-platform/eclipse.platform.ui.git
   # Import all projects. (Not all are needed, but there are too many to pick by hand)

   git clone https://github.com/eclipse-platform/eclipse.platform.releng.git
   # You only need to import:  org.eclipse.test.performance

   git clone https://github.com/eclipse-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 https://github.com/eclipse-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 (i.e. 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.

If more dependencies are required, see Vogella's blog article.

Installing relevant Eclipse 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:

  1. Navigate to orbit's download site, click on the newest: http://download.eclipse.org/tools/orbit/downloads/
  2. 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.

  1. 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.

See also

Clone this wiki locally