Search Unity

Running non-batch playmode tests on the build server

Discussion in 'Testing & Automation' started by andrew-fray, Nov 20, 2020.

  1. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    155
    Hi folks!

    I have a jenkins setup that currently runs some playmode tests in batch mode. The (jenkins pipeline) command looks like this:

    bat "\"${UNITY_PATH}\" -batchmode -projectPath . -runTests -testResults playmodetests.xml -testPlatform playmode -testCategory \"BuildServer\" -logFile"


    This works for the tests I've tagged with "BuildServer" - those that don't depend too much on animation or physics. -batchmode messes too much with the other tests for them to run.

    To fix this limitation, I'd like to run unity outside of batch mode. So, I provisioned a nice GPU-enabled ec2 windows machine, and tried running it. This command in dos when remoting into the server works:

    start /wait "" "C:\Program Files\Unity\Hub\Editor\2019.4.5f1\Editor\unity.exe" -projectPath . -runTests -testResults playmodetests.xml -testPlatform playmode -testCategory "BuildServer" -logFile playmodenobatch.txt


    ...unity opens, the playmode tests run, and it quits.

    However when I try the original jenkins command without -batchmode, the build server just hangs. I can see the process running, but there's no log output and it never seems to complete.

    Is there something weird about running via jenkins? Is there something extra I have to do to force a visual app to launch when jenkins is remoting in like this, and there's not necessarily a remote desktop attached? Thanks!
     
  2. TempMail1234

    TempMail1234

    Joined:
    Sep 26, 2022
    Posts:
    1
    in case anybody stumbles across this question ...

    i had the same problem, since there were tests that failed in batchmode, but would pass via testrunner + standalone


    the problem is, that windows services are not allowed to run gui applications

    - as far as i understood the issue, not even checking "allow service to interact with desktop" would solve this -


    so instead of running jenkins as a service, you want to run jenkins as a regular application


    so what i did :

    - disable the jenkins service

    - if you already have a running jenkins setup, you should set JENKINS_HOME to point to that location, since the location may differ if running as a service or as an application

    you can get the current location at manage jenkins -> system -> home directory

    - start jenkins as application via "java -jar Jenkins.war"

    - you may add this to your startup apps