Are there some unit test frameworks which supports mono android applications?
I already tried default Visual Studio test framework and NUnit framework without any luck.
My last try: I created Mono Android class library, referenced nunit.framework, wrote tests. But when I tried to launch them I've got exception:
System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'mscorlib, Version=2.0.0.0'
Stack Trace:
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.TestLoader.LoadTest(String testName)
I'm sure that it's because of incompatibility of mono android assemblies with other assemblies...
So my question: How to put it to work? Or maybe there are some other unit tests frameworks for mono android applications?
UPD: Workaround for this issue.
Since I needed to test the platform independent models only I just created separate "proxy" Windows Class Library project and added to it links to model classes from my Mono for Android Class Library (Project => Add existing Item... => [select all files which should be added as links] => Add As Link).
So I received compatible with any Unit test framework assembly which consists of classes which should be tested.
If you're look for running your Visual Studio Unit Tests under Mono for Android, I've written a compatibility layer for that together with a GUI.
Check it out here
If you're looking to run your unit tests on devices (or inside the emulator) then you should have a look at Andr.Unit Mono for Android test runner for NUnitLite (0.6). It's similar (same UI and NUnitLite version) to Touch.Unit (iOS) even if it (currently) is a bit behind in terms of features (no network logging).
Disclaimer: I wrote the runner
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With