Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Automated PDE JUnit Testing With Eclipse 3.3M5"

m
m (add details about library.xml fix)
Line 3: Line 3:
 
== History ==
 
== History ==
  
After 3.3M4, Modeling builds [https://bugs.eclipse.org/bugs/show_bug.cgi?id=170831 no longer ran their JUnit tests], due to changes in the way Eclipse packages its startup jars. I had thought the fix was trivial, but unfortunately [https://bugs.eclipse.org/bugs/show_bug.cgi?id=170831#c3 there's more to it than is explained below]. I'll update this document when I find a solution.
+
After 3.3M4, Modeling builds [https://bugs.eclipse.org/bugs/show_bug.cgi?id=170831 no longer ran their JUnit tests], due to changes in the way Eclipse packages its startup jars. The fix is trivial, but requires a change to [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/library.xml?view=log org.eclipse.test/library.xml] in addition to your local releng code.
  
 
  [echo] Running org.eclipse.someproject.tests.AllTests
 
  [echo] Running org.eclipse.someproject.tests.AllTests
Line 13: Line 13:
 
  [java] Unable to access jarfile ''{dd}''/2.3.0/N200701240200/testing/N200701240200/testing/target/eclipse/startup.jar
 
  [java] Unable to access jarfile ''{dd}''/2.3.0/N200701240200/testing/N200701240200/testing/target/eclipse/startup.jar
  
: - or -
+
== Migration Guide ==
  
[exec] eclipse-test:
 
[exec]      [echo] Running org.eclipse.ocl.uml.tests.AllTests
 
[exec]      [java] java.lang.NullPointerException
 
[exec]      [java] at org.eclipse.equinox.launcher.Main.takeDownSplash(Main.java:1734)
 
[exec]      [java] at org.eclipse.equinox.launcher.Main.run(Main.java:1150)
 
[exec]      [java] at org.eclipse.equinox.launcher.Main.main(Main.java:1099)
 
 
== Migration Guide ==
 
  
 
* These changes should apply to anyone using PDE for builds & included JUnit tests.
 
* These changes should apply to anyone using PDE for builds & included JUnit tests.
Line 42: Line 34:
 
| <code style="color:red">org.eclipse.core.launcher.Main</code>
 
| <code style="color:red">org.eclipse.core.launcher.Main</code>
 
| <code style="color:green">org.eclipse.equinox.launcher.Main</code>
 
| <code style="color:green">org.eclipse.equinox.launcher.Main</code>
|- valign="top"
 
| [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mdt/org.eclipse.ocl.releng/builder/tests/customTargets.xml?root=Modeling_Project&view=markup customTargets.xml] (library.xml hack)
 
| add -nosplash flag
 
| <code style="color:red"></code>
 
| <code style="color:green">-nosplash</code>
 
 
|}
 
|}
  
Line 69: Line 56:
 
| <code>org.eclipse.*.launcher.Main</code>
 
| <code>org.eclipse.*.launcher.Main</code>
 
|}
 
|}
 +
 +
 +
* These changes apply to you if you use org.eclipse.test (eg., in your map file, or if you run org.eclipse.test/library.xml).
 +
 +
 +
plugin@org.eclipse.test=v20060926,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,
 +
 +
 +
This is fixed by moving up to the latest version of [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/library.xml?view=log org.eclipse.test/library.xml], according to the fix posted in [https://bugs.eclipse.org/bugs/show_bug.cgi?id=171756#c5 bug 171756]. If you can't move up, there's a hack documented in that bug as well, including a fix to avoid <code>NullPointerException at o.e.equinox.launcher.Main.takeDownSplash (Main.java:1734)</code>, using the <code>-nosplash</code> flag.
 +
 +
 +
 
== Running Tests ==
 
== Running Tests ==
  
Line 81: Line 80:
  
 
The variables noted in the above example can be seen in detail in the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mdt/org.eclipse.ocl.releng/builder/tests/scripts/runtests?root=Modeling_Project&view=markup runtests] shell script.
 
The variables noted in the above example can be seen in detail in the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.mdt/org.eclipse.ocl.releng/builder/tests/scripts/runtests?root=Modeling_Project&view=markup runtests] shell script.
 +
  
 
== Links ==
 
== Links ==
Line 89: Line 89:
 
* [[Equinox Launcher]] (history of changes including related Bugzillas)
 
* [[Equinox Launcher]] (history of changes including related Bugzillas)
 
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/testframework.html?view=co Eclipse Test Framework]
 
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/testframework.html?view=co Eclipse Test Framework]
 +
  
 
== Bugs ==
 
== Bugs ==

Revision as of 16:22, 31 January 2007

History

After 3.3M4, Modeling builds no longer ran their JUnit tests, due to changes in the way Eclipse packages its startup jars. The fix is trivial, but requires a change to org.eclipse.test/library.xml in addition to your local releng code.

[echo] Running org.eclipse.someproject.tests.AllTests
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/launcher/Main
- or -
[echo] Running org.eclipse.emf.test.build.AllSuites
[java] Unable to access jarfile {dd}/2.3.0/N200701240200/testing/N200701240200/testing/target/eclipse/startup.jar

Migration Guide

  • These changes should apply to anyone using PDE for builds & included JUnit tests.


Filename Explanation Before After
runtests switch from startup.jar to org.eclipse.equinox.launcher_*.jar cp="eclipse/startup.jar" cp=`find eclipse/ -name "org.eclipse.equinox.launcher_*.jar" | sort | head -1`
runtests switch Main classes org.eclipse.core.launcher.Main org.eclipse.equinox.launcher.Main



Filename Explanation Before After
relengbuildgtk.sh don't pass -cp into runtests script to override value set there runtests -os linux -ws gtk -arch x86 -cp eclipse/startup.jar runtests -os linux -ws gtk -arch x86
runtests remove -noupdate flag (not supported anymore) org.eclipse.*.launcher.Main -noupdate org.eclipse.*.launcher.Main


  • These changes apply to you if you use org.eclipse.test (eg., in your map file, or if you run org.eclipse.test/library.xml).


plugin@org.eclipse.test=v20060926,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,


This is fixed by moving up to the latest version of org.eclipse.test/library.xml, according to the fix posted in bug 171756. If you can't move up, there's a hack documented in that bug as well, including a fix to avoid NullPointerException at o.e.equinox.launcher.Main.takeDownSplash (Main.java:1734), using the -nosplash flag.


Running Tests

To run tests, you'll need something like this:

$JAVA_HOME/bin/java $Xflags -enableassertions -cp $cp \
  org.eclipse.equinox.launcher.Main -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 org.apache.tools.ant.DefaultLogger

The variables noted in the above example can be seen in detail in the runtests shell script.


Links


Bugs

Back to the top