Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant(NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant)
NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant [message #544954] Tue, 06 July 2010 04:30 Go to next message
hintcnuie  is currently offline hintcnuie
Messages: 7
Registered: July 2010
Junior Member
I met an issue when trying the headless SWTBot with ant, it throws message as follows[message1]:
Install location:
    file:/d:/EclipseRCP/eclipse/
Configuration file:
    file:/d:/EclipseRCP/eclipse/configuration/config.ini loaded
Configuration location:
    file:/d:/EclipseRCP/eclipse/configuration/
Framework located:
    file:/d:/EclipseRCP/eclipse/plugins/org.eclipse.osgi_3.5.2.R35x_v20100126.jar
Framework classpath:
    file:/d:/EclipseRCP/eclipse/plugins/org.eclipse.osgi_3.5.2.R35x_v20100126.jar
Debug options:
    file:/D:/EclipseRCP/eclipse/.options not found
Time to load bundles: 0
Starting application: 2235
!SESSION 2010-07-06 16:08:03.979 -----------------------------------------------
eclipse.buildId=unknown
java.fullversion=J2RE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260sr5ifx-20090821_41076 (JIT enabled, AOT enabled)
J9VM - 20090821_041076_lHdSMr
JIT  - r9_20090518_2017
GC   - 20090417_AA
BootLoader constants: OS=win32, ARCH=x86, WS=workspace, NL=zh_CN
Framework arguments:  -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication -testApplication org.eclipse.ui.ide.workbench formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot.setup.AllTest.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -testPluginName com.ecilpse.swtbot.setup -className com.eclipse.swtbot.setup.AllTest
Command-line arguments:  -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication -testApplication org.eclipse.ui.ide.workbench -data workspace formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot.setup.AllTest.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -testPluginName com.ecilpse.swtbot.setup -className com.eclipse.swtbot.setup.AllTest -os win32 -ws workspace -arch x86 -consoleLog -debug

!ENTRY org.eclipse.osgi 4 0 2010-07-06 16:08:06.479
!MESSAGE An error occurred while automatically activating bundle org.eclipse.ui.workbench (270).
!STACK 0
org.osgi.framework.BundleException: The activator org.eclipse.ui.internal.WorkbenchPlugin for bundle org.eclipse.ui.workbench is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:157)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:457)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
	at org.eclipse.core.launcher.Main.main(Main.java:34)
Caused by: java.lang.NoClassDefFoundError: org.eclipse.swt.SWTError
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:70)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
	at java.lang.J9VMInternals.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1325)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
	... 34 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	... 41 more
Root exception:
java.lang.NoClassDefFoundError: org.eclipse.swt.SWTError
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:70)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
	at java.lang.J9VMInternals.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1325)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:457)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
	at org.eclipse.core.launcher.Main.main(Main.java:34)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	... 41 more

!ENTRY org.eclipse.osgi 4 0 2010-07-06 16:08:06.604
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.swtbot.eclipse.junit4.headless was unable to load class org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication.
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:180)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:162)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
	at org.eclipse.core.launcher.Main.main(Main.java:34)
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ui.workbench (270).
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:125)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:457)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	... 17 more
Caused by: org.osgi.framework.BundleException: The activator org.eclipse.ui.internal.WorkbenchPlugin for bundle org.eclipse.ui.workbench is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:157)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	... 29 more
Caused by: java.lang.NoClassDefFoundError: org.eclipse.swt.SWTError
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:70)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
	at java.lang.J9VMInternals.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1325)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
	... 34 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	... 41 more

!ENTRY org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
!MESSAGE Bundle org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519 [99] was not resolved.
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
!MESSAGE Bundle org.eclipse.swt.win32.win32.x86_3.5.2.v3557f [233] was not resolved.
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.886
!MESSAGE Bundle org.eclipse.ui.win32_3.2.100.v20090429-1800 [269] was not resolved.



