ruk·si

Unity
Testing

Updated at 2016-10-30 07:43

All tests must be under an Editor directory. Is usually define all my tests in _Game/Tests/Editor/*.cs

using NUnit.Framework;

[TestFixture]
public class MyClassTest
{
    [Test]
    public void WhatIsBeingTested()
    {
        Assert.IsTrue(true);
        Assert.AreEqual(2, 2);
    }

}

Running tests inside Unity:

Window -> Editor Tests -> Run All

Running Unity editor tests from command line:

/Applications/Unity/Unity.app/Contents/MacOS/Unity \
    -projectPath PATH_TO_YOUR_PROJECT \
    -runEditorTests

/Volumes/Extraspace/Applications/Unity\ 5.4.0f3/Unity.app/Contents/MacOS/Unity \
    -projectPath /Users/ruksi/Projects/iam/IAM \
    -runEditorTests