Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » screenshots when running tests on headless server
screenshots when running tests on headless server [message #514947] Wed, 17 February 2010 05:06 Go to next message
Eclipse UserFriend
Originally posted by: cedric.chabanois.entropysoft.net

Hi all,

I use SWTBotJUnit4Suite to take a screenshot when a test fails.
Locally, it works.

But on the headless build server (Windows 2003 running luntbuild as a
windows service), screenshots are all 1024x768 blank images.

Any thoughts on the problem ?

Thanks,
Cédric
Re: screenshots when running tests on headless server [message #515056 is a reply to message #514947] Wed, 17 February 2010 15:16 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Running as a service (or locking up your computer) ensures that the
windows are merely 'virtual' in nature and never painted on the screen.
This is the reason why you get black(or white) images depending on your os.

We use a setup where we use VMWare to login into the machine and close
the VMWare console.

In case you don't have access to the console via VMWare you can use use
an old laptop that is always logged in into the build machine via RDP.

The above solutions are the equivalent of running tests locally and
walking away to get a coffee :)

Cheers!

-- Ketan

On 2/17/10 1:45 AM, Cédric Chabanois wrote:
> Hi all,
>
> I use SWTBotJUnit4Suite to take a screenshot when a test fails.
> Locally, it works.
>
> But on the headless build server (Windows 2003 running luntbuild as a
> windows service), screenshots are all 1024x768 blank images.
>
> Any thoughts on the problem ?
>
> Thanks,
> Cédric
Re: screenshots when running tests on headless server [message #518388 is a reply to message #514947] Wed, 03 March 2010 23:18 Go to previous messageGo to next message
speedprincess is currently offline speedprincessFriend
Messages: 5
Registered: February 2010
Junior Member
Hello,

I have the same problem.

If I run the tests headless, with starting a windows console and launch the ant task. Then everything is fine.

But If I start the headless test, withan local installed hudson. Then I dont see the application during the tests and my screenshots are white. Whate must I do see the application during the tests.

I think, when I have a local installed hudson on my windows machine, then I should see the application during the test.


Thats my test.xml

<?xml version="1.0"?>
<!--
 
 
======================================================================
this has been copied from o.e.test plugin with some targets for SWTBot
======================================================================
 
 
-->

<project name="Headless SWTBot  Test" default="swtbot-test" basedir=".">




	<target name="usage">
		<echo message="Please refer to the testframework.html in org.eclipse.test for instructions on usage." />
	</target>

	<target name="init">
		<!--
Parameters:
(Mandatory)
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
 
(Optional - overrides defaults set in script)
testProduct - a string containing the product id to test.
testApplication - a string containing the application id to test.
vmargs - a string containing arguments to pass to the VM.
extraVMargs - allows separate setting of VM args from separate caller.
timeout - overrides default test timeout value (in milliseconds).
test-output - overrides default output file produced from test run.
plugin-path - path to root of plug-in
useEclipseExe - property setting forces test to launch via eclipse executable.
junit-report-output - output directory for junit reports produced for specified classname.
-->
		<property file="build.properties" />

		<property name="data-dir" value="${product.path}/ws" />
		<property name="eclipse-home" value="${product.path}/eclipse" />
		<property name="plugin-name" value="${headless.test.plugin.name}" />
		<property name="classname" value="${headless.test.suite.name}" />

		<tstamp>
			<format property="TIMENOW" pattern="HHmmssSSSS" />
		</tstamp>
		<!--property setting useEclipseExe launches tests using the eclipse executable-->
		<condition property="launchTarget" value="eclipse-test">
			<isset property="useEclipseExe" />
		</condition>
		<!--default launch target for launching tests-->
		<property name="launchTarget" value="java-test" />

		<!-- default product/application to launch -->
		<condition property="testproduct.if.available" value="-product ${testProduct}">
			<isset property="${headless.test.product}" />
		</condition>
		<property name="testproduct.if.available" value="" />

		<condition property="testapplication.if.available" value="-testApplication ${testApplication}">
			<isset property="${headless.test.application}" />
		</condition>

		<property name="testapplication.if.available" value="" />

		<!--default heap sizes when running performance tests-->
		<condition property="vmargs" value=" -Xms256M -Xmx256M">
			<equals arg1="${test.target}" arg2="performance" />
		</condition>
		<property name="os" value="win32" />
		<property name="ws" value="win32" />
		<property name="arch" value="x86" />
		<property name="extraVMargs" value="" />
		<property name="plugin-path" value="" />
		<property name="timeout" value="7200000" />
		<property name="test-output" value="${eclipse-home}/${classname}.xml" />
		<property name="junit-report-output" value="${eclipse-home}/results" />
		<mkdir dir="${junit-report-output}" />
	</target>

	<target name="swtbot-test" description="Eclipse application used to launch UI plugin tests." depends="init">
		<antcall target="${launchTarget}">
			<!--param name="application" value="org.eclipse.test.uitestapplication"/-->
			<param name="application" value="org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" />
		</antcall>
	</target>

	<target name="java-test">
		<!--default vm args-->
		<property name="vmargs" value="-Dedesk.baseUrl=${headless.test.server} -Dedesk.userName=${headless.test.username} -Dedesk.userPassword=${headless.test.password} -Xms256m -Xmx512m" />


		<property name="jvmOption" value="" />

		<!--set default jvm to use for testing-->
		<property name="jvm" value="${java.home}/bin/java" />

		<property name="launcher-arg-line" value="
-application ${application}
${testproduct.if.available}
${testapplication.if.available}
-data ${data-dir}
formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test-output} formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter
-testPluginName ${plugin-name}
-className ${classname}
-os 	${os}
-ws    ${ws}
-arch ${arch}
-consoleLog
-debug" />
		<property name="jvm-arg-line" value="${vmargs} ${extraVMargs} ${jvmOption}" />

		<echo>======================================</echo>
		<echo>Running swtbot junit tests in ${classname}</echo>
		<echo>Command line args are ${launcher-arg-line}</echo>
		<echo>JVM args are ${jvm-arg-line}</echo>
		<echo>JUnit Result File: ${junit-report-output}/${classname}.xml.</echo>
		<echo>Console output File: ${junit-report-output}/${classname}.txt.</echo>
		<echo>======================================</echo>

		<fail unless="application" message="variable 'application' not defined." />
		<fail unless="data-dir" message="variable 'data-dir' not defined." />
		<fail unless="test-output" message="variable 'test-output' not defined" />
		<fail unless="plugin-name" message="variable 'plugin-name' not defined" />
		<fail unless="classname" message="variable 'classname' not defined" />
		<fail unless="os" message="variable 'os' not defined. os can be one of win32, linux, macosx" />
		<fail unless="ws" message="variable 'ws' not defined. ws can be one of win32, wpf, gtk, carbon, cocoa" />
		<fail unless="arch" message="variable 'arch' not defined. arch can be one of x86, x86_64, ppc" />

		<pathconvert property="foundJunit3" setonempty="false" pathsep=" ">
			<path>
				<fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.eclipse.junit3.headless*/META-INF/MANIFEST.MF" />
				<fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.ant.optional.junit3*" />
			</path>
		</pathconvert>

		<fail if="foundJunit3">
.
Found org.eclipse.swtbot.eclipse.junit3.headless or org.eclipse.swtbot.ant.optional.junit3 in the plugins directory.
JUnit 3.x and 4.x don't play well together.
Please remove org.eclipse.swtbot.eclipse.junit3.headless and org.eclipse.swtbot.ant.optional.junit3 from the plugins dir.
</fail>

		<java fork="true" dir="." timeout="${timeout}" jvm="${jvm}" logError="true" classname="org.eclipse.core.launcher.Main" output="${junit-report-output}/${classname}.txt">
			<classpath>
				<fileset dir="${eclipse-home}/plugins">
					<include name="org.eclipse.equinox.launcher_*.jar" />
				</fileset>
			</classpath>
			<arg line="${launcher-arg-line}" />
			<jvmarg line="${jvm-arg-line}" />
			<sysproperty key="PLUGIN_PATH" value="${plugin-path}" />
		</java>

		<echo>======================================</echo>
		<echo>If you see errors above please see the file ${junit-report-output}/${classname}.txt for more information.</echo>
		<echo>Errors are generally caused by missing or incorrect dependencies.</echo>
		<echo>======================================</echo>

		<antcall target="collect-results" />
	</target>

	<target name="collect-results">
		<dirname property="output-dir" file="${test-output}" />
		<basename property="output-file-name" file="${test-output}" />
		<junitreport todir="${junit-report-output}" tofile="${classname}.xml">
			<fileset dir="${output-dir}">
				<include name="${output-file-name}" />
			</fileset>
		</junitreport>

		<style style="${eclipse-home}/plugins/org.eclipse.test/JUNIT.XSL" basedir="${junit-report-output}" includes="${classname}.result.xml" destdir="${junit-report-output}" />

		<!--save .log content and *.log content from configuration directory-->
		<concat destfile="${junit-report-output}/${classname}.log">
			<fileset dir="${eclipse-home}" includes="${data-dir}/.metadata/*.log" />
			<fileset dir="${eclipse-home}" includes="configuration/*.log" />
		</concat>
	</target>

	<target name="collect">
		<!--
This target can be used to aggragate test runs from multiple test suites into a single report.
 
Parameters to this target:
includes - the names of the files to include
output-file - the name of the output file to produce
-->
		<junitreport todir="." tofile="${output-file}">
			<fileset dir=".">
				<include name="${includes}" />
			</fileset>
		</junitreport>
	</target>

</project>




============================================================ ===========
UPDATE
============================================================ ===========

I have changed the start of the tests from a alling of the anttarget in the hudson to a start of the ant test task in a batch File.
But no change. I dont see the application during the test and so I can not get any screenshots.

What must I do an my local win 7 pc, with my local hudson, installed as an windows server, to start the test automatically after the build and see the application during the test. Can somebody explain me that, because I dont understand whats happend, and how can run the gui tests without the gui. Where can I see them, and where can I change the configuration that they run on my local windows installation.
Can I reach thea, by running hudson not as an windos server, or what must I exactly do?

[Updated on: Thu, 04 March 2010 23:06]

Report message to a moderator

Re: screenshots when running tests on headless server [message #543874 is a reply to message #518388] Wed, 30 June 2010 21:55 Go to previous messageGo to next message
Brian Yu is currently offline Brian YuFriend
Messages: 10
Registered: July 2009
Junior Member
Any response to speedprincess?

Re: screenshots when running tests on headless server [message #543891 is a reply to message #543874] Wed, 30 June 2010 23:57 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 6/30/10 2:55 PM, Brian Yu wrote:
> Any response to speedprincess?


Here goes :)

http://wiki.eclipse.org/SWTBot/CI_Server

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Previous Topic:Editor-specific Shortcut isn't recognized
Next Topic:How to test my application using SWT?
Goto Forum:
  


Current Time: Sat Nov 22 21:28:02 GMT 2014

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

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