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

Introducing Uniject, a (pure) C# unit testing framework

Discussion in 'Scripting' started by Banderous, Aug 30, 2012.

  1. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Game development is not like other software in that regard. It's hard to argue that everyone should be testing when the likes of Jonathon Blow are doing no such thing.

    I created Uniject to get my own software project under control; I found that without tests to guide me, my entire app became a brittle, spagetti nightmare.

    Yes.

    While making "The Clones of Corpus" the soldier game object was extensively unit tested. The soldier features pathfinding, collision detection, sprite, controls etc etc but there is no prefab; it is all composed by Uniject at runtime from the underlying code.

    Potentially, although you might be at risk of re-implementing Unity.

    Uniject's tests use NUnit, although you could use any test runner you like.

    There's not a huge amount to document. The blog posts should give a fair overview of how everything hangs together,

    Uniject is not coupled to a specific Unity version,

    https://play.google.com/store/apps/details?id=com.ballatergames.corpus&hl=en
     
  2. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Alright, I'm sick of this non-testy, regressive, non-agiley bs. Redoing this with Uniject.
     
  3. invadererik

    invadererik

    Joined:
    Oct 31, 2010
    Posts:
    148
  4. vargonian

    vargonian

    Joined:
    Sep 3, 2011
    Posts:
    12
    I have a question about using Uniject with Visual Studio.

    On the GitHub page, it implies that you can use the IDE of your choice:

    But it lists MonoDevelop as a prerequisite. Can I use Visual Studio to run these tests? I much prefer Visual Studio for my workflow.
     
  5. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Most certainly, uniject is pure .net.
     
  6. Cragganmore

    Cragganmore

    Joined:
    Aug 12, 2012
    Posts:
    2
    It looks like Uniject is still including System.Xml.Linq.dll in its distribution, which is causing conflicts with newer versions of Unity that now also ship with System.Xml.Linq.dll. You'll get an error similar to this:

    Assets/Plugins/Uniject/Interface/IResourceLoader.cs(11,17): error CS0433: The imported type `System.Xml.Linq.XDocument' is defined multiple times

    Can you update the Uniject repository with a new version that doesn't include System.Xml.Linq.dll / System.Xml.Linq.dll.meta in the Assets\Plugins\Uniject\Assembly directory?

    Until then, closing Unity, deleting those two files from Assets\Plugins\Uniject\Assembly, and reloading your project should get things back up and working.