1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    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
    Messages:
    90
    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
    Messages:
    90
  3. _Shockwave

    _Shockwave

    Joined:
    Sep 2, 2012
    Messages:
    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
    Messages:
    90
  5. _Shockwave

    _Shockwave

    Joined:
    Sep 2, 2012
    Messages:
    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
    Messages:
    1,386
    very nice thanks!
     
  7. AdamSingle

    AdamSingle

    Joined:
    Apr 18, 2013
    Messages:
    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
    Messages:
    90
  9. AdamSingle

    AdamSingle

    Joined:
    Apr 18, 2013
    Messages:
    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
    Messages:
    90
    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
    Messages:
    90
    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.