|
|
Re: How to launch my SWTbot tests from console? [message #1066453 is a reply to message #1062249] |
Tue, 02 July 2013 17:19   |
Eclipse User |
|
|
|
Hello,
I coded some tests (SWTBOT/JUNIT) for a RCP. The point is I want to run these tests out from using Eclipse, i.e by launching a script .bat. So I wrote this test.bat :
@echo off
set JAVA_HOME="C:\Program Files (x86)\Java\jre6"
set JAVA_START="C:\Program Files (x86)\Java\jre6\bin\java"
set ED_HOME="C:\Tools\Orc\Desk"
set TEST_CLASS=taskBox.AllTests
set WORKSPACE="D:\Users\0145268\workspace_dev"
set TEST_PRODUCT_ID=com.yahourt.orc.desk.orc
set TEST_PLUGIN_ID=com.yahourt.tp.TEST
set PERSPECT=com.yahourt.foca.perspectiveDesk
set OS=win32
set WS=win32
set ARCH=x86
set NL=fr_FR
set CMD=%JAVA_START% ^
-Xms256M ^
-Xmx256M ^
-XX:MaxPermSize=512M ^
-Dcom.yahourt.tp.context=V:\STRAP\PROJECT\CONTEXTS\ATEST\ldp_ATEST ^
-Dcom.yahourt.tp.product=TstLP ^
-Dorg.eclipse.swtbot.generator.enable=true ^
-DTEMP=D:\temp\0145268 ^
-classpath %ED_HOME%\plugins\org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar ^
org.eclipse.core.launcher.Main ^
-application org.eclipse.pde.junit.runtime.nonuithreadtestapplication ^
-testApplication %TEST_PRODUCT_ID% ^
-testPluginName %TEST_PLUGIN_ID% ^
-classNames %TEST_CLASS% ^
-os %OS% ^
-consoleLog -debug ^
-fork=false ^
-ws %WS% ^
-arch %ARCH% ^
-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader ^
-loaderpluginname org.eclipse.jdt.junit.runtime ^
-defaultLoadProject=V:\STRAP\PROJECT\ENG_DESK\PROJECTS\ATEST ^
-perspective %PERSPECT% ^
-version 3 ^
-port 1102 ^
-data "D:\Users\0145268\junit-workspace" ^
-dev file:D:\Users\0145268\workspace_dev\.metadata\.plugins\org.eclipse.pde.core\pde-junit\dev.properties ^
-configuration "D:\Users\0145268\workspace_dev\.metadata\.plugins\org.eclipse.pde.core\pde-junit\"
%CMD% >> D:\Users\0145268\TOTO.TXT
pause
I put the .jar of test (com.yahourt.tp.TEST.jar) in C:\Tools\Orc\Desk\plugins.
When I run this script, the RCP is launching but I cannot see any tests running. Moreover nothing in TOTO.TXT mentions my "com.yahourt.tup.TEST" package. My clue may be that I miss one option after "-testApplication"...
To write this script, I follow your link and read the .log from the workspace of test (I used for tests).
I would be very grateful for your help !
Thanks
|
|
|
Re: How to launch my SWTbot tests from console? [message #1066558 is a reply to message #1066453] |
Wed, 03 July 2013 07:32   |
Eclipse User |
|
|
|
I see several issues here, which show you did not really use the
documentation ;)
On 07/02/2013 09:27 PM, Lycris Ras wrote:
> -Dorg.eclipse.swtbot.generator.enable=true ^
You should not set this to execute automated tests
> -application
> org.eclipse.pde.junit.runtime.nonuithreadtestapplication ^
I generally use the
org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication (as
described in documentation), and I don't know much about the
configuration of the nonuithreadtestapplication
> I put the .jar of test (com.yahourt.tp.TEST.jar) in
> C:\Tools\Orc\Desk\plugins.
> When I run this script, the RCP is launching but I cannot see any tests
> running. Moreover nothing in TOTO.TXT mentions my "com.yahourt.tup.TEST"
> package. My clue may be that I miss one option after "-testApplication"...
It seems to me that your jar is not correctly installed, so classes
can't be found. Directly copying bundles in plugins/ is something that
has been deprecated for years. Instead, you should use p2 director [1]
to install your jar in the Eclipse instance which is hosting your test
execution. Alternatively, you can use the dropins/ folder [2].
Most people reporting issues with SWTBot test execution actually have
issues to set up a right Eclipse configuration for their test and fail
to install their own bundles. To debug that, you can use the OSGi
console [3] and check whether bundles are available/installed/started.
HTH
[1]
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html&resultof=%22p2%22%20%22director%22
[2]
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html
[3] http://www.ibm.com/developerworks/library/os-ecl-osgiconsole/
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
|
|
|
Re: How to launch my SWTbot tests from console? [message #1066737 is a reply to message #1066558] |
Thu, 04 July 2013 07:44   |
Eclipse User |
|
|
|
Thanks for your help !
Actually I did a wrong configurations with my tests (different versions of the RCP were used).
So now the test plugin is well-recognized by the RCP, launching by the .bat (according to the RCP plugin menu).
But the tests don't start at all.
I use org.eclipse.pde.junit.runtime.nonuithreadtestapplication because I run my test in eclipse with JUnit plugin test without the "Run in UI thread" checked.
I glanced to your links. I forgot to tell you that I have no writing right in the eclipse platform (i.e ED_HOME="C:\Tools\Orc\Desk", I cannot use dropins directory). And btw, I told you something wrong, I put the test.jar in "V:\STRAP\WORKSHOP\ENG_DESK\PLUGINS\com.yahourt.tp\eclipse\plugins". But we don't care about it.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1067118 is a reply to message #1066737] |
Sat, 06 July 2013 00:37   |
Eclipse User |
|
|
|
Finally I succeeded to run my project. I trigger an Ant script with the batch script. Here is my build.xml :
<?xml version="1.0"?>
<project name="Ant-Test" basedir=".">
<property name="test.workspace" location="D:/Users/0145268/junit-workspace" />
<property name="testcase" location="taskBox.AllTests" />
<property name="testplugin" location="com.yahourt.tp.TEST" />
<property name="build.home" location="C:/Tools/Orc/Eclipse_Dev_400/eclipse" />
<property name="build.plugins" location="W:/STRAP/WORKSHOP/ENG_DESK/PLUGINS/com.yahourt.tp/eclipse/plugins" />
<property name="java.home" location="C:/Program Files (x86)/Java/jdk1.6.0_24" />
<property name="ant.home" location="D:/Users/0145268/apache-ant-1.9.1" />
<target name="test">
<parallel>
<daemons>
<antcall target="listen" />
</daemons>
<sequential>
<sleep seconds="1" />
<antcall target="execute" />
</sequential>
</parallel>
</target>
<target name="execute">
<echo>Debut target execute</echo>
<java classname="org.eclipse.core.launcher.Main" fork="true" output="reports/out.txt" error="reports/err.txt">
<classpath>
<fileset dir="C:/Tools/Orc/ED/plugins/">
<include name="org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar" />
</fileset>
</classpath>
<jvmarg value="-Dcom.yahourt.tp.context=V:\STRAP\PROJECT\CONTEXTS\ATEST\ldp_ATEST" />
<jvmarg value="-Dcom.yahourt.tp.productline=TstLP" />
<jvmarg value="-DTEMP=D:/temp/T0145268" />
<jvmarg value="-Xms256M" />
<jvmarg value="-Xmx256M" />
<jvmarg value="-XX:MaxPermSize=512M" />
<arg line="-os win32" />
<arg line="-ws win32" />
<arg line="-arch x86" />
<arg line="-nl fr_FR" />
<arg line="-application org.eclipse.pde.junit.runtime.nonuithreadtestapplication" />
<arg line="-classNames taskBox.AllTests" />
<arg line="-testpluginname com.yahourt.tp.TEST" />
<arg line="-version 3" />
<arg line="-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader" />
<arg line="-loaderpluginname org.eclipse.jdt.junit.runtime" />
<arg line="-defaultLoadProject=V:\STRAP\PROJECT\ENG_DESK\PROJECTS\ATEST" />
<arg line="-testApplication com.yahourt.orc.desk.orc" />
<arg line="-perspective com.yahourt.foca.perspectiveDesk" />
<arg line="-dev file:D:/Users/0145268/testSpace/dev.properties" />
<arg line="-configuration D:/Users/0145268/testSpace/" />
<arg line="-port 1102" />
<arg line="-pdelaunch" />
<arg line="-data D:/Users/0145268/junit-workspace" />
<arg line="-debug" />
<arg line="-consolelog" />
</java>
</target>
<target name="listen">
<echo>Debut target listen</echo>
<java classname="pde.test.utils.PDETestResultsCollector">
<arg line="taskBox.AllTests 1102" />
<classpath>
<fileset dir="${build.plugins}">
<include name="**/*.jar" />
</fileset>
<fileset dir="C:/Tools/Orc/ED//plugins/">
<include name="**/*.jar" />
</fileset>
<fileset dir="${java.home}/lib">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
</project>
And the .bat file :
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092149 is a reply to message #1067118] |
Thu, 22 August 2013 11:44   |
Eclipse User |
|
|
|
Hi again,
I need to move my build.xml file outside the original workspace (broken the dependence with it). This file executes a rcp application and tests it with Junit/SWTBOT. I deployed rcp and test plugins (jar files) in a special directory where I want to move the build.xml.
The problem is when I move this ant script, the rcp application does not want to be launched anymore. The other targets work perfectly.
This is what I get when I launch the build outside the wp :
test:
[echo] test
doxygen:
[echo] Debut target doxygen
[doxygen:doxygen] Exec: doxygen -s -g D:\Temp\t0145268\4\doxygen7905175840261711
258.cfg
[doxygen:doxygen] Exec: doxygen D:\Temp\t0145268\4\doxygen7905175840261711258.cf
g
listen:
[echo] Debut target listen
[java] Listening on port 1104 for test suite taskBox.AllTests results ...
execute:
[echo] Debut target execute
Then it stays there.
Here is the target "execute" from build.xml below (almost the same file like above) :
<target name="execute">
<echo>Debut target execute</echo>
<java classname="org.eclipse.core.launcher.Main" fork="true" output="reports/com.obs.out.txt" error="reports/com.obs.err.txt">
<classpath>
<fileset dir="${orchestra.plugins}">
<include name="org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar" />
</fileset>
</classpath>
<jvmarg value="-Dcom.yahourt.tup.context=N:/ldp_ATEST" />
<jvmarg value="-Dcom.yahourt.tup.productline=TestLDP" />
<jvmarg value="-DTEMP=D:/temp/T0145268" />
<jvmarg value="-Xms40M" />
<jvmarg value="-Xmx512M" />
<jvmarg value="-XX:MaxPermSize=256M" />
<arg line="-os win32" />
<arg line="-ws win32" />
<arg line="-arch x86" />
<arg line="-application org.eclipse.pde.junit.runtime.nonuithreadtestapplication" />
<arg line="-classNames launcher.AllTests" />
<arg line="-testpluginname com.yahourt.tup.TEST" />
<arg line="-version 3" />
<arg line="-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader" />
<arg line="-loaderpluginname org.eclipse.jdt.junit.runtime" />
<arg line="-defaultLoadProject=N:/ATEST" />
<arg line="-testApplication com.yahourt.orc.desk.orchestra" />
<arg line="-perspective com.yahourt.cofa.perspectiveDesk" />
<arg line="-dev file:N:/testSpace/dev.properties" />
<arg line="-configuration N:/testSpace/" />
<arg line="-port 1104" />
<arg line="-pdelaunch" />
<arg line="-data N:/junit-workspace" />
<arg line="-debug" />
<arg line="-consolelog" />
</java>
</target>
More precisely my question is (maybe i'm wrong), is it possible to launch RCP with its tests without using -configuration -dev flags to unleash the dependence with the workspace ? Did I forget an important flag ?
I already tried to use the librairy.xml in org.eclipse.swtbot.eclipse.junit.headless which using the same process with ant.
For information, my eclipse launcher cannot be updated with other plugins (server in a restricted area and offline). All my plugin is in the form of library in the test plugin.
Thanks for your help
Lycris
[Updated on: Thu, 22 August 2013 11:54] by Moderator Report message to a moderator
|
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092734 is a reply to message #1092304] |
Fri, 23 August 2013 06:28   |
Eclipse User |
|
|
|
Thanks for your answer.
Actually I noticed that my build.xml is in ./workspace/com.yahourt.tup.TEST.
So I am able to move the folder com.yahourt.tup.TEST wherever I want which is a first good point.
Now I am trying to find a way to remove the -dev and -configuration flags. Because when I do it, I received this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092737 is a reply to message #1092304] |
Fri, 23 August 2013 06:32   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092738 is a reply to message #1062249] |
Fri, 23 August 2013 06:32   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092740 is a reply to message #1062249] |
Fri, 23 August 2013 06:33   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092741 is a reply to message #1092304] |
Fri, 23 August 2013 06:34   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092747 is a reply to message #1062249] |
Fri, 23 August 2013 06:45   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092778 is a reply to message #1092304] |
Fri, 23 August 2013 07:25   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
Re: How to launch my SWTbot tests from console? [message #1092797 is a reply to message #1092304] |
Fri, 23 August 2013 08:00   |
Eclipse User |
|
|
|
Thanks for your answer !
Actually, I noticed that the build.xml file was in ../workspace/com.yahourt.tup.TEST. So I can move this com.yahourt.tup.TEST folder wherever I want which is a first good point.
The problem is when I try to remove the -dev and -configuration flags, I receive this exception :
org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
|
|
|
|
|
Re: How to launch my SWTbot tests from console? [message #1096459 is a reply to message #1096293] |
Wed, 28 August 2013 12:24   |
Eclipse User |
|
|
|
So I think I understood these mandatory flags :
Actually -dev points to the RCP plug-in list and -configuration in part, to a bundles.info file which contains all paths to every plug-ins needed for the launch.
I encounter another issue with the execute task (in Jenkins). Whereas everything works good in the area where I am testing, it stays stuck in a point when I am using Jenkins. Do you know how debug this java task ?
I tried the -debug flag. There are more indications but no information about the freeze :
And also I tried the java remote debug : I add this line in my batch : set ANT_OPTS=-agentlib:jdwp=transport=dt_socket,address=1105,server=y,suspend=y but it blocks to Listening for transport dt_socket at address: 1105
|
|
|
|
Re: How to launch my SWTbot tests from console? [message #1097330 is a reply to message #1097097] |
Thu, 29 August 2013 15:03   |
Eclipse User |
|
|
|
Sorry for the lack of details. In fact, I was trying several solutions and I was often in trouble with. And finally I see, in retrospect, the main problem in Jenkins : we cannot run GUI application in the console mode (my tests need GUI). So I need to find a way to run my tests in user session with a display.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06376 seconds