• This is a test case that run dumpConfig script
     dumpConfig.sqf, v0.95
     Copyright (c) 2009, shreds-of-sanity@gmx.net
  • The result is a dump of all classes readable by the ArmA engine


As any testbench tool, you need to install first Autohotkey_L, from Autohotkey.com download page.
Follow the instructions and let autohotkey handle the *.ahk files. Files with .ahk extension will be run and a little green "H" icon will appears in your taskbar while the script runs.

Unzip the latest testbench.zip file somewhere. Under the tests/dumpConfig directory you will find a init.ahk file. Double click it to run the process. If you want to edit the file before, use Wordpad or vim or nodepad++, but not notepad, because the file has been edited as Unix type (I will probably fix this in future).

The init.ahk file

I use this file to explain step by step what is happening.
First line, you see dump = inline. In Autohotkey (AHK from now) strings can be evaluated without double quotes like in most common languages.

The same happens for mission = dumpConfig.Desert_E. This mission variable is needed later in the script. Not used here, but available in testbench, is a searchMission() function that will search the named mission in you profile. This is useful when you want to edit the mission from inside the game first.

The next 5 lines are quite common.
#Include ..\.. will start including files from testbench root directory
#Include lib.ahk will include all the available functions for your test to be used. Functions are under lib directory.
SetWorkingDir, ..\.. will change the current working directory at runtime to the testbench root directory.
TestbenchDir=%A_WorkingDir% assign the full path of the testbench root directory. It's needed later.
Init() will create a temporary directory under run with a time stamp name like 20110827_123059.

From now on, all depends on what you want to do in your test.

In this case, first I need to copy and create some file in the temporary directory, now pointed by A_WorkingDir variable, that Init() set for us. This means, that any files we create without give a path will be created there. The original test files are available under A_ScriptDir.

FileCopyDir,%A_ScriptDir%\%mission%,%mission% this will copy our mission dumpConfig.Desert_E in the current working directory.

The next lines create a init.sqf file directly inside the mission folder. The source is read from the test case A_ScriptDir folder. A line #include "inline.sqf" (or class.sqf) is added before the rest.

The two FileCopy instructions copy the .cfg and profile under SP\Users\SP. This because ArmA2 will run with the -profiles argument pointing here.

Next lines create an autotest.cfg that will be used by the -autotest option to run one mission and exit. Everything after FileAppend in parenthesis goes to the file. Variable substitution is made with var as usual.

The SP_args specify the arguments the arma2.exe process will receive. If you see, you notice the -beta is not an arma2.exe argument.
The next command, MakeRunCmd parse the string and create additional arguments to run arma2.exe pointing to our working directory. The -beta in this case will handle for instance the resulting -mod correctly also for OA.

getBuild simply get the version of the game from the executable file. The line after prepare the name of the dump.

At this point, the Spawn command will run the game with the given parameters. Without additional arguments, Spawn() returns as the window class of ArmA2 will be shown on the screen.

WinMinimize will bring the window down in the taskbar.
Process, WaitClose will wait the ArmA process to end (well, AHK is quite self-explaining sometime).

The remaining lines will simply open the RPT file and copy everything after the mark "~~~~" in the .txt file.

The remains

If you open the run subdirectory just in the testbench root, you will see the working directory where the previous process did run.
These directories will be created for each run. When not needed, it's safe to remove them.