Hi,
I'm trying to set up UITests for iOS in Visual Studio for Mac, but always running into the same error:
SetUp : Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Failed to launch DeviceAgent
ExitCode: 65
I've tried setting up a completely blank iOS solution and followed every single step stated in the tutorial article.
I want to test in the simulator on my Mac.
Starting the app in the simulator works as expected.
I'm using following environment:
- Mac Pro, macOS 10.13.2
- Visual Studio Community 7.3.3
- Xamarin.iOS 11.6.1.3
- Xamarin.Mac 4.0.0.215
- Xamarin.UITest 2.2.3 (in UITests project)
- Nunit 3.9.0 (in UITests project)
- Xamarin.TestCloud.Agent 0.21.4 (in iOS project)
I've tried various simulators (like iPhone 7,8,X and so on, running on iOS 11.2).
In Tests.cs I'm using the default template. Also, the app is included in the solution.
So when running the test, the simulator first starts up, the DeviceAgent is being installed and opened (black screen).
After that the DeviceAgent closes again, and installes itself again one more time. After that, DeviceAgent is being opened and stays at a black screen.
The test failes in VS17 and returns the error stated below.
I've tried deleting the 'XDB' folder inside /var/folders/ as adviced in a stackoverflow question.
Thanks for any kind of advice, I'm running out of ideas.
namespace testinguitests.UITests
{
[TestFixture]
public class Tests
{
iOSApp app;
[SetUp]
public void BeforeEachTest()
{
// TODO: If the iOS app being tested is included in the solution then open
// the Unit Tests window, right click Test Apps, select Add App Project
// and select the app projects that should be tested.
//
// The iOS project should have the Xamarin.TestCloud.Agent NuGet package
// installed. To start the Test Cloud Agent the following code should be
// added to the FinishedLaunching method of the AppDelegate:
//
// #if ENABLE_TEST_CLOUD
// Xamarin.Calabash.Start();
// #endif
app = ConfigureApp
.iOS
// TODO: Update this path to point to your iOS app and uncomment the
// code if the app is not included in the solution.
//.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/testinguitests.UITests.iOS.app")
.StartApp();
}
[Test]
public void AppLaunches()
{
app.Screenshot("First screen.");
}
}
}
Log:
Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Failed to launch DeviceAgent
ExitCode: 65
IDEDerivedDataPathOverride = /var/folders/_q/hwspjqfx5t9253vx5v0h6_q00000h2/T/xdb/logs/2018.02.22.104544/DerivedData
IDETestRunSpecificationPath = /var/folders/_q/hwspjqfx5t9253vx5v0h6_q00000h2/T/xdb/logs/2018.02.22.104544/DeviceAgent-simulator.xctestrun
t = 0.00s Start Test at 2018-02-22 10:45:52.806
t = 0.05s Set Up
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.000) seconds
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.002) seconds
SimDevice: iPhone 8 (9F9DF7AF-1095-44D2-9700-C40686870319, iOS 11.2, Booted)
SimDevice: iPhone 8 (9F9DF7AF-1095-44D2-9700-C40686870319, iOS 11.2, Booted)
** TEST EXECUTE FAILED **
/var/folders/_q/hwspjqfx5t9253vx5v0h6_q00000h2/T/com.apple.dt.XCTest/IDETestRunSession-40AA227C-4A68-48C4-A74E-25093797C52F/DeviceAgent-FEADC885-A026-41AE-BF47-1D3CE5DE4A32/Session-DeviceAgent-2018-02-22_104545-QrveLk.log
/var/folders/_q/hwspjqfx5t9253vx5v0h6_q00000h2/T/com.apple.dt.XCTest/IDETestRunSession-40AA227C-4A68-48C4-A74E-25093797C52F/DeviceAgent-FEADC885-A026-41AE-BF47-1D3CE5DE4A32/Session-DeviceAgent-2018-02-22_104555-RnirS3.log
} (11.2 (15C107))
} (11.2 (15C107))
2018-02-22 10:45:45.752 xcodebuild[71952:396632948] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
2018-02-22 10:45:45.753 xcodebuild[71952:396632892] [MT] IDETestOperationsObserverDebug: (FA7488EE-3C05-4150-928B-DF857EE78E60) Beginning test session DeviceAgent-FA7488EE-3C05-4150-928B-DF857EE78E60 at 2018-02-22 10:45:45.753 with Xcode 9C40b on target <DVTiPhoneSimulator: 0x7fbfc3879b20> {
2018-02-22 10:45:50.094 DeviceAgent-Runner[71976:396633348] +[CATransaction synchronize] called within transaction
2018-02-22 10:45:50.183 DeviceAgent-Runner[71976:396633348] Running tests...
2018-02-22 10:45:52.162 DeviceAgent-Runner[71976:396633348] Continuing to run tests in the background with task ID 1
2018-02-22 10:45:52.857 DeviceAgent-Runner[71976:396633348] TEST RUNNER IS STARTING
2018-02-22 10:45:55.245 xcodebuild[71952:396632892] [MT] IDETestOperationsObserverDebug: (6C8BA8B4-1929-4BE0-9C3C-46CA3CDD4EF1) Beginning test session DeviceAgent-6C8BA8B4-1929-4BE0-9C3C-46CA3CDD4EF1 at 2018-02-22 10:45:55.246 with Xcode 9C40b on target <DVTiPhoneSimulator: 0x7fbfc3879b20> {
2018-02-22 10:45:55.245 xcodebuild[71952:396633175] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
2018-02-22 10:45:58.024 DeviceAgent-Runner[71994:396634283] +[CATransaction synchronize] called within transaction
2018-02-22 10:45:58.059 DeviceAgent-Runner[71994:396634283] Running tests...
2018-02-22 10:45:58.299 DeviceAgent-Runner[71994:396634283] Continuing to run tests in the background with task ID 1
Restarting after unexpected exit or crash in TestRunner/testRunner; summary will include totals from previous launches.
Test Case '-[TestRunner testRunner]' started.
Test Suite 'All tests' started at 2018-02-22 10:45:52.802
Test Suite 'DeviceAgent.xctest' failed at 2018-02-22 10:45:58.913.
Test Suite 'DeviceAgent.xctest' started at 2018-02-22 10:45:52.803
Test Suite 'DeviceAgent.xctest' started at 2018-02-22 10:45:58.913
Test Suite 'Selected tests' failed at 2018-02-22 10:45:58.914.
Test Suite 'Selected tests' started at 2018-02-22 10:45:58.912
Test Suite 'TestRunner' started at 2018-02-22 10:45:52.805
User defaults from command line: