Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Steps to run swtBot test via ant
Steps to run swtBot test via ant [message #37228] Thu, 28 May 2009 18:15 Go to next message
Asif is currently offline Asif
Messages: 11
Registered: July 2009
Junior Member
Hi,

I've developed bunch of test cases which are running fine inside the
Eclipse IDE using "SWTBot Test" plugin. I've achieved the first part of
making gui test cases automated, to achieve 100% gui automation I need to
invoke these test via ant so that I could enable these test cases via
Hudson.

I downloaded the Eclipse test framework and executed the existing test
cases which are bundled with this framework via ant. I would like to know
how to add my test cases which are working fine inside the IDE. I've all
the infrastructure ready w.r.to ant, all I need are the steps to add new
test cases, for e.g
(1) From Eclipse IDE, Export my project as plugins and save it in some
directory.
(2) Add entry's in org.eclipse.swtbot.releng\build.xml
(3) update test.xml file under org.eclipse.swtbot.releng\test-sandbox
w.rto my
plugins tests
(4) Add myPlugin.xml in org.eclipse.swtbot.releng\test-sandbox.

It might be straight forward, unfortunately I'm stuck in these
configuration. Can anyone provide the steps to add a test in the ant
framework? Or share your ant structure with the steps how to add new
tests to your ant framework.

I appreciate your time in advance.
Re: Steps to run swtBot test via ant [message #37262 is a reply to message #37228] Thu, 28 May 2009 20:13 Go to previous messageGo to next message
Asif is currently offline Asif
Messages: 11
Registered: July 2009
Junior Member
I've just tried the following suggestion mentioned at
http://wiki.eclipse.org/SWTBot/Ant

I could able to configure the Headless Testing Framework for running tests
from within ant. It does invokes the eclipse ide with the following
command:

set ECLIPSE_HOME=C:\eclipse_gan_May26\eclipse
set TEST_CLASS=TestSampleDialog

java -Xms128M -Xmx368M -XX:MaxPermSize=256M
-DPLUGIN_PATH=C:\eclipse_gan_May26\eclipse\workspace1 -classpath
%ECLIPSE_HOME%\plugins\org.eclipse.equinox.launcher_1.0.101. R34x_v20081125.jar
org.eclipse.core.launcher.Main -application
org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -data
workspace
formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,%ECLIPSE_HOME%/%TEST_CLASS%.xml
formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter
-testPluginName TestswtBot -className %TEST_CLASS% -arch x86 -consoleLog
-debug

I got the following error, any clue/idea why TestswtBot plugin is not able
to find during execution. Yes my plugin is saved under
C:\eclipse_gan_May26\eclipse\workspace1

------------------------------------------------------------ ------------------
error message="java.lang.Exception: Could not find plugin "TestswtBot""
type=" org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException ">
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException:
java.lang.Exception: Could not find plugin "TestswtBot"
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .runFailed(EclipseTestRunner.java:289)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:242)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner . <init>(EclipseTestRunner.java:222)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:206)
at
org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:190)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: Could not find plugin "TestswtBot"
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .loadSuiteClass(EclipseTestRunner.java:303)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:239)
Re: Steps to run swtBot test via ant [message #37330 is a reply to message #37262] Fri, 29 May 2009 03:15 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
You need to first build your plugin(s) and drop them into an eclipse
installation for this to work.

-- Ketan

On 29/5/09 01:43, Asif wrote:
> I've just tried the following suggestion mentioned at
> http://wiki.eclipse.org/SWTBot/Ant
>
> I could able to configure the Headless Testing Framework for running
> tests from within ant. It does invokes the eclipse ide with the
> following command:
>
> set ECLIPSE_HOME=C:\eclipse_gan_May26\eclipse
> set TEST_CLASS=TestSampleDialog
>
> java -Xms128M -Xmx368M -XX:MaxPermSize=256M
> -DPLUGIN_PATH=C:\eclipse_gan_May26\eclipse\workspace1 -classpath
> %ECLIPSE_HOME%\plugins\org.eclipse.equinox.launcher_1.0.101. R34x_v20081125.jar
> org.eclipse.core.launcher.Main -application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -data
> workspace
> formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,%ECLIPSE_HOME%/%TEST_CLASS%.xml
> formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter
> -testPluginName TestswtBot -className %TEST_CLASS% -arch x86 -consoleLog
> -debug
>
> I got the following error, any clue/idea why TestswtBot plugin is not
> able to find during execution. Yes my plugin is saved under
> C:\eclipse_gan_May26\eclipse\workspace1
>
> ------------------------------------------------------------ ------------------
>
> error message="java.lang.Exception: Could not find plugin "TestswtBot""
> type=" org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException ">
>
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException:
> java.lang.Exception: Could not find plugin "TestswtBot"
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .runFailed(EclipseTestRunner.java:289)
>
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:242)
>
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner . <init>(EclipseTestRunner.java:222)
>
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:206)
>
> at
> org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:190)
>
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
>
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.Exception: Could not find plugin "TestswtBot"
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .loadSuiteClass(EclipseTestRunner.java:303)
>
> at
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:239)
>
>
>
>
>
Re: Steps to run swtBot test via ant [message #37398 is a reply to message #37330] Fri, 29 May 2009 07:06 Go to previous messageGo to next message
Asif is currently offline Asif
Messages: 11
Registered: July 2009
Junior Member
Great, plugin not found error is resolved. Do I have to set the
classpath to find the test classes? Before I export my plugin, I built it
and I see com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog under my
plugin\bin directory. What config might be missing?

Thanks Ketan for your suggestion, I'm almost getting there... Following
error for your reference.

Application Started: 12735
Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
Testsuite: com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

Caused an ERROR
Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException
: Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .runFaile
d(EclipseTestRunner.java:284)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(
EclipseTestRunner.java:246)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner . <init>(E
clipseTestRunner.java:222)
at
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(Ecli
pseTestRunner.java:206)
at
org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests
(UITestApplication.java:190)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTest
able.java:68)
at java.lang.Thread.run(Unknown Source)
Re: Steps to run swtBot test via ant [message #37432 is a reply to message #37398] Fri, 29 May 2009 07:17 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Are you pointing -className to AllTests similar to what SWTBot uses[1] ?

Setting -className to a TestCase will not work.

[1] -
http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ AllTests.java

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr


On 29/5/09 12:36, Asif wrote:
> Great, plugin not found error is resolved. Do I have to set the
> classpath to find the test classes? Before I export my plugin, I built
> it and I see com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog under my
> plugin\bin directory. What config might be missing?
> Thanks Ketan for your suggestion, I'm almost getting there... Following
> error for your reference.
>
> Application Started: 12735
> Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
> Testsuite: com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog
> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>
> Caused an ERROR
> Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
> org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException
>
> : Class not found "com.sun.jbi.qe.gui.ide.fuji.test.TestSampleDialog"
> at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .runFaile
> d(EclipseTestRunner.java:284)
> at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(
> EclipseTestRunner.java:246)
> at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner . <init>(E
> clipseTestRunner.java:222)
> at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(Ecli
> pseTestRunner.java:206)
> at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests
> (UITestApplication.java:190)
> at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTest
> able.java:68)
> at java.lang.Thread.run(Unknown Source)
>
Re: Steps to run swtBot test via ant [message #37772 is a reply to message #37432] Fri, 29 May 2009 15:58 Go to previous message
Asif is currently offline Asif
Messages: 11
Registered: July 2009
Junior Member
Hi Ketan,

Yes, I'm pointing AllTests to -className, but it unable to find the
AllTests.class file itself. Is there any clue to debug this class exist
during execution time? -debug options doesn't give much information.

--Asif.
Previous Topic:SWTBotPreferences
Next Topic:Invalid link to zipped update site
Goto Forum:
  


Current Time: Sun Oct 26 03:56:40 GMT 2014

Powered by FUDForum. Page generated in 0.01844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software