Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Unity Test Runner messes up the plugins on my project.

Discussion in 'Testing & Automation' started by hedgeh0g, Oct 28, 2019.

  1. hedgeh0g

    hedgeh0g

    Joined:
    Jul 18, 2014
    Posts:
    102
    Hello folks,

    I've been trying following this tutorial https://www.raywenderlich.com/9454-introduction-to-unity-unit-testing on implementing Unit Testing on my project.

    However, as soon as I put the "GameAssembly" into the Assembly Definition References, an error pops for each plugin in my project.

    I'm DEFINITELY missing something very easy to understand, but I can't find an answer.

    So, what should I do?

    Thanks in advance.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Where in your project did you put the .asmdef (Assembly definition) file ?
     
  3. hedgeh0g

    hedgeh0g

    Joined:
    Jul 18, 2014
    Posts:
    102
    I have an asmdef into Assets/Tests and one into Assets/Scripts
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    and where is PDFViewer (i assume this is a plugin?) placed?
     
  5. hedgeh0g

    hedgeh0g

    Joined:
    Jul 18, 2014
    Posts:
    102
    All of my plugins are in Assets/Plugins/PDFViewer
     
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    So, before using .asmdef files, all your code would get compiled into a single assembly (well - 1 for runtime and 1 for editor code).

    With this setup now, anything under Assets/Scripts will get compiled into 1 assembly, and everything under Assets/Tests will be compiled into another assembly.

    These assemblies do not automatically reference any other code, and since your code under Assets/Plugins is not part of those assemblies, and it is not references by anything, you get this error.

    To solve this, you can set up your Assets/Plugins under its own assembly definition and have your main assembly reference that.
     
    hedgeh0g likes this.
  7. hedgeh0g

    hedgeh0g

    Joined:
    Jul 18, 2014
    Posts:
    102
    Ok, I did as you said, and the errors are just multiplying...

    Say, if in Assets/Plugins I have several folders each with a different plugin, do I have to put an asmdef on each folder or can I just put an asmdef in Assets/Plugins that automatically compiles every plugin? I did the second, and the errors persist.
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    The .asmder applies to the current folder or subfolders.

    I think u can try to put it in Plugins.