我正在为 Xamarin Component Store 创建一个组件,为 Android 和 iOS 提供一个库。我已将 NUnit 测试放入两个库项目中,但无法运行单元测试。是否可以在 Android/iOS 库项目中执行测试?
最佳答案
如果您将库设为 PCL,则可以创建链接到 PCL 的 NUnit 项目并以这种方式运行测试: 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/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
关于android - 如何为 Xamarin 库项目(iOS 和 Android)运行单元测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18175191/