After adding a MonoTouch Unit Tests Project I have to run the tests through the simulator. Since most of my tests don't test the UI, is there a way to run tests through MonoDevelop like the normal nunit project?
1 Answers
is there a way to run tests through MonoDevelop like the normal nunit project?
Depending on your unit tests you might still continue to use the normal Unit Test projects. They will be executed by the MonoDevelop's test runner which runs under the normal/desktop .NET runtime (e.g. Mono) under the host operating system (e.g. OSX).
So if you have pure C# test code that does not depend on anything iOS specific then this option is always available.
In contrast MonoTouch Unit Tests Project are meant to be executed using the Touch.Unit test runner under iOS (simulator or devices). As such it must be an application since it is not possible (i.e. allowed under iOS) for a general runner (or any other) application to download and execute code (e.g. a library containing your tests).
Other than the runner the projects are basically just a reference to a NUnitLite (0.6) assembly to give you a unit testing framework.
Since most of my tests don't test the UI
Touch.Unit is not meant to run UI tests - just like NUnit (with it's GUI runner) was not meant to unit test System.Windows.Forms applications. The fact that it provides an UI makes it harder to test (some) UI components.
Touch.Unit's main goal is to allow you to run your test under the same conditions (e.g. CPU, memory) and limitations (e.g. AOT) that a real iOS device (or, to a lesser extent, the iOS simulator) would have - while giving you access to every iOS specific API (supported by the device or the simulator).
-
The project I'm unit testing has a WCF reference, which is then referenced by the actual iOS/MonoTouch project. In order to be able to add the project as a reference and use the right WCF assemblies I had to make the WCF project MonoTouch compatible. By doing that now I can only unit test using the Touch.Unit, but I don't need to reference any iOS APIs. Am I doing something wrong? – Jonas Stawski Apr 03 '12 at 17:28
-
I'm no WCF expert but MonoTouch provides only a subset of WCF. So I would *guess* that the generated code, working on MonoTouch, would work too (once recompiled) against the full framework (which is used for the *normal* test runner). You might have to create a separate project (or at least configuration) for your WCF code (to get the full framework references) and then link the (same) sources (from the existing project to the new one). – poupou Apr 03 '12 at 17:46
-
As far as I know Monotouch uses the moonlight WCF References. Regardless, it's getting too convoluted, I'll just run it using Touch.Unit and the emulator – Jonas Stawski Apr 03 '12 at 17:59
-
Yes, MonoTouch supports the Silverlight WCF *subset* (from the Moonlight code base). AFAIK this is a *subset* of the full framework but there could be a few differences, as there were for other SL API (many of Silverlight API additions made their way back to .NET 4.0 BCL). – poupou Apr 03 '12 at 18:17