单声道Android系统。单元测试框架 [英] Mono Android. Unit test framework

查看:210
本文介绍了单声道Android系统。单元测试框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有支持单声道的Andr​​oid应用程序的一些单元测试框架? 我已经尝试过默认的Visual Studio测试框架和NUnit的框架,没有任何的运气。
我最后一次尝试:我创造了单声道的Andr​​oid类库引用nunit.framework,写测试。但是,当我试图推出他们我已经得到了异常:

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'

堆栈跟踪:

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)

我敢肯定,这是因为单声道的Andr​​oid组件与其他组件不兼容的...
所以我的问题:如何把它的工作?或者,也许有单声道Android应用一些其他的单元测试框架?

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:解决方法针对此问题
。 因为我需要测试的平台无关模型只有我刚刚创建单独的代理的Windows类库项目,并添加到其链接到的类模型从我的单声道为Android类库(项目=>添加现有项... => [选择这应该被添加为链接的所有文件] =>添加链接)。
所以,我收到任何单元测试框架组件,该组件包括类,它们应该测试兼容。

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.

推荐答案

如果你是寻找在Mono下运行您的Visual Studio单元测试机器人,我写了一个兼容层,与一个GUI在一起。

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.

检查出来这里

这篇关于单声道Android系统。单元测试框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