Environment:
Eclipse 3.5.2
Related files:
build file to run[build.xml]:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="testsuite" default="run" basedir=".">
    <property name="eclipse-home" value="D:/EclipseRCP/eclipse" />
    <property name="plugin-under-test" value="com.ecilpse.swtbot.setup" />
    <property name="plugin-name" value="com.ecilpse.swtbot.setup" />
	<property name="test-classname"   value="com.eclipse.swtbot.setup.AllTest"/>
	<property name="all.buildId" value="2.0.0.568-dev-e35"/>
	<property name="build.base"  value="./"/>
    <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_${all.buildId}/library.xml"/>

	<property name="build.instrumentation.reports.dir" value="${results.dir}/${plugin-name}/coverage/html" />
	<property name="build.instrumentation.reports.xml.dir" value="${results.dir}/${plugin-name}/coverage/xml" />

	<property name="cobertura.data.file" value="${basedir}/${plugin-name}.ser" />
	
	<target name="init">
		<tstamp />
		<delete>
			<fileset dir="${eclipse-home}" includes="org*.xml" />
		</delete>
		<mkdir dir="${results.dir}/${plugin-name}/coverage"></mkdir>		
	</target>

	<path id="cobertura.classpath">
		<fileset dir="${build.base}/cobertura-1.9.4.1">
			<include name="cobertura.jar" />
			<include name="lib/**/*.jar" />
		</fileset>
	</path>

	<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

	<target name="instrument">
		<delete file="${cobertura.data.file}" />

		<cobertura-instrument datafile="${cobertura.data.file}">
			<fileset dir="${eclipse-home}/plugins">
				<include name="${plugin-under-test}_1.0.0.201007061523.jar" />
			</fileset>
		</cobertura-instrument>
	</target>

    <target name="suite">

    	<condition property="jvmOption" value="-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Dnet.sourceforge.cobertura.datafile=${cobertura.data.file} -Xbootclasspath/p:${build.base}/cobertura-1.9.4.1/cobertura.jar">
			<os family="mac" />
		</condition>

		<property name="jvmOption" value="-Dnet.sourceforge.cobertura.datafile=${cobertura.data.file} -Xbootclasspath/p:${build.base}/cobertura-1.9.4.1/cobertura.jar" />


    	<property name="temp-workspace" value="workspace" />
        <delete dir="${temp-workspace}" quiet="true" />

    	<!-- remove junit3 fragment -->
    	<delete dir="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit3.headless_${all.buildId}" />
    	<delete dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.ant.optional.junit3_${all.buildId}.jar"/>

    	<ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${temp-workspace}" />
            <property name="testApplication" value="org.eclipse.ui.ide.workbench" />
            <property name="plugin-name" value="${plugin-name}" />
            <property name="classname" value="${test-classname}" />
			<property name="os" value="win32"/>
			<property name="ws" value="workspace"/>
			<property name="arch" value="x86"/>			
            <property name="vmargs" value=" -Xms128M -Xmx368M -XX:MaxPermSize=256M ${jvmOption}" />
        </ant>
    </target>

	<target name="test-coverage">
		<cobertura-report format="html" destdir="${build.instrumentation.reports.dir}" srcdir="${build.base}/plugins/${plugin-under-test}/src" datafile="${cobertura.data.file}" />
		<cobertura-report format="xml" destdir="${build.instrumentation.reports.xml.dir}" srcdir="${build.base}/plugins/${plugin-under-test}/src" datafile="${cobertura.data.file}" />
	</target>

	<target name="run" depends="init, instrument, suite, test-coverage">
        <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
            <property name="includes" value="*.xml" />
            <property name="output-file" value="${plugin-name}.xml" />
        </ant>
    </target>

</project>

and the library file is as follows,I made a little changes on line 167:
<?xml version="1.0"?>
<!--


======================================================================
this has been copied from o.e.test plugin with some targets for SWTBot
======================================================================


-->

