To run unit tests from the command line, log to a file (and have a log popup), and exit after the tests, here is what I use:
UE4Editor.exe Path/To/MyProject.uproject -ExecCmds="Automation RunTests MyProject" -unattended -nopause -testexit="Automation Test Queue Empty" -log -log=RunTests.log
I wanted to also use -NullRHI to avoid seeing the Editor (and the associated Slate load) but this presently crashs UE4.20 at exit
Edit: also, I’ve updated the command line to get a Tests Report using the option -ReportOutputPath.
Here is our current complete commande line:
UnrealEngine\Engine\Binaries\Win64\UE4Editor.exe "C:\workspace\MyProject\MyProject.uproject" -ExecCmds="Automation RunTests MyProject" -Unattended -NullRHI -TestExit="Automation Test Queue Empty" -ReportOutputPath="C:\workspace\MyProject\Saved\TestReport" -Log -Log=RunTests.log