Search Unity

Referencing NUnit for testing

Discussion in 'Testing & Automation' started by robin_pcity, Dec 11, 2021.

  1. robin_pcity

    robin_pcity

    Joined:
    Jun 26, 2020
    Posts:
    28
    I currently want to test out a few functions and I was wondering whether NUnit will be included when I build the app.

    How I come to ask this:

    I wanted to create a Unit Test but if I do so in a different Assembly I need to make some classes public which dont need to be public. If there's a better solution than creating the test in the project then I would be pleased to know this instead
     
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    Make the classes
    internal
    instead of public, and add the InternalsVisibleTo attribute somewhere inside the assembly so that the code in the test assembly is able to access them.
     
  3. robin_pcity

    robin_pcity

    Joined:
    Jun 26, 2020
    Posts:
    28
    I haven't come across this doc... Thank you