Unity Smoke Testing

433 views Asked by At

Here's something I've been having trouble finding documentation and resources on. How do I accomplish a basic Unity Smoke Test without loading up a scene?

The smoke test is called from a batch script

RunSmokeTest.bat

C:\Path\To\Unity.exe -projectPath C:\Path\To\Project -executeMethod Smoketest.Start

Smoketest.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class SmokeTest
{

    public static void Start()
    {
        SmokeTest smoke = new SmokeTest();
        smoke.MainTest();
    }

    public void MainTest()
    {

    }
}
1

There are 1 answers

1
Tiberiu Maran On

To run Unity "independently" from the command line, you can use the additional parameter -batchmode. If you also want Unity to exit when the test is finished, you can also add -quit.

More details here

Note that Unity will run in Editor mode. This will result in an empty scene being present by default (any game objects you create will go to that scene). Also if you need to actually load a scene, you will need to use EditorSceneManager.