0

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 Answers1

0

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.

Tiberiu Maran
  • 1,983
  • 16
  • 23
  • Thank you. I'll use "-batchmode" and "-quit". I'll take a look at EditorSceneManager and get back to you with any results I have. – Void_Prototype Nov 01 '19 at 14:09