<project name="Library" default="usage" basedir=".">

	<target name="usage">
		<echo message="Please refer to the testframework.html in org.eclipse.test for instructions on usage." />
	</target>

	<target name="init">
		<!--
			Parameters:
				(Mandatory)
				data-dir		- the directory for Eclipse to write its data
				plugin-name		- the name of the plugin to test
				classname		- the name of the test class

				(Optional - overrides defaults set in script)
				testProduct		- a string containing the product id to test.
				testApplication	- a string containing the application id to test.
				vmargs			- a string containing arguments to pass to the VM.
				extraVMargs		- allows separate setting of VM args from separate caller.
				timeout			- overrides default test timeout value (in milliseconds).
				test-output		- overrides default output file produced from test run.
				plugin-path		- path to root of plug-in
				useEclipseExe	- property setting forces test to launch via eclipse executable.
				junit-report-output - output directory for junit reports produced for specified classname.
		-->

		<tstamp>
			<format property="TIMENOW" pattern="HHmmssSSSS" />
		</tstamp>
		<!--property setting useEclipseExe launches tests using the eclipse executable-->
		<condition property="launchTarget" value="eclipse-test">
			<isset property="useEclipseExe" />
		</condition>
		<!--default launch target for launching tests-->
		<property name="launchTarget" value="java-test" />

		<!-- default product/application to launch -->
		<condition property="testproduct.if.available" value="-product ${testProduct}">
			<isset property="testProduct" />
		</condition>
		<property name="testproduct.if.available" value="" />

		<condition property="testapplication.if.available" value="-testApplication ${testApplication}">
			<isset property="testApplication" />
		</condition>

		<property name="testapplication.if.available" value="" />

		<!--default heap sizes when running performance tests-->
		<condition property="vmargs" value=" -Xms256M -Xmx256M">
			<equals arg1="${test.target}" arg2="performance" />
		</condition>
		<property name="extraVMargs" value="" />
		<property name="plugin-path" value="" />
		<property name="timeout" value="7200000" />
		<property name="test-output" value="${eclipse-home}/${classname}.xml" />
		<property name="junit-report-output" value="${eclipse-home}/results" />
		<mkdir dir="${junit-report-output}" />
	</target>

	<target name="swtbot-test" description="Eclipse application used to launch UI plugin tests." depends="init">
		<antcall target="${launchTarget}">
			<!--param name="application" value="org.eclipse.test.uitestapplication"/-->
			<param name="application" value="org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" />
		</antcall>
	</target>

	<target name="java-test">
		<!--default vm args-->
		<property name="vmargs" value="-Xms256m -Xmx512m" />

		<!-- this argument is needed for macosx -->
		<condition property="jvmOption" value="-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts">
			<os family="mac" />
		</condition>

		<property name="jvmOption" value="" />

		<!--set default jvm to use for testing-->
		<property name="jvm" value="${java.home}/bin/java" />

		<property name="launcher-arg-line" value="
			-application ${application}
			${testproduct.if.available}
			${testapplication.if.available}
			-data ${data-dir}
			formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test-output} formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter
			-testPluginName ${plugin-name}
			-className ${classname}
			-os ${os}
			-ws ${ws}
			-arch ${arch}
			-consoleLog
			-debug" />
		<property name="jvm-arg-line" value="${vmargs} ${extraVMargs} ${jvmOption}" />

		<echo>======================================</echo>
		<echo>Running swtbot junit tests in ${classname}</echo>
		<echo>Command line args are ${launcher-arg-line}</echo>
		<echo>JVM args are ${jvm-arg-line}</echo>
		<echo>JUnit Result File: ${junit-report-output}/${classname}.xml.</echo>
		<echo>Console output File: ${junit-report-output}/${classname}.txt.</echo>
		<echo>======================================</echo>

		<fail unless="application" message="variable 'application' not defined." />
		<fail unless="data-dir" message="variable 'data-dir' not defined." />
		<fail unless="test-output" message="variable 'test-output' not defined" />
		<fail unless="plugin-name" message="variable 'plugin-name' not defined" />
		<fail unless="classname" message="variable 'classname' not defined" />
		<fail unless="os" message="variable 'os' not defined. os can be one of win32, linux, macosx" />
		<fail unless="ws" message="variable 'ws' not defined. ws can be one of win32, wpf, gtk, carbon, cocoa" />
		<fail unless="arch" message="variable 'arch' not defined. arch can be one of x86, x86_64, ppc" />

		<pathconvert property="foundJunit3" setonempty="false" pathsep=" ">
			<path>
				<fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.eclipse.junit3.headless*/META-INF/MANIFEST.MF" />
				<fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.ant.optional.junit3*" />
			</path>
		</pathconvert>

		<fail if="foundJunit3">
			.
			Found org.eclipse.swtbot.eclipse.junit3.headless or org.eclipse.swtbot.ant.optional.junit3 in the plugins directory.
			JUnit 3.x and 4.x don't play well together.
			Please remove org.eclipse.swtbot.eclipse.junit3.headless and org.eclipse.swtbot.ant.optional.junit3 from the plugins dir.
		</fail>

		<java fork="true" dir="." timeout="${timeout}" jvm="${jvm}" logError="true" classname="org.eclipse.core.launcher.Main" output="${junit-report-output}/${classname}.txt">
			<classpath>
				<fileset dir="${eclipse-home}/plugins">
					<include name="org.eclipse.equinox.launcher_*.jar" />
				</fileset>
			</classpath>
			<arg line="${launcher-arg-line}" />
			<jvmarg line="${jvm-arg-line}" />
			<sysproperty key="PLUGIN_PATH" value="${plugin-path}" />
		</java>

		<echo>======================================</echo>
		<echo>If you see errors above please see the file ${junit-report-output}/${classname}.txt for more information.</echo>
		<echo>Errors are generally caused by missing or incorrect dependencies.</echo>
		<echo>======================================</echo>

		<antcall target="collect-results" />
	</target>

	<target name="collect-results">
		<dirname property="output-dir" file="${test-output}" />
		<basename property="output-file-name" file="${test-output}" />
		<junitreport todir="${junit-report-output}" tofile="${classname}.xml">
			<fileset dir="${output-dir}">
				<include name="${output-file-name}" />
			</fileset>
		</junitreport>

		<style style="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_${all.buildId}/JUNIT.XSL" basedir="${junit-report-output}" includes="${classname}.result.xml" destdir="${junit-report-output}" />

		<!--save .log content and *.log content from configuration directory-->
		<concat destfile="${junit-report-output}/${classname}.log">
			<fileset dir="${eclipse-home}" includes="${data-dir}/.metadata/*.log" />
			<fileset dir="${eclipse-home}" includes="configuration/*.log" />
		</concat>
	</target>

	<target name="collect">
		<!--
			This target can be used to aggragate test runs from multiple test suites into a single report.

			Parameters to this target:
			includes		- the names of the files to include
			output-file		- the name of the output file to produce
		-->
		<junitreport todir="." tofile="${output-file}">
			<fileset dir=".">
				<include name="${includes}" />
			</fileset>
		</junitreport>
	</target>

