Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    Dismiss Notice

Announcing UnTest: a ground-up unit testing framework for Unity3D

Discussion in 'Scripting' started by andrew-fray, Aug 5, 2013.

  1. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
    https://github.com/tenpn/untest

    Features:
    - Open-source under GPL2
    - Run tests from command line or within the Unity3D editor
    - Lightweight nunit-style attribute-based tests

    Download the unitypackage from: https://github.com/tenpn/untest/releases

    Check the readme for usage: https://github.com/tenpn/untest/blob/release/readme.md

    Log issues, ideas, bug reports at: https://github.com/tenpn/untest/issues

    UnTest is still not quite production-ready. Here are areas that are looking for contributors:
    - It has only been tested on Unity 4 and Mac OSX. If anyone can test on Windows and Unity 3.5 that would be appreciated.
    - It currently has a small but useful kernel of asserts. Looking for use cases for other asserts, or even pull requests!
    - Documentation because documentation.
     
  2. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
  3. _Shockwave

    _Shockwave

    Joined:
    Sep 2, 2012
    Posts:
    21
    Hey Andrew,

    This looks promising! Great work.

    It would be great to provide more examples of using this test framework. I had a look at the readme but the example given there is very basic and not representative of an actual scenario. Can you provide more real scenario tests?
     
  4. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
  5. _Shockwave

    _Shockwave

    Joined:
    Sep 2, 2012
    Posts:
    21
    Thank you very much. I read your blog post. It is very clear and well written. Well done.
    Since you can "Run tests from command line", have you tried hooking this up with a CI server?
     
  6. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,388
    very nice thanks!
     
  7. AdamSingle

    AdamSingle

    Joined:
    Apr 18, 2013
    Posts:
    9
    Hi Andrew,
    Fantastic looking library. I actually found your blog post before this thread. You mention using a mocking framework in the post, can I ask what it is? I've been looking for a mocking framework I can use for c# on my mac but haven't had any luck finding one yet.
     
  8. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
  9. AdamSingle

    AdamSingle

    Joined:
    Apr 18, 2013
    Posts:
    9
    Hi Andrew,

    Thanks for the reply, I have Unity's testing framework also, though I haven't tried it out yet. Moq is definitely my preference, it's what I use at work in a Windows environment, but I haven't been able to find a way to install moq on a mac, though I hadn't tried just getting it from github and trying to hook it into monodevelop. Perhaps your package is the easier option. Thanks again.
     
  10. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
    The package is definitely OSX compatible.

    For future reference, to make nuget packages* work in unity (on any platform) is longwinded but not complicated:
    - install this chrome extension: https://chrome.google.com/webstore/detail/nutake/ibhhbcaipjilldjkhhblhgdedjgoecap which will add a "download zip" hyperlink to every nuget project page on nuget.com
    - download and unzip your package of choice
    - in the unzipped package, find the dlls (they must all be managed dlls) and copy them to some folder under myunityproject/assets.
    - that's it! you can now use the package in your scripts

    * only fully-managed packages work. if there's a native component, it won't work on osx or webplayer.
     
  11. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    97
    Hey folks! This project isn't actively developed by me any more. It's still free, and still MIT licensed, but now I recommend if you're on 4.x+ using unity's first-party testing tools. https://www.assetstore.unity3d.com/#/content/13802

    They have more functionality than untest, and are under active development.

    If you're on 3.x, then these tools won't work, so feel free to use or fork untest. I know of one team using it in that way right now, so you won't be alone.