我调用let app = XCUIApplication()时出现NSInternalInconsistencyException

时间:2018-03-15 15:09:39

标签: ios swift xcode-ui-testing

我测试中的无聊代码:

import gobject
import dbus.mainloop.glib
import os
import sys
import time
import bluetooth as bt

dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

os.system("hciconfig hci0 up")
os.system("hciconfig hci0 piscan")
os.system("hciconfig hci0 iscan")

print "Socket handler ..."
sock_control = bt.BluetoothSocket(bt.L2CAP)
sock_interrupt = bt.BluetoothSocket(bt.L2CAP)

print "Bind ..."
sock_control.bind(("",17))
sock_interrupt.bind(("",19))

print "Listen ..."
sock_control.listen(1)  # Limit of 1 connection
sock_interrupt.listen(1)

print "Waiting for a connection..."
conn_control, conn_info = self.sock_control.accept()
print "Got a connection on the control channel from ", self.conn_info[0]
conn_interrupt, conn_info = self.sock_interrupt.accept()
print "Got a connection on the interrupt channel from " + self.conn_info[0]

while True:
    data = 0x00001e0000000000
    conn_interrupt.send(str(data))
    time.sleep(1)
    data = 0x0000000000000000
    conn_interrupt.send(str(data))
    mainloop = gobject.MainLoop()
    mainloop.run()

给我这个错误:

捕获" NSInternalInconsistencyException","没有通过测试配置指定目标应用程序路径:

1 个答案:

答案 0 :(得分:1)

您需要在Xcode中指定UI测试目标的目标应用程序。为此,请转到UI测试目标的常规设置,然后选择目标应用程序。

见下文enter image description here