x


Unit testing for MonoBehaviours

I'd like to add unit testing to my scripts that derive from MonoBehaviour. But I'm having trouble implementing it. I've tried NUnit and currently I'm trying out NUnitLite, but in the end it doesn't really matter what library I use. I just want some unit tests for my MonoBehaviour scripts. I have no problem testing other classes, just the MonoBehaviour derivatives refuse to cooperate.

My question: Is it even possible to unit test MonoBehaviours? If so, how? Thanks for reading about my issue.

more ▼

asked Oct 19 '11 at 09:53 PM

jschipilow gravatar image

jschipilow
61 3 4 6

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

All right, so I figured something out. Here's what I did if anyone else has same issue.

I downloaded SharpUnit and it works, but not how I first expected. Instead of adding [Test] attributes above your class functions directly. You'll need to create a new separate class that inherits SharpUnit's TestCase, with this class you'll load your Mono game object and perform tests on it.

more ▼

answered Oct 20 '11 at 08:08 PM

jschipilow gravatar image

jschipilow
61 3 4 6

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3733
x133
x31
x7
x2

asked: Oct 19 '11 at 09:53 PM

Seen: 1378 times

Last Updated: Oct 20 '11 at 08:08 PM