</project>





after running the build file, the output in console is:
Buildfile: D:\EclipseRCP\swtbot\build.xml

init:

instrument:
   [delete] Deleting: D:\EclipseRCP\swtbot\com.ecilpse.swtbot.setup.ser
[cobertura-instrument] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Instrumenting 0 files
[cobertura-instrument] Cobertura: Saved information on 0 classes.
[cobertura-instrument] Instrument time: 94ms

suite:

init:

swtbot-test:

java-test:
     [echo] ======================================
     [echo] Running swtbot junit tests in com.eclipse.swtbot.setup.AllTest
     [echo] Command line args are     -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication        -testApplication org.eclipse.ui.ide.workbench    -data workspace    formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot.setup.AllTest.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter    -testPluginName com.ecilpse.swtbot.setup    -className com.eclipse.swtbot.setup.AllTest    -os win32    -ws workspace    -arch x86    -consoleLog    -debug
     [echo] JVM args are  -Xms128M -Xmx368M -XX:MaxPermSize=256M -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar  -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar
     [echo] JUnit Result File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.xml.
     [echo] Console output File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt.
     [echo] ======================================
     [echo] ======================================
     [echo] If you see errors above please see the file D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt for more information.
     [echo] Errors are generally caused by missing or incorrect dependencies.
     [echo] ======================================

