All things Marathon, Marathonite, Java and GUI Test automation, scripting and whatever is useful for test automation projects.
All things Marathon, Marathonite, Java and GUI Test automation, scripting and whatever is useful for test automation projects.
CATEGORIES
BOOKMARKS
June 10th, 2008
Updated. Thanks to Arun for giving me a pointer to pstools.
This will be part of Marathon User Guide when it comes out. I am writing these snippets so that you can benefit from them now.
Now that you wrote a lot tests using marathon how do you run them? The problem with GUI testing is that your desktop is tied up for the duration of the tests. The monitor blinks like a tube-light with a starter problem with Windows popping up all over with crazy titles - ‘testStartAndStopRecordingWithSetupAndTearDown’ or ‘testDeleteFilesWithSomeFailures’. Even if you can live with this - all these popping up windows will be stealing your application’s focus (beside stealing yours) and some of your keystrokes and mouse clicks will go there. In the end you end up not knowing whether a test case failed because of you using the keyboard or a bug in the application under test.
Java since 1.4.2 supports a headless mode that is half-baked and not useful for the purposes we are talking about. Googling for ‘java headless’ turns up this page, so I am pointing this out. Java support for headless is really for applications that need to run without a display and keyboard. Anyhow if you do not need a display then the whole of this article does not make sense.
An elegant solution I found to run GUI test suites on Linux is to use Xvbf - a X server that simulates a display, mouse and keyboard. On ubuntu, the platform of choice for me, the Xvfb package comes with a script xvfb-run. Executing an application under Xvfb is just typing:
xvfb-run marathon <path-to-your-mpf>
The standard error and output will be on your terminal, so you can see the progress of your test case execution and any errors thrown up by the test run.
psexec is a small utility from Sysinternals from the pstools package. You can Download it here.
psexec allows you to run applications on remote machines. We will use it to run marathon headless on Windows. Download the pstools archive and install on the machine. Add the installed directory to the path. There are two ways you can execute Marathon - with a console and without a console.
For using it with a console (so that you can see the progress):
psexec -s cmd /c marathon -batch <path-to-your-mpf>
If you are not interested in a console:
psexec -s -d cmd /c marathon -batch <path-to-your-mpf>
Note that -s uses the system account (i.e the administrator) to execute the command. I found it easier to create a batch file that runs Marathon with all options and execute the batch file using psexec:
psexec -s cmd /c <path-to-batch-file>
You can run the tests headless on Windows using the telnet service that is available on Windows XP Professional. You can enable telnet service from Control Panel -> Services. Once you enable the service log-in using the command:
telnet localhost
Give your user name and password. You will land up at C:> prompt. Run your command:
marathon -batch <path-to-your-mpf>
That is it. Your display, keyboard and mouse belong to you, no annoying pop-up windows to disturb you and Marathon chugs along running the application tests. You can use -text, -html or -xml arguments along with -batch so that the test results are captured in a report.
Note:
Running a telnet server is insecure. Modify your windows firewall settings to disable incoming connections. Default is to disable incoming connections from Internet - it should be OK.Note:
It will be possible to automate the log-in part provided we have a telnet client that can take input from a file and send the commands to
the server. I don’t know of any. Drop me a line if you know such a client for Windows.
Posted in Marathon
This entry was posted on Tuesday, June 10th, 2008 at 7:50 am and is filed under Marathon. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
(C) Jalian Systems 2008 | contact
So what you need is not really “headless” mode, but “simulated head” mode