Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Problem with automatic (headless) build and test with eclipse test framework

Thread view: 
andreas.h@everymail.net - 16 Aug 2007 08:46 GMT
Hi,

I've got a tricky problem with my automated build and test.  I want to
set up an automated build server for my project and I want to build
and test my eclipse-plugins with the eclipse testing framework (see
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/testframework.html?view=co).
I'm using java 1.5, ant 1.7, eclipse 3.2.1 (both as development
environment and target platform) and the eclipse testing framework on
a windows XP machine.

So far so good. The automatic build of my plug-ins runs without
problems and my plugins get packaged. Then my build-script copies a
complete Eclipse-SDK in a test-folder and copies the newly built plug-
ins there. Then I call the eclipse platform from my ant script (but
the following error also occurs if I start it from the commandline)
and call the ui or core-test-application provided by the eclipse-test-
framework. I also specify the plugin with the test and also the
testclass itself. Below I will show the java-call and the setting of
the properties:

 <target name="core-test">
    <antcall target="eclipse-test">
     <param name="application"
value="org.eclipse.test.coretestapplication"/>
    </antcall>
 </target>

 <target name="eclipse-test">
    <!--
    Parameters to this target:
    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
    vmargs            - a string containing arguments to pass to the VM - defaults
to ""
    -->
    <tstamp>
        <format property="TIMENOW" pattern="HHmmssSSSS"/>
    </tstamp>
    <!--set default heap sizes when running performance tests-->
    <condition property="vmargs" value=" -Xms256M -Xmx256M">
    <equals arg1="${test.target}" arg2="performance" />
    </condition>
    <property name="vmargs" value=""/>
    <property name="formatter"
value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/

    <property name="extraVMargs" value=""/>
    <property name="plugin-path" value="" />
    <property name="timeout" value="7200000" />
    <property name="test-output" value="output.xml" /> <!-- This file is
not used anymore! Only the parent directory is relevant  -->
    <property name="test-application"
value="org.eclipse.test.uitestapplication" />
    <property name="includePattern" value="**/*Test.class" />
    <property name="excludePattern" value="" />
    <property name="failonerror" value="false" />
    <property name="testlistener"
value="org.eclipse.test.XMLTestListener"/>

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

    <!--Load value for eclipse.buildId from the config.ini file-->
    <property file="${eclipse-home}/configuration/config.ini" />

    <echo message="Running test from ${plugin-name} class ${testclass-
name}"/>

    <echo message="${application} ${data-dir} ${plugin-name} ${testclass-
name} ${extraVMargs} ${plugin-path}" />

    <!-- Produces the file '${default-filename}' -->
    <java jar="${eclipse-home}/startup.jar" logerror="true" fork="true"
dir="."
        timeout="${timeout}" jvm="${jvm}" failonerror="${failonerror}">
        <arg line="-application ${application}"/>
        <arg line="-data ${data-dir}"/>
        <arg line="-formatter=${formatter},${test-output}"/>
        <arg line="-testpluginname ${plugin-name}"/>
        <arg line="-classname ${classname}"/>
        <arg line="-os ${os}"/>
        <arg line="-ws ${ws}"/>
        <arg line="-arch ${arch}"/>
    </java>
 </target>

My problem is this, that everytime I start this the java call returns
1, indicating that a test case went wrong. I've added debug statements
and I saw that the Activator of my test-plugin was called but not the
test-class and the testmethod itself. Although I specified the plugin-
name and classname. I've checked everything I can think of, the plugin
is in the target-eclipse-platform, the plugin-name and classname are
correctly spelled. I tried some variations of the call parameters. I
called the platform from within another eclipse, I called it from the
commandline always return 1! And I don't understand why my testcase
isn't called, as I made the call excatly as it is specified in the
manual (http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/
testframework.html?view=co).

I hope someone out there can help me or at least give me a useful hint
as I'm at my wit's end I cannot think of something else to try.

Yours
Andreas Schweitzer
suchandra_nag@hotmail.com - 19 Aug 2007 05:06 GMT
I am also facing the same problem, if it is fixed for you, could you
please let me know ?

thanks,
Suchandra
suchandra_nag@hotmail.com - 20 Aug 2007 12:54 GMT
I was trying with "org.eclipse.test.uitestapplication" and I had to
use the follwing arguments to run my test case from my test plugin
which would run in the context of my application..

        <property name="launcher" value="org.eclipse.core.launcher.Main" />
        <echo message="Running ${classname}" />

              <java classname="${launcher}" fork="true" dir="$
{workspace}" failonerror="true" logerror="true">
            <classpath>
                <pathelement location="${workspace}/startup.jar" />
            </classpath>
            <assertions>
                <enable />
            </assertions>

           <arg line="-application org.eclipse.test.uitestapplication"/>
        <arg line="-testApplication {my_application_name}"/>
           <arg line="-product ${my_product_name}"/>
           <arg line="-data ${data-dir}"/>
           <arg line="-testpluginname ${test.plugin.name}"/>
           <arg line="formatter=${formatter},${test.class.name}.xml"/>
        <arg line="-classname ${test.class.name}"/>
          <arg line="-os ${baseos}" />
        <arg line="-ws ${basews}" />
        <arg line="-arch ${basearch}" />
           <jvmarg line="${vmargs} ${extraVMargs}"/>
           <sysproperty key="PLUGIN_PATH" value="${plugin-path}"/>
    </java>

 Hope this helps as this was not properly documented.

Thanks,
Suchandra
andreas.h@everymail.net - 27 Aug 2007 09:22 GMT
I've already solved this problem.

After I've tried lots of things and changed lots of things in hope for
solving the problem, I thought it would be best to take a step back
and try again. So I replaced my changed verson of library.xml with the
original one (with the original java-call) and it worked!

yours
Andreas

> I was trying with "org.eclipse.test.uitestapplication" and I had to
> use the follwing arguments to run my test case from my test plugin
[quoted text clipped - 30 lines]
> Thanks,
> Suchandra


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.