Starting Eclipse Commandline With Equinox Launcher/Headless JUnit Testing

From Eclipsepedia

Jump to: navigation, search

If you're looking to run JUnit tests headlessly, here's a bash script that does that as part of a headless PDE build. Relevant part starts at line 191:

# different ways to get the launcher and Main class
if [[ -f eclipse/startup.jar ]]; then
  cpAndMain="eclipse/startup.jar org.eclipse.core.launcher.Main"; # up to M4_33
elif [[ -f eclipse/plugins/org.eclipse.equinox.launcher.jar ]]; then
  cpAndMain="eclipse/plugins/org.eclipse.equinox.launcher.jar org.eclipse.equinox.launcher.Main"; # M5_33
  cpAndMain=`find eclipse/ -name "org.eclipse.equinox.launcher_*.jar" | sort | head -1`" org.eclipse.equinox.launcher.Main";
# run tests
echo "[runtests] [`date +%H\:%M\:%S`] Launching Eclipse (installmode = $installmode with -enableassertions turned on) ..."
execCmd "$JAVA_HOME/bin/java $Xflags -enableassertions -cp $cpAndMain -ws $ws -os $os -arch $arch \
-application org.eclipse.ant.core.antRunner -data $workspaceDir -file test.xml $antTestTarget \
$Dflags -Dws=$ws -Dos=$os -Darch=$arch -D$installmode=true $J2SE15flags \
$properties -logger" $consolelog;
echo "[runtests] [`date +%H\:%M\:%S`] Eclipse test run completed. "