Running tests from the command line - not working

4 views
Skip to first unread message

Sanika Bhide

unread,
Jan 19, 2022, 2:04:41 PM1/19/22
to AltUnity - UI test automation tool for Unity3D
Hello,

I am trying to run my AltUnity test through the command line. So far I've successfully got the project to build and instrumented the game with AltUnityServer using this command:

./Unity.exe -projectPath $PROJECT_DIR -executeMethod BuilderClass.BuildFromCommandLine -logFile LogFile.txt

** I'm not using batchmode for now because I want to see what's going on in the background**

After I run that command, the Unity Editor starts up, however the game is not running and I don't see the message that says "Waiting for connection on port 13000". I need to manually click "Play" in the editor for it to give me that message so that I can run my test.

How can I execute the "Run test" command if the game isn't playing after I build from command line? I want to be able to execute this command for my test:

<UnityPath>/Unity -projectPath $PROJECT_DIR -executeMethod
AltUnityTestRunner.RunTestFromCommandLine -tests MyFirstTest.TestStartGame -logFile logFile.log

but when I run it, Unity editor crashes with error "Could not create connection to 127.0.0.1:13000".

Thanks in advance!

Dorin Oltean

unread,
Jan 20, 2022, 8:05:20 AM1/20/22
to Sanika Bhide, AltUnity - UI test automation tool for Unity3D
Hey Sanika,
BuilderClass.BuildFromCommandLine only builds your game with AltUnity Instrumentation. You need to change the method from code to build & run. Or to manually start your app.
Here is an example on how to do build & run:

buildPlayerOptions.options =  buildPlayerOptions.options | UnityEditor.BuildOptions.AutoRunPlayer
BuildPipeline.BuildPlayer(buildPlayerOptions)


--
You received this message because you are subscribed to the Google Groups "AltUnity - UI test automation tool for Unity3D" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altunityforu...@altom.com.
To view this discussion on the web visit https://groups.google.com/a/altom.com/d/msgid/altunityforum/39128664-046f-4b97-b892-22e8bc0af195n%40altom.com.


--

Dorin Oltean

Owner @ Mapcherry

Reply all
Reply to author
Forward
0 new messages