Search Unity

Is it possible to test .dll with nunit-console generated by Unity 3D?

Discussion in 'Formats & External Tools' started by godszerg86, Jan 31, 2019.

  1. godszerg86

    godszerg86

    Joined:
    Dec 19, 2018
    Posts:
    10
    I have some unit test in my Unity project.
    I also installed nunit3-console and added it to the PATH so it recognized and works.
    I have the next test script:

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using Assets.Scripts;
    5. using NUnit.Framework;
    6. using UnityEngine;
    7. using UnityEngine.TestTools;
    8.  
    9.  
    10. namespace Tests
    11. {
    12.    public class HelpersTests
    13.    {
    14.        // A Test behaves as an ordinary method
    15.        [Test]
    16.        public void MaxOfArray()
    17.        {
    18.            var maxNumber = Helpers.ArrayMaxFloat(new float[] { 5f, 1f, 3f });
    19.            Assert.AreEqual(4f, maxNumber);
    20.            // Use the Assert class to test conditions
    21.        }
    22.    }
    23. }
    it will generate:
    \Library\ScriptAssemblies\Test.dll


    I tried in the directory above:
    nunit3-console Test.dll


    but got:
    Invalid. File not found.


    Is it possible to test that way? I can test from Unity command line but my goal is to get output dialog provided by Nunit.

    Or please tell me how to output test results to shell windows when I run them in batch mode?