Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Jubula » Autrun Problem (Ant & Jenkins)
Autrun Problem (Ant & Jenkins) [message #1067065] Fri, 05 July 2013 11:57 Go to next message
Heinz Christoph Dau-Schmidt is currently offline Heinz Christoph Dau-Schmidt
Messages: 14
Registered: July 2013
Junior Member
Hi!

The following ANT Skript works, if I execute it on the Command Line of Windows 7
(the AUT is a simple Java Swing Calculator). The AUT starts (I see the calculator GUI) and the testsuite is executed successful.

BUT: If I execute this ANT Skript with Jenkins, it seems like autrun.exe not works.
The AUT will not be opened and the testsuite is completed with an error (see below!).
Testexec works: If I started the AUT manually, and execute only the "testexecute"-Target everything is okay!

Why is that?

ANT Skript CODE:
<project basedir="." default="testexecute" name="AntDemo">
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
<property name="application.dir" value="appDir" />
<property name="build.dir" value="build" />
<property name="jar.dir" value="build/jar" />
<property name="jarName" value="testCalculator" />
<property name="mainClass" value="Calculator" />

<!-- Jubula/GUIdancer! -->
<property name="testexec" value="C:\PROGRA~2\guidancer_7.0.00056\guidancer\testexec.exe"/>
<property name="startautagent" value="C:\PROGRA~2\guidancer_7.0.00056\server\autagent.exe"/>
<property name="startaut" value="C:\PROGRA~2\guidancer_7.0.00056\server\autrun.exe"/>
<property name="report.dir" value="report/guidancer"/>
<property name="testdata.dir" value="testdata" />
<property name="workspace.dir" value="/home/jenkins/.jubula/workspace"/>
 
<path id="classpath">       
     <fileset dir="${lib.dir}" includes="*.jar" />
</path>

<target name="clean" description="Deletes all the generated artifacts.">       
   <echo message="cleaning directories..." />       
   <delete dir="${report.dir}"/>
   <delete dir="${testdata.dir}"/>
   <delete dir="${application.dir}"/>
   <delete dir="${build.dir}"/>
</target>


<target name="init" depends="clean">    
   <mkdir dir="${build.dir}" />  
	<mkdir dir="${jar.dir}" /> 
	<mkdir dir="${report.dir}"/>
	<mkdir dir="${testdata.dir}"/>
	<mkdir dir="${application.dir}"/>
</target>

<target name="compile" description="Compile" depends="init">
   <echo message="Compiling the java source files..." />           
   <javac destdir="${build.dir}" debug="on">               
      <src path="${src.dir}" />               
      <classpath refid="classpath"/>       
   </javac>
</target>

<target name="package" depends="clean, init, compile">
    <echo message="package"/>
    <jar destfile="${jar.dir}/${jarName}.jar" basedir="${build.dir}">
      <manifest>
        <attribute name="Main-Class" value="${mainClass}"/>
      </manifest>
    </jar>
  </target>

	<target name="startaut" depends="package" description="Start AUT">	
		<property name="aut.host" value="localhost"/>
		<property name="aut.port" value="60000"/>
		<property name="aut.type" value="swing"/>
		<property name="aut.id" value="calculator"/>
		<exec executable="${startaut}" spawn="true">
			<arg line='-a ${aut.host} -p ${aut.port} -i ${aut.id} -k en_US -${aut.type} -e "start.cmd"'/>
		</exec>
	
	</target>
	
	
	<target name="testexecute" depends="startaut" description="Run the tests using testexec against an autagent">
	
		<property name="test.project" value="Calculator"/>
		<property name="test.project.version" value="1.0"/>
		<property name="test.suite" value="TS1"/>
		<property name="test.autid" value="calculator"/>
		<property name="autagent.host" value="localhost"/>
		<property name="autagent.port" value="60000"/>
		<property name="db.user" value="sa"/>
		<property name="db.pwd" value=""/>
		<property name="db.url" value="jdbc:h2:C:\Users\Administrator\.jubula\database\embedded;MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"/>

		<exec executable="${testexec}" failonerror="true">
			<arg line='-project ${test.project} -version ${test.project.version} -testsuite ${test.suite}'/>
			<arg line='-server ${autagent.host} -port ${autagent.port} -autid ${test.autid}'/>
			<arg line='-datadir "${testdata.dir}" -resultdir "${report.dir}"'/>
			<arg line='-language en_US -dburl "${db.url}"'/>
			<arg line='-dbuser ${db.user} -dbpw '/>
			<arg value="'${db.pwd}'"/>
		</exec>
	</target>
</project>


Jenkins Output (Testsuite Error):
Quote:

Gestartet durch Benutzer anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Ant Test
[Ant Test] $ cmd.exe /C '"ant.bat testexecute && exit %%ERRORLEVEL%%"'
Buildfile: C:\Program Files (x86)\Jenkins\workspace\Ant Test\build.xml

clean:
[echo] cleaning directories...
[delete] Deleting directory C:\Program Files (x86)\Jenkins\workspace\Ant Test\report\guidancer
[delete] Deleting directory C:\Program Files (x86)\Jenkins\workspace\Ant Test\testdata
[delete] Deleting directory C:\Program Files (x86)\Jenkins\workspace\Ant Test\appDir
[delete] Deleting directory C:\Program Files (x86)\Jenkins\workspace\Ant Test\build

init:
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\Ant Test\build
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\Ant Test\build\jar
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\Ant Test\report\guidancer
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\Ant Test\testdata
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\Ant Test\appDir

compile:
[echo] Compiling the java source files...
[javac] C:\Program Files (x86)\Jenkins\workspace\Ant Test\build.xml:41: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to C:\Program Files (x86)\Jenkins\workspace\Ant Test\build

package:
[echo] package
[jar] Building jar: C:\Program Files (x86)\Jenkins\workspace\Ant Test\build\jar\testCalculator.jar

startaut:

testexecute:
[exec] Fri Jul 05 16:21:31 CEST 2013 AUT Agent: Connecting to "localhost:60000" ...
[exec] Fri Jul 05 16:21:32 CEST 2013 AUT Agent: connection established.
[exec] Fri Jul 05 16:21:32 CEST 2013 Database: Connecting as "sa" to "jdbc:h2:C:\Users\Administrator\.jubula\database\embedded;MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"...
[exec] Fri Jul 05 16:21:35 CEST 2013 Database: Connection established.
[exec] Fri Jul 05 16:21:35 CEST 2013 Database: Loading project "Calculator" in version "1.0"...
[exec] Fri Jul 05 16:21:36 CEST 2013 Database: Project loading completed.
[exec] Fri Jul 05 16:21:36 CEST 2013 Project: Checking completeness
[exec] Fri Jul 05 16:21:36 CEST 2013 Checking completeness of Test Suite "TS1"...
[exec] Fri Jul 05 16:21:36 CEST 2013 Start Test Suite: TS1
[exec] Fri Jul 05 16:21:36 CEST 2013 Executing Test Suite "TS1"...
[exec] Fri Jul 05 16:21:36 CEST 2013 Preparing execution of Test Suite "TS1"...
[exec] Fri Jul 05 16:21:36 CEST 2013 AUT: Connecting to "calculator"...
[exec] Fri Jul 05 16:21:38 CEST 2013 AUT: Connection established.
[exec] Fri Jul 05 16:21:39 CEST 2013 Resolving predefined Variables
[exec] Fri Jul 05 16:21:39 CEST 2013 Resolving Test Steps to execute...
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Suite "TS1" execution...
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: T1
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: ub_app_activate_AUTDefault
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: ub_app_activate
[exec] Fri Jul 05 16:21:40 CEST 2013 Step: activate AUT
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: ub_grc_clickLeft_single
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: ub_grc_clickLeft
[exec] Fri Jul 05 16:21:40 CEST 2013 Test Case: ub_grc_click
[exec] Fri Jul 05 16:21:40 CEST 2013 Step: click
[exec] Fri Jul 05 16:21:42 CEST 2013 Event Handler: Default Event Handler
[exec] Fri Jul 05 16:21:42 CEST 2013 End of Test Suite
[exec] Fri Jul 05 16:21:42 CEST 2013 Writing Report into Filesystem
[exec] Fri Jul 05 16:21:42 CEST 2013 Writing Report to Database
[exec] Fri Jul 05 16:21:43 CEST 2013 AUT: Disconnected.
[exec] Fri Jul 05 16:21:43 CEST 2013 AUT Agent: connection closed.
[exec] Fri Jul 05 16:21:43 CEST 2013 Exit: Code 1

BUILD FAILED
C:\Program Files (x86)\Jenkins\workspace\Ant Test\build.xml:86: exec returned: 1

Total time: 29 seconds
Process leaked file descriptors. See (LINK) for more information
Build step 'Ant aufrufen' marked build as failure
Finished: FAILURE
Re: Autrun Problem (Ant & Jenkins) [message #1067136 is a reply to message #1067065] Sat, 06 July 2013 04:40 Go to previous messageGo to next message
Achim Loerke is currently offline Achim Loerke
Messages: 325
Registered: July 2009
Location: Braunschweig, Germany
Senior Member

Did you setup the Jenkins executor to run on a "real" (well, virtual will also work) display? Jubula needs a display (and to some extend mouse and keyboard input devices). If your Jenkins (or any CI for that matter) executor is just a "command line only" instance Jubula can't work.

There is an article about CI setup on the testing portal.

- Achim

Re: Autrun Problem (Ant & Jenkins) [message #1068196 is a reply to message #1067136] Fri, 12 July 2013 11:52 Go to previous message
Heinz Christoph Dau-Schmidt is currently offline Heinz Christoph Dau-Schmidt
Messages: 14
Registered: July 2013
Junior Member
Achim Loerke wrote on Sat, 06 July 2013 04:40
Did you setup the Jenkins executor to run on a "real" (well, virtual will also work) display? Jubula needs a display (and to some extend mouse and keyboard input devices). If your Jenkins (or any CI for that matter) executor is just a "command line only" instance Jubula can't work.

There is an on the testing portal.

- Achim



Thank you.
It works, if I start jenkins via cmd (not as windows service).
Previous Topic:Jubula 2.1.0 extension for testing SWT DateTime in RCP?
Next Topic:Jubula can't find component outside of scroll area
Goto Forum:
  


Current Time: Wed Jul 30 23:21:58 EDT 2014

Powered by FUDForum. Page generated in 0.01492 seconds