Testing a Monotouch app with NUnit in MonoDevelop 2.4

倾然丶 夕夏残阳落幕 提交于 2019-12-05 21:22:37
poupou

In case you missed it, there is now a NUnitLite runner available for MonoTouch which is designed to work for UI agnostic code and executed on devices (or simulator).

See: .NET Unit test runner for iOS

Have written up a few details on what we have found to be best practice so far. You can find it here: http://ben.phegan.name/index.php/2011/02/28/monotouch-and-unit-testing. Would be happy to hear other ways of doing this.

Short answer:

  1. Add NUnit project to normal solution
  2. Add MonoTouch assemblies as references
  3. Write tests, avoiding testing anything that uses monotouch.dll (design patterns to abstract this stuff).
  4. Win!

I had the same problem:

This produces a build error complaining that "'[test project name].exe' does not contain a static 'Main' method suitable for an entry point."

Fixed by going into Project -> [Project name] Options -> Build General. Changed Compile Target to Library. I hadn't made a Main-method class yet, but will probably later; so then I'll change back.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!