如何为Xamarin库项目(iOS和Android)运行单元测试? [英] How to run unit tests for Xamarin library projects (iOS and Android)?
问题描述
我正在为Xamarin组件商店创建一个组件,并为Android和iOS提供一个库.我已经将NUnit测试放入两个库项目中,但是无法运行单元测试.是否可以在Android/iOS库项目中执行测试?
I'm creating a component for the Xamarin Component Store, providing a Library for Android and iOS. I've put NUnit tests into both library projects but I can't run the unit tests. Is it possible to execute tests in a Android/iOS library project?
推荐答案
如果将库设为PCL,则可以创建一个链接到PCL的NUnit项目,并以此方式运行测试: https://dzwonsemrish7.cloudfront.net/items/0H3W383D2e031q1p3s40/Screen%20Shot%202013-08-12%20at%207.56.05%20PM.png?v=d5aac873
If you make your library a PCL, you can create a NUnit project that links to the PCL and run your tests that way: https://dzwonsemrish7.cloudfront.net/items/0H3W383D2e031q1p3s40/Screen%20Shot%202013-08-12%20at%207.56.05%20PM.png?v=d5aac873
Xamarin还为iOS提供了NUnitLite测试运行程序: http://docs.xamarin.com/guides/ios/部署,_测试,_and_metrics/touch.unit
Xamarin also provides a NUnitLite test runner for iOS: http://docs.xamarin.com/guides/ios/deployment,_testing,_and_metrics/touch.unit
使用最新版本的Xamarin Studio,您还可以创建一个Android单元测试项目: https://dzwonsemrish7.cloudfront.net/items/3v3x192S473g182C2S2a/Screen%20Shot%202013-08-12%20at%207.55.41%20PM.png?v=f0dce0f9
With the latest version of Xamarin Studio you can also create an Android Unit Test project: https://dzwonsemrish7.cloudfront.net/items/3v3x192S473g182C2S2a/Screen%20Shot%202013-08-12%20at%207.55.41%20PM.png?v=f0dce0f9
这篇关于如何为Xamarin库项目(iOS和Android)运行单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!