简体   繁体   English

iOS:从命令行运行单个单元测试

[英]iOS: Run a single unit test from the command line

I've been trying to find a way to run a single iOS unit test among multiple tests with the command line on an iOS device. 我一直在尝试找到一种方法,可以在iOS设备上使用命令行在多个测试中运行单个 iOS单元测试。

Here is what I've found thus far... 到目前为止,这是我发现的 ...

  • I can use xcodebuild test [options] to build & run every tests. 我可以使用xcodebuild test [options]生成并运行每个测试。
  • Found a tool called xctest in /Applications/Xcode.app/Contents/Developer/usr/bin . /Applications/Xcode.app/Contents/Developer/usr/bin找到了一个名为xctest的工具。 I've looked up in the man page and it is possible to run a single test. 我在手册页中进行了查找,可以运行一个测试。 When I try using it, I get an error stating that I'm using x86_64 architecture and then a posix error pops after. 当我尝试使用它时,出现一个错误,指出我正在使用x86_64体系结构,然后弹出posix错误。 This seems to indicate that it might be the xctest for Mac OS X apps. 这似乎表明它可能是Mac OS X应用程序的xctest
  • Found another xctest in for the iPhone Simulator.. but I want to run it on a iOS device 在iPhone模拟器中找到了另一个xctest 。.但是我想在iOS设备上运行它

I know that it is possible to select the tests I wish to run in a scheme, but this is problematic since I would need a very skillful & patient monkey to manually do this in a build system. 我知道可以选择我希望在方案中运行的测试,但这是有问题的,因为我需要一个非常熟练和耐心的猴子来在构建系统中手动执行此操作。

By the way, I am not using Apple's own Continuous Integration system with bots and using it is out of question because another build system is used for every other platform. 顺便说一句,我没有在机器人上使用Apple自己的持续集成系统,并且毫无疑问地使用它,因为每个其他平台都使用另一个构建系统。

My question is : How can I run a single unit test (XCTest) from the command line with build automation in mind? 我的问题是 :考虑到构建自动化,如何从命令行运行单个单元测试(XCTest)?


PS : I don't have any code signing issues. PS :我没有任何代码签名问题。

尝试使用可以在设备https://github.com/facebook/xctool上运行测试的xctool

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM