forked from mgants4/SharpUnit
Unit testing framework for Unity3D in C#
License
eckyputrady/SharpUnit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
SharpUnit is a unit testing framework written in C# specifically for Unity3D. It was inspired by and adapted from UUnit, which is written in Boo. More info on UUnit can be found here: http://www.unifycommunity.com/wiki/index.php?title=SharpUnit Why SharpUnit? - Because NUnit is not so easy to integrate into Unity3D. - UUnit works but, while I personally like Boo, not everyone is familiar/comfortable with programming in Boo. - SharpUnit allows you to trap/expect exceptions, UUnit does not (as of today). - SharpUnit can easily be integrated into Unity3D but is not dependant on the Unity3DEngine namespace. - SharpUnit can easily extended and tested outside of Unity3D and even be used for other purposes. - SharpUnit is straight-forward and easy to use. Getting Started: - The Visual Studio solution contains two projects: SharpUnit and SharpUnitTest - SharpUnit: This is the class library that can be built to a DLL. - SharpUnitTest: This is a console app that runs the unit tests for SharpUnit itself. - The Main() function in Program.cs is an example test runner, it illustrates how to get up and running with SharpUnit. - The Unity3D folder contains an actual Unity3D 4.0 project using SharpUnit. Integrate to your own project: - Copy Unity3D\Assets\Plugins\SharpUnit into <your project>\Assets\Plugins\SharpUnit - Alternatively, you can replace SharpUnit.dll with all cs files in SharpUnit\Src Running Tests in Unity3D: - Please see the Unity3D example, particulaly the "TestRunner0.cs" Extending SharpUnit: - Derive a new class from TestReporter to modify how SharpUnit reports test results and errors. Tips & Tricks: - Depending on your project and how you write your tests, you might notice that SharpUnit can leave "extra" or "duplicate" objects in your scene. This tends to happen if you don't clean up after your tests in the "tear down" methods or if you make use of automatic Singletons, etc. To mitigate this, consider opening a fresh scene before you run the unit tests and close it after the tests have run. I recommend automating this with a static method labeled as a Unity editor "menu item." Works well when running tests in the editor or as part of of your build process as it keeps your scenes free of extra test artifacts that may appear. More on menu items: http://unity3d.com/support/documentation/ScriptReference/MenuItem.html
About
Unit testing framework for Unity3D in C#
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C# 95.8%
- Perl 4.2%