It is impossible to do by standard TestComplete means. The simplest solution is to use several launches (using /exit parameter when calling TestComplete). This way you can run as many functions as you wish.
However, you might implement a workaround.
The idea of it is to pass the list of tests via additional command line parameter, and then run the tests one by one from a single function.
For example, your Test2 function should look like this
function testall()
{
var tests = ParamStr(ParamCount());
runListOfTests(tests)
}
Now the function which runs the tests will look like this
function runListOfTests(lst)
{
var tests = lst.split(";");
for(i = 0; i < tests.length; i++)
{
eval(tests + "();");
}
}
And finally your command line will look like this
TestComplete.exe xxx.pjs /r /p:Demo1 /t:"Script|Unit1|Test1", /t:"Script|Unit1|Test2" Test1;Test2
The last parameter here is a list of tests split by semicolon.
The example is very simple and has several limitations:
1. It processes only functions from the same unit (but you can use Runner.CallMethod method to solve the problem)
2. It is impossible to pass parameters to functions (this can also be solved by parsing the last parameter
3. The test log will contain only one test with all messages from all the functions