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

Discussion in 'Java' started by andreas.h@everymail.net, Aug 16, 2007.

  1. Guest

    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
    , Aug 16, 2007
    #1
    1. Advertising

  2. Guest

    I am also facing the same problem, if it is fixed for you, could you
    please let me know ?

    thanks,
    Suchandra
    , Aug 19, 2007
    #2
    1. Advertising

  3. Guest

    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
    , Aug 20, 2007
    #3
  4. Guest

    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

    On 20 Aug., 13:54, wrote:
    > 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
    , Aug 27, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    749
    Guest
    Jun 29, 2004
  2. Sandman
    Replies:
    1
    Views:
    871
    Lynn Robinson
    Jul 14, 2003
  3. Marco Schmidt
    Replies:
    2
    Views:
    424
    Marco Schmidt
    Sep 4, 2003
  4. Andres Medina
    Replies:
    3
    Views:
    5,205
    Mark Scott
    Nov 11, 2004
  5. Replies:
    0
    Views:
    512
Loading...

Share This Page