Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Test Runner PlayMode tests folder? (2017.4)

Discussion in 'Testing & Automation' started by Flavelius, Oct 24, 2018.

  1. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
    Hi,
    i recently discovered playmode tests and really like the idea.
    I just can't seem to find a way to correctly put them anywhere.
    When i place them inside an Editor folder they don't get listed in the playmode section but in the edit mode section, when i place them outside i can't build the player (UnityEngine.TestTools not found ? and NUnit being editor only).
    In the end i wrapped the whole file in #if EDITOR, but this doesn't feel like the correct way of doing it.
    Is there any other/right way to go about this?
     
  2. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
  3. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
  4. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
  5. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,907
  6. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
    After re-reading this i still couldn't get it to work. I prepared an example project, maybe you can tell me what i'm doing wrong?
    (It's 2017.4 btw, the link you gave was for the most recent version)
     

    Attached Files:

  7. gintautass

    gintautass

    QA Minion Unity Technologies

    Joined:
    Oct 27, 2015
    Posts:
    46
    Hey,

    I would imagine I am a little bit late on this, but in case someone else runs into this, you can solve by:
    This should not happen to projects by default unless you explicitly disabled the test runner :/

    Open `Library/ProjectSettings.asset` with text editor. Find `playModeTestRunnerEnabled` flag inside it and set to '1'
    Then save the file.
     
    Flavelius likes this.
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    I thought that the play mode test runner could be enabled from the UI ? or was this option removed ?
     
  9. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    It can be enabled from the UI. The workaround mentioned by @gintautass is for the case when someone intentionally disabled the Test Runner, which might not be the case here. Let's see if @Flavelius comes back with an answer.
     
  10. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    926
    Not sure what changed (i did not disable it manually, i recall not even having/seeing this option), but downloading what i attached to the last post again and running it with the latest 2017.4 version works without problems.