Running Tests from Ant Script, Using Eclipse 3.6

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Running Tests from Ant Script, Using Eclipse 3.6

Postby eren.aykin » Sun Oct 03, 2010 6:49 am

Hi all,

I am trying to automate my WindowTester Unit tests by ruinning them from an ant script. I tried to alter the example given in wt-commons, under the org.wtc.samples.releng.
My tests runs fine when I run them under eclipse as "JUnit plug-in test".
I am trying to run the tests with the approach described here: http://www.eclipse.org/articles/article ... index.html

I have configured the classpath settings in the ant script so that it has the same classpath that eclipse uses when running the unit tests. "@dot.classpath" in the following snipped was created using the eclipse PDE tool.

My script contains the following targets:

Code: Select all
      
<target name="test2">
      <java classname="com.x.test.utils.PDETestPortLocator" fork="yes">
         <classpath>
            <path location="bin/"/>
         </classpath>
      </java>
      <waitfor maxwait="10" maxwaitunit="second" checkevery="100" checkeveryunit="millisecond">
         <available file="pde_test_port.properties"/>
      </waitfor>
      <property file="pde_test_port.properties"/>
      <echo message="Using port ${pde.test.port} for listening to PDE Test run"/>
      <parallel>
         <daemons>
            <antcall target="run_pde_test_listener"/>
         </daemons>
         <sequential>
            <sleep seconds="5"/>
            <!-- Give the listener a few seconds to start up -->
            <antcall target="run_pde_tests"/>
         </sequential>
      </parallel>
   </target>

   <property name="plugin.name" value="com.x.test.scenarios.WorkflowTestSuite"/>

   <target name="run_pde_test_listener">
      <java classname="com.x.test.utils.PDETestResultsCollector" fork="yes" >
         <sysproperty key="DEBUG" value="true"/>
         <arg line="${plugin.name} ${pde.test.port}"/>
         <jvmarg value="-Duser=admin -Dpasswd=admin" />
         <classpath>
            <path location="../../helios-swt4Copy2/plugins/org.junit_3.8.2.v3_8_2_v20100427-1100/junit.jar"/>
            <path location="../../helios-swt4Copy2/plugins/org.eclipse.jdt.junit.core_3.6.0.v20100526-0800.jar"/>
            <path refid="@dot.classpath"/>
            <path location="C:/apache-ant-1.8.0/lib/ant.jar"/>
            <path location="C:/apache-ant-1.8.0/lib/ant-junit.jar"/>
            <path location="bin/"/>
         </classpath>
      </java>
   </target>

   <property name="plugin.dir" value="C:/ide/helios-swt4Copy2/plugins"/>
   <property name="test.reports.dir" value="C:/ide/helios-swt4Copy2/testReports"/>
   <property name="test.classes.list" value="com.x.test.utils.WorkFlowTestSuite"/>

   <target name="run_pde_tests" >
      <mkdir dir="${test.reports.dir}/output/ws"/>
      <java dir="${plugin.dir}" classname="org.eclipse.equinox.launcher.Main" fork="yes" >
         <arg line="-application com.windowtester.runner.application -product com.x.client.product -data ${test.reports.dir}/output/ws -dev bin -clean -port ${pde.test.port} -testpluginname com.x.client.swt -classnames ${test.classes.list} -verbose "/>

         <classpath>
            <path refid="@dot.classpath"/>
            <path location="C:/apache-ant-1.8.0/lib/ant-junit.jar"/>
            <path location="C:/apache-ant-1.8.0/lib/ant.jar"/>
            <path location="../../helios-swt4Copy2/plugins/org.eclipse.jdt.junit.core_3.6.0.v20100526-0800.jar"/>
            <path location="../../helios-swt4Copy2/plugins/org.junit_3.8.2.v3_8_2_v20100427-1100/junit.jar"/>

            <path location="bin/"/>

            <fileset dir="../../helios-swt4Copy2/plugins"
                    includes="org.eclipse.equinox.launcher_*.jar,
                        org.eclipse.equinox.p2.metadata.generator_*.jar"/>
         </classpath>
      </java>
   </target>


This produces the following result:
>ant test2
Buildfile: ..\build.xml

test2:
[java] PDE Test port: 52146
[java] PDE Test port saved to file c:\ide\workspace_helios_swt4Copy2\com.x.client.swt\pde_test_port.properties
[echo] Using port 52146 for listening to PDE Test run

run_pde_test_listener:
[java] Listening on port 52146 for test suite com.x.test.scenarios.WorkflowTestSuite results ...

run_pde_tests:
[java] An error has occurred. See the log file
[java] ...\configuration\1286114715600.log.
[java] Java Result: 13

BUILD SUCCESSFUL
Total time: 12 seconds


In the mentioned log file I always get the same error message:
!SESSION 2010-10-03 15:05:15.044 -----------------------------------------------
eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Framework arguments: -application com.windowtester.runner.application -product com.x.client.product -port 52146 -testpluginname com.x.client.swt -classnames com.x.test.utils.WorkFlowTestSuite -verbose
Command-line arguments: -application com.windowtester.runner.application -product com.x.client.product -data C:/ide/helios-swt4Copy2/testReports/output/ws -dev bin -clean -port 52146 -testpluginname com.x.client.swt -classnames com.x.test.utils.WorkFlowTestSuite -verbose

This is a continuation of log file C:\ide\helios-swt4Copy2\configuration\1286114715600.bak_0.log
Created Time: 2010-10-03 15:05:18.294

