1.5M ratings
277k ratings

See, that’s what the app is perfect for.

Sounds perfect Wahhhh, I don’t wanna

Atlassian Bamboo and Unity Editor Tests

Here its how i configure bamboo to run unity through the command line and read the NUnit test results as valid input for the bamboo job 

We run bamboo cloud and a dedicated computer as the agent with unity 5.3.3f1 installed.

First inside bamboo we need to specify what agent have unity, choose the agent that have unity installed and add a capability with the path where unity is installed.


Then inside a plan add a command task.

As the argument pass the unity command line options  in my case it was

-batchmode -runEditorTests -projectPath ${bamboo.build.working.directory} -editorTestsResultFile ${bamboo.build.working.directory}

Note the bamboo variable ${bamboo.build.working.directory}, this is where bamboo checks out the code, we have the unity project at the root of the git repo.


I also output the NUnit test results file in the same folder for easy access in the next step, the NUnit Parser.

image

The file matcher with the wildcard automatically detect the test result file output in the same directory.


This is a preview with the current test.

image

And this are the same test inside unity in my development machine.

image
attlasian bamboo bamboo ci unit testing unity unity test tools

custom Assert

public class Assert : NUnit.Framework.Assert
{
    public static void VertexAreVertical(Vector3[] vertices){
        MeshInspector inspector = new MeshInspector ();
        Assert.IsTrue (inspector.VertexAreVertical (vertices));
    }
}

usage

[Test]
public void VertexVerticalLinePass()
{
    Vector3[] verticalVertex = {
        new Vector3 (0, 0, 0),
        new Vector3 (0, 1, 0)
    };

    Assert.VertexAreVertical(verticalVertex);

    Vector3[] verticalVertexReverseOrder = {
        new Vector3 (0, 1, 0),
        new Vector3 (0, 0, 0)
    };

    Assert.VertexAreVertical(verticalVertexReverseOrder);
}
unity unit-test tools