collect-results:
    [style] Warning: the task name <style> is deprecated. Use <xslt> instead.
    [style] Transforming into D:\EclipseRCP\eclipse\results

test-coverage:
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 265ms
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 109ms

run:

collect:
[junitreport] the file D:\EclipseRCP\eclipse\artifacts.xml is not a valid testsuite XML document
[junitreport] the file D:\EclipseRCP\eclipse\com.ecilpse.swtbot.setup.xml is not a valid testsuite XML document

BUILD SUCCESSFUL
Total time: 17 seconds




but there are errors in the result folder, which is just as [message1] shows.

Could anyone help me? I was just following the screen vedio :http://download.eclipse.org/technology/swtbot/docs/videos/b eginners/SWTBotHeadlessTestingForNovices/
but it seems not work, I've spent several hours on it but no valid result,and just come for help now.




Re: NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant [message #545082 is a reply to message #544954] Tue, 06 July 2010 10:31 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 7/6/10 1:30 AM, hintcnuie wrote:

> BootLoader constants: OS=win32, ARCH=x86, WS=workspace, NL=zh_CN
> Command-line arguments: -application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
> -testApplication org.eclipse.ui.ide.workbench -data workspace
> formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot. setup.AllTest.xml
> formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter
> -testPluginName com.ecilpse.swtbot.setup -className
> com.eclipse.swtbot.setup.AllTest -os win32 -ws workspace -arch x86
> -consoleLog -debug


> !ENTRY org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
> !MESSAGE The following is a complete list of bundles which are not
> resolved, see the prior log entry for the root cause if it exists:
> !SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
> !MESSAGE Bundle
> org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v200905 19 [99] was
> not resolved.
> !SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.870
> !MESSAGE Bundle org.eclipse.swt.win32.win32.x86_3.5.2.v3557f [233] was
> not resolved.
> !SUBENTRY 1 org.eclipse.osgi 2 0 2010-07-06 16:08:06.886
> !MESSAGE Bundle org.eclipse.ui.win32_3.2.100.v20090429-1800 [269] was
> not resolved.

Ok, so it seems that the headless runner is unable to resolve your
launcher and swt bundles. This happens if the os, ws and arch params are
set incorrectly.

Also I see a typo on the 'testPluginName' param being passed.

> <property name="os" value="win32"/>
> <property name="ws" value="workspace"/>
> <property name="arch" value="x86"/>

Here, ws stands for windowing system and not workspace. It should be
win32 and not the path to a workspace :)

-- Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant [message #545194 is a reply to message #545082] Wed, 07 July 2010 01:32 Go to previous messageGo to next message
hintcnuie  is currently offline hintcnuie
Messages: 7
Registered: July 2010
Junior Member
Thanks very much for your apply!

I've made a changes to the build file and it succeeded for the first time, although I don't know what's the meaning of this sentence "Also I see a typo on the 'testPluginName' param being passed.".

And now, the eclipse can start from the command line with ant, but it met another issue that the test plugin is not found when I run the build file again and again..., error message is as follows
Buildfile: D:\EclipseRCP\swtbot\build.xml

init:

instrument:
   [delete] Deleting: D:\EclipseRCP\swtbot\com.ecilpse.swtbot.setup.ser
[cobertura-instrument] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Instrumenting 0 files
[cobertura-instrument] Cobertura: Saved information on 0 classes.
[cobertura-instrument] Instrument time: 94ms

suite:

init:

swtbot-test:

java-test:
     [echo] ======================================
     [echo] Running swtbot junit tests in com.eclipse.swtbot.setup.AllTest
     [echo] Command line args are     -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication        -testApplication org.eclipse.ui.ide.workbench    -data workspace    formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot.setup.AllTest.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter    -testPluginName com.ecilpse.swtbot.setup    -className com.eclipse.swtbot.setup.AllTest    -os win32    -ws workspace    -arch x86    -consoleLog    -debug
     [echo] JVM args are  -Xms128M -Xmx368M -XX:MaxPermSize=256M -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar  -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar
     [echo] JUnit Result File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.xml.
     [echo] Console output File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt.
     [echo] ======================================
     [echo] ======================================
     [echo] If you see errors above please see the file D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt for more information.
     [echo] Errors are generally caused by missing or incorrect dependencies.
     [echo] ======================================

collect-results:
    [style] Warning: the task name <style> is deprecated. Use <xslt> instead.
    [style] Transforming into D:\EclipseRCP\eclipse\results

test-coverage:
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 265ms
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 109ms

run:

collect:
[junitreport] the file D:\EclipseRCP\eclipse\artifacts.xml is not a valid testsuite XML document
[junitreport] the file D:\EclipseRCP\eclipse\com.ecilpse.swtbot.setup.xml is not a valid testsuite XML document

BUILD SUCCESSFUL
Total time: 17 seconds
Buildfile: D:\EclipseRCP\swtbot\build.xml

init:

instrument:
   [delete] Deleting: D:\EclipseRCP\swtbot\com.ecilpse.swtbot.setup.ser
[cobertura-instrument] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Instrumenting 0 files
[cobertura-instrument] Cobertura: Saved information on 0 classes.
[cobertura-instrument] Instrument time: 94ms

suite:

init:

swtbot-test:

java-test:
     [echo] ======================================
     [echo] Running swtbot junit tests in com.eclipse.swtbot.setup.AllTest
     [echo] Command line args are     -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication        -testApplication org.eclipse.ui.ide.workbench    -data workspace    formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:/EclipseRCP/eclipse/com.eclipse.swtbot.setup.AllTest.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter    -testPluginName com.ecilpse.swtbot.setup    -className com.eclipse.swtbot.setup.AllTest    -os win32    -ws win32    -arch x86    -consoleLog    -debug
     [echo] JVM args are  -Xms128M -Xmx368M -XX:MaxPermSize=256M -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar  -Dnet.sourceforge.cobertura.datafile=D:\EclipseRCP\swtbot/com.ecilpse.swtbot.setup.ser -Xbootclasspath/p:.//cobertura-1.9.4.1/cobertura.jar
     [echo] JUnit Result File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.xml.
     [echo] Console output File: D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt.
     [echo] ======================================
     [java] java.lang.Exception: Could not find plugin "com.ecilpse.swtbot.setup"
     [java] 	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.loadSuiteClass(EclipseTestRunner.java:303)
     [java] 	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.getTest(EclipseTestRunner.java:239)
     [java] 	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.<init>(EclipseTestRunner.java:222)
     [java] 	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.run(EclipseTestRunner.java:206)
     [java] 	at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication.runTests(UITestApplication.java:115)
     [java] 	at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
     [java] 	at java.lang.Thread.run(Thread.java:735)
     [echo] ======================================
     [echo] If you see errors above please see the file D:/EclipseRCP/eclipse/results/com.eclipse.swtbot.setup.AllTest.txt for more information.
     [echo] Errors are generally caused by missing or incorrect dependencies.
     [echo] ======================================

collect-results:
    [style] Warning: the task name <style> is deprecated. Use <xslt> instead.
    [style] Transforming into D:\EclipseRCP\eclipse\results

test-coverage:
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 500ms
[cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 0 classes.
[cobertura-report] Report time: 172ms

run:

collect:
[junitreport] the file D:\EclipseRCP\eclipse\artifacts.xml is not a valid testsuite XML document
[junitreport] the file D:\EclipseRCP\eclipse\com.ecilpse.swtbot.setup.xml is not a valid testsuite XML document

BUILD SUCCESSFUL
Total time: 34 seconds




and now the successful build file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="testsuite" default="run" basedir=".">
    <property name="eclipse-home" value="D:/EclipseRCP/eclipse" />
    <property name="plugin-under-test" value="com.ecilpse.swtbot.setup" />
    <property name="plugin-name" value="com.ecilpse.swtbot.setup" />
	<property name="test-classname"   value="com.eclipse.swtbot.setup.AllTest"/>
	<property name="all.buildId" value="2.0.0.568-dev-e35"/>
	<property name="build.base"  value="./"/>
	<property name="results.dir" value="./result"/>
    <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_${all.buildId}/library.xml"/>

	<property name="build.instrumentation.reports.dir" value="${results.dir}/${plugin-name}/coverage/html" />
	<property name="build.instrumentation.reports.xml.dir" value="${results.dir}/${plugin-name}/coverage/xml" />

	<property name="cobertura.data.file" value="${basedir}/${plugin-name}.ser" />
	
	<target name="init">
		<tstamp />
		<delete>
			<fileset dir="${eclipse-home}" includes="org*.xml" />
			<fileset dir="${eclipse-home}/workspace" includes="*.*"/>
			<fileset dir="${eclipse-home}/results" includes="*.*"/>
		</delete>
		<mkdir dir="${results.dir}/${plugin-name}/coverage"></mkdir>
		
	</target>

	<path id="cobertura.classpath">
		<fileset dir="${build.base}/cobertura-1.9.4.1">
			<include name="cobertura.jar" />
			<include name="lib/**/*.jar" />
		</fileset>
	</path>

	<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

	<target name="instrument">
		<delete file="${cobertura.data.file}" />

		<cobertura-instrument datafile="${cobertura.data.file}">
			<fileset dir="${eclipse-home}/plugins">
				<include name="${plugin-under-test}_1.0.0.201007061523.jar" />
			</fileset>
		</cobertura-instrument>
	</target>

    <target name="suite">

    	<condition property="jvmOption" value="-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Dnet.sourceforge.cobertura.datafile=${cobertura.data.file} -Xbootclasspath/p:${build.base}/cobertura-1.9.4.1/cobertura.jar">
			<os family="mac" />
		</condition>

		<property name="jvmOption" value="-Dnet.sourceforge.cobertura.datafile=${cobertura.data.file} -Xbootclasspath/p:${build.base}/cobertura-1.9.4.1/cobertura.jar" />


    	<property name="temp-workspace" value="workspace" />
        <delete dir="${temp-workspace}" quiet="true" />

    	<!-- remove junit3 fragment -->
    	<delete dir="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit3.headless_${all.buildId}" />
    	<delete dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.ant.optional.junit3_${all.buildId}.jar"/>

    	<ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${temp-workspace}" />
            <property name="testApplication" value="org.eclipse.ui.ide.workbench" />
            <property name="plugin-name" value="${plugin-name}" />
            <property name="classname" value="${test-classname}" />
			<property name="os" value="win32"/>
			<property name="ws" value="win32"/>
			<property name="arch" value="x86"/>			
            <property name="vmargs" value=" -Xms128M -Xmx368M -XX:MaxPermSize=256M ${jvmOption}" />
        </ant>
    </target>

	<target name="test-coverage">
		<cobertura-report format="html" destdir="${build.instrumentation.reports.dir}" srcdir="${build.base}/plugins/${plugin-under-test}/src" datafile="${cobertura.data.file}" />
		<cobertura-report format="xml" destdir="${build.instrumentation.reports.xml.dir}" srcdir="${build.base}/plugins/${plugin-under-test}/src" datafile="${cobertura.data.file}" />
	</target>

	<target name="run" depends="init, instrument, suite, test-coverage">
        <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
            <property name="includes" value="*.xml" />
            <property name="output-file" value="${plugin-name}.xml" />
        </ant>
    </target>

</project>




Re: NoClassDefFoundError: org.eclipse.swt.SWTError in running headless SWTBot test with Ant [message #545218 is a reply to message #545194] Wed, 07 July 2010 04:29 Go to previous message
hintcnuie  is currently offline hintcnuie
Messages: 7
Registered: July 2010
Junior Member
I've solved that issue. There is an error in the plugin-under-test property, unify that property name, and it will succeeds.
but there is still issue in 'Can't find the test plugin' in console, but when I write a new test plugin and test it, this issue disappear and does not know why.
Previous Topic:Select Item in Treeviewer with SWTBot
Next Topic:How to access buttons inside Editor
Goto Forum:
  


Current Time: Fri Aug 22 00:02:59 EDT 2014

Powered by FUDForum. Page generated in 0.10945 seconds