Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Headless junit4 runner can't find my plug-in
Headless junit4 runner can't find my plug-in [message #528798] Wed, 21 April 2010 15:37 Go to next message
Jeff Johnston is currently offline Jeff Johnston
Messages: 173
Registered: July 2009
Senior Member
I am trying to run my SWTBot test headless on my x86 linux platform. It is able to find the SWTBot junit4 headless plug-in just fine via the eclipse-home environment variable, but SWTBot cannot find my plug-in which I have confirmed is in ${eclipse-home}/plugins as a jar file. It has a release and qualifier added to it, but I figured that SWTBot should be able to find it nonetheless.

The build.xml file is in a temp directory off of the plugins directory which is why I have the ../.. in ${eclipse-home} but I also tried explicitly specifying -Declipse-home on the ant call and that failed as well. SWTBot brings up the Welcome screen then fails with an exception.

The following is my xml file:

<?xml version="1.0"?>

<project name="testsuite" default="run" basedir=".">
        <property name="plugin-name" value="org.eclipse.linuxtools.cdt.autotools.ui.tests" />
    <property name="test-classname" value="AllTests" />
        <!-- The property ${eclipse-home} should be passed into this script -->
        <!-- Set a meaningful default value for when it is not. -->
        <property name="eclipse-home" value="${basedir}/../.." />
        <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.536-dev-e35/library.xml" />


    <!-- This target defines the tests that need to be run. -->
        <target name="suite">
                <property name="temp-workspace" value="workspace" />
                <delete dir="${temp-workspace}" quiet="true" />
                <ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
                        <property name="data-dir" value="${temp-workspace}" />
                        <property name="plugin-name" value="${plugin-name}" />
                        <property name="os" value="linux" />
                        <property name="ws" value="gtk" />
                        <property name="arch" value="x86" />
                        <property name="classname" value="${test-classname}" />
                </ant>
        </target>

        <!-- This target holds code to cleanup the testing environment after -->
        <!-- after all of the tests have been run. You can use this target to -->
        <!-- delete temporary files that have been created. -->
        <target name="cleanup">
        </target>

        <!-- This target runs the test suite. Any actions that need to happen -->
        <!-- after all the tests have been run should go here. -->
        <target name="run" depends="suite, cleanup">
        </target>

    <target name="all" depends="run" description="Dummy target to run all tests">
    </target>


and here is part of the screen output:

[CODE}
[echo] Running swtbot junit tests in AllTests
[echo] Command line args are -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -data workspace formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,/home/jjohnstn/tmp/eclipse/plugins/temp/. ./../AllTests.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter -testPluginName org.eclipse.linuxtools.cdt.autotools.ui.tests -className AllTests -os linux -ws gtk -arch x86 -consoleLog -debug
[echo] JVM args are -Xms256m -Xmx512m
[echo] JUnit Result File: /home/jjohnstn/tmp/eclipse/plugins/temp/../../results/AllTes ts.xml.
[echo] Console output File: /home/jjohnstn/tmp/eclipse/plugins/temp/../../results/AllTes ts.txt.
[echo] ======================================
[java] java.lang.Exception: Could not find plugin "org.eclipse.linuxtools.cdt.autotools.ui.tests"
[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(Work benchTestable.java:71)
[java] at java.lang.Thread.run(libgcj.so.10)
[echo] ======================================
[echo] If you see errors above please see the file /home/jjohnstn/tmp/eclipse/plugins/temp/../../results/AllTes ts.txt for more information.
[echo] Errors are generally caused by missing or incorrect dependencies.
[echo] ======================================
[/CODE]

I looked in the results/AllTests.xml file and there is nothing worth reporting there except some warnings about feature.xml files missing in some features.

Any ideas?
Re: Headless junit4 runner can't find my plug-in [message #528805 is a reply to message #528798] Wed, 21 April 2010 15:53 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Jeff Johnston wrote:
> I am trying to run my SWTBot test headless on my x86 linux platform. It
> is able to find the SWTBot junit4 headless plug-in just fine via the
> eclipse-home environment variable, but SWTBot cannot find my plug-in
> which I have confirmed is in ${eclipse-home}/plugins as a jar file. It
> has a release and qualifier added to it, but I figured that SWTBot
> should be able to find it nonetheless.
>
> The build.xml file is in a temp directory off of the plugins directory
> which is why I have the ../.. in ${eclipse-home} but I also tried
> explicitly specifying -Declipse-home on the ant call and that failed as
> well. SWTBot brings up the Welcome screen then fails with an exception.
>
> The following is my xml file:
>

What very of Eclipse are you testing against?

How did you install your plugin in the plugins folder? If you simply
copy-pasted your jar, this is not gonna work due to p2 (Eclipse 3.4+).
You need to copy-paste the jar in the dropin folder. You could also use
p2 command-line facilities to properly install the plugin, but this is
kinda a lot of work. I haven't been able to properly use those yet...

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: Headless junit4 runner can't find my plug-in [message #530763 is a reply to message #528805] Fri, 30 April 2010 14:15 Go to previous messageGo to next message
Jeff Johnston is currently offline Jeff Johnston
Messages: 173
Registered: July 2009
Senior Member
> What very of Eclipse are you testing against?
>
> How did you install your plugin in the plugins folder? If you simply
> copy-pasted your jar, this is not gonna work due to p2 (Eclipse 3.4+).
> You need to copy-paste the jar in the dropin folder. You could also use
> p2 command-line facilities to properly install the plugin, but this is
> kinda a lot of work. I haven't been able to properly use those yet...

I got this to work. What is needed is to copy just the plugins into the eclipse/plugins folder. I was unzipping the CDT-master zip, the swtbot zip, our update site build zip directly into my eclipse directory and this brought along some other files which gums up the plugin resolution.

I am using Eclipse 3.5.2 and if I unzip swtbot zip files into a temp directory and copy over the plugins into my eclipse, it works ok. I ran into an issue where ant optional junit3 was being brought in by the CDT zip, but removing that solved my problems.
Re: Headless junit4 runner can't find my plug-in [message #531301 is a reply to message #530763] Tue, 04 May 2010 09:28 Go to previous message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Jeff Johnston wrote:
> I got this to work. What is needed is to copy just the plugins into the
> eclipse/plugins folder. I was unzipping the CDT-master zip, the swtbot
> zip, our update site build zip directly into my eclipse directory and
> this brought along some other files which gums up the plugin resolution.
>
> I am using Eclipse 3.5.2 and if I unzip swtbot zip files into a temp
> directory and copy over the plugins into my eclipse, it works ok. I ran
> into an issue where ant optional junit3 was being brought in by the CDT
> zip, but removing that solved my problems.

From p2 documentation [1]:
"Before p2, many Eclipse users circumvented Update Manager and installed
new plug-ins by dumping them in the eclipse/plugins/ directory and
restarting with the -clean command line argument. There are many
drawbacks to this "wild west" approach that we won't get into here, but
suffice it to say that this approach to installation is not recommended."

Also, see the Dropins [2] section of said documentation

[1] http://wiki.eclipse.org/Equinox_p2_Getting_Started#Disk_layo ut
[2] http://wiki.eclipse.org/Equinox_p2_Getting_Started#Dropins

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Previous Topic:RCP with SWTBOT
Next Topic:Having trouble with buttons on Console view toolbar
Goto Forum:
  


Current Time: Wed Jul 23 04:10:08 EDT 2014

Powered by FUDForum. Page generated in 0.02143 seconds