!ENTRY org.eclipse.equinox.registry 4 0 2010-10-03 15:05:18.295
!MESSAGE Could not parse XML contribution for "org.eclipse.pde.junit.runtime//plugin.xml". Any contributed extensions and extension points will be ignored.
!STACK 0
org.xml.sax.SAXException: Could not acquire XML parsing service.
at org.eclipse.core.internal.registry.ExtensionsParser.parseManifest(ExtensionsParser.java:392)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1061)
...
!ENTRY org.eclipse.equinox.registry 4 0 2010-10-03 15:05:18.298
!MESSAGE Could not parse XML contribution for "org.eclipse.pde.launching//plugin.xml". Any contributed extensions and extension points will be ignored.
!STACK 0
org.xml.sax.SAXException: Could not acquire XML parsing service.
at org.eclipse.core.internal.registry.ExtensionsParser.parseManifest(ExtensionsParser.java:392)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1061)
...
!ENTRY org.eclipse.equinox.registry 4 0 2010-10-03 15:05:18.300
!MESSAGE Could not parse XML contribution for "org.eclipse.pde.runtime//plugin.xml". Any contributed extensions and extension points will be ignored.
!STACK 0
org.xml.sax.SAXException: Could not acquire XML parsing service.
at org.eclipse.core.internal.registry.ExtensionsParser.parseManifest(ExtensionsParser.java:392)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1061)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1039)
at org.eclipse.core.internal.registry.osgi.EclipseBundleListener.addBundle(EclipseBundleListener.java:184)
...
!ENTRY org.eclipse.equinox.registry 4 0 2010-10-03 15:05:18.304
!MESSAGE Could not parse XML contribution for "org.eclipse.pde.ua.core//plugin.xml". Any contributed extensions and extension points will be ignored.
!STACK 0
org.xml.sax.SAXException: Could not acquire XML parsing service.
at org.eclipse.core.internal.registry.ExtensionsParser.parseManifest(ExtensionsParser.java:392)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1061)
at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1039)
...


I couldn't find a proper way of runnung com.windowtester.runner.application from an ant script.
What ever change I make in the build script and classpath configuration, I always get the same SAXException.
I am using Eclipse 3.6 and the jdk that ant uses is jdk1.6.0_20.
I would appreciate any help regarding this issue.

Regards.
Last edited by eren.aykin on Tue Oct 05, 2010 9:47 am, edited 2 times in total.
eren.aykin
 
Posts: 3
Joined: Thu Sep 09, 2010 6:45 am

Re: SAXException when trying to run tests from Ant script

Postby eren.aykin » Tue Oct 05, 2010 9:03 am

After a little struggling, I saw this discussion: http://stackoverflow.com/questions/1016 ... ars-api-in
and applied the suggestion: "remove any JAR containing a SAXParserFactoryImpl class from your build path (user libs)." I suppose this enables using of jdk's own sax parser. SAXException's are not thrown any more.

However I have a problem running my product, which I need to run my tests on.

this ant target produces the following osgi console error, and it brings up an empty workbench instead of the product I specify with the "testProduct" parameter:

<target name="run_pde_tests" >
<mkdir dir="${test.reports.dir}/output/ws"/>
<java dir="${plugin.dir}" classname="org.eclipse.equinox.launcher.Main" fork="yes" >
<arg line="-clean -application com.windowtester.runner.application -data ${test.reports.dir}/output/ws -dev bin -port ${pde.test.port} -testpluginname com.x.client.swt -classname WorkFlowTestSuite -verbose -console -testProduct com.x.client.product"/>

<classpath>
<path location="../../helios-swt4Copy2/plugins/org.junit_3.8.2.v3_8_2_v20100427-1100/junit.jar"/>
<path location="../../helios-swt4Copy2/plugins/org.eclipse.jdt.junit.core_3.6.0.v20100526-0800.jar"/>
<path refid="@dot.classpath"/>
<path location="C:/apache-ant-1.8.0/lib/ant.jar"/>
<path location="C:/apache-ant-1.8.0/lib/ant-junit.jar"/>
<path location="bin/"/>
<fileset dir="../../helios-swt4Copy2/plugins"
includes="org.eclipse.equinox.launcher_*.jar,
org.eclipse.equinox.p2.metadata.generator_*.jar"/>
</classpath>
</java>
</target>


run_pde_tests:
[java]
[java] osgi> java.lang.RuntimeException: Failed to find products extension for com.x.client.product
[java] at com.windowtester.runner.LocalTestRunner.fail(LocalTestRunner.java:245)
[java] at com.windowtester.runner.LocalTestRunner.getProductApplication(LocalTestRunner.java:221)
[java] at com.windowtester.runner.LocalTestRunner.run(LocalTestRunner.java:70)
[java] at com.windowtester.runner.WindowTesterRunner.run(WindowTesterRunner.java:34)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
[java] at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
[java] at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
[java] at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
[java] at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

BUILD SUCCESSFUL
Total time: 14 seconds


How can I tell windowtester runner to run a product instead of the eclipse workbench before running the tests?
eren.aykin
 
Posts: 3
Joined: Thu Sep 09, 2010 6:45 am

Re: Running Tests from Ant Script, Using Eclipse 3.6

Postby keertip » Wed Oct 06, 2010 12:14 pm

Looking at the error message

[java] osgi> java.lang.RuntimeException: Failed to find products extension for com.x.client.product


Does your application define a product extension?
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron