Hi Gents,
Finally I got it work.
First of all apologize for my irritation in previous messages. I was struggling with this for about 3-4 days and I was little disappointed that first time in my bitrise carrier something is not straightforward, although, eventually, it happens that mostly it was my fault.
So here is the summary of my thoughts, maybe it will help someone in the future:
- In Create Android Emulator step you will get $BITRISE_EMULATOR_NAME variable, use in:
- Start Android Step as Emulator to boot, here you will get at the end $BITRISE_EMULATOR_SERIAL, this one use
- Xamarin android Test step in Emulator serial to boot step.
- In Xamarin android Test remember that first two fields: Path to Xamarin Project and Path to Xamarin UITest Project requires to have path to .csproj file; not a .sln file!
- In Xamarin android Test you should use Release configuration in Xamarin project configuration field. Otherwise you will get error about Mono Shared Runtime: âMono Shared Runtime is not supported. This can be resolved by changing the project configuration or using a Release buildâ
- After build your UITest assembly must be presented first in /bin/ folder, 'cause step will take first library from directory. This one is actually a bug for me or at least misconception. I will raise an issue in this step github. As a workaround you can provide Assembly name in Output tab under Project Options.
- Finally, add Internet permission to you Android app, otherwise youâll get: âSystem.Exception : App does not contain permission âandroid.permission.INTERNETâ, please include this permissionâ. I donât suppose that somebody has an app without this permission; but I did dummy app with a simple button for test purposes and I needed to add this permission. Not sure why.
Last thing to add, Xamarin android Test step will try to run tests for both platforms (you can experience same behaviour in Xamarin iOS Test step). Not sure if this is âby designâ behaviour, or it is a bugâŠ
=> run unit test
NUnit Console Runner 3.4.1
Copyright (C) 2016 Charlie Poole
Runtime Environment
OS Version: MacOSX 16.3.0.0
CLR Version: 4.0.30319.42000
Test Files
/Users/vagrant/git/MobileTest/UISample/UITests/bin/AnyCPU/Release/AAA.UISample.UITests.dll
=> UISample.UITests.Tests(Android).SecondTestToCheckIfMultipleTestsAreWorking
Full log file: /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/uitest/log-2017-02-06_00-51-11-010.txt
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Android test running Xamarin.UITest version: 2.0.5
Initializing Android app on device emulator-5554 with apk: /Users/vagrant/git/MobileTest/UISample/Droid/bin/AnyCPU/Release/com.smt.uisample.uisample.apk
Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Signing apk with Xamarin keystore.
Waiting for element matching Marked(âHello World!â).
Using element matching Text(âClick me!â).
Tapping coordinates [ 383, 684 ].
Using element matching Text(âClick me!â).
Tapping coordinates [ 383, 684 ].
Using element matching Text(âClick me!â).
Tapping coordinates [ 383, 684 ].
Waiting for element matching Marked(âYou click it!â).
=> UISample.UITests.Tests(Android).WelcomeTextIsDisplayed
Full log file: /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/uitest/log-2017-02-06_00-53-00-345.txt
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Android test running Xamarin.UITest version: 2.0.5
Initializing Android app on device emulator-5554 with apk: /Users/vagrant/git/MobileTest/UISample/Droid/bin/AnyCPU/Release/com.smt.uisample.uisample.apk
Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Signing apk with Xamarin keystore.
Skipping installation: Already installed.
Waiting for element matching Marked(âHello World!â).
Using element matching Text(âClick me!â).
Tapping coordinates [ 383, 684 ].
Waiting for element matching Marked(âYou click it!â).
=> UISample.UITests.Tests(iOS).SecondTestToCheckIfMultipleTestsAreWorking
Full log file: /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/uitest/log-2017-02-06_00-54-24-372.txt
iOS test running Xamarin.UITest version: 2.0.5
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Sim check: App not installed.
1 - LaunchTestAsync:
deviceId: D0602EF4-CCAA-4169-A034-97AEEEB66952
1 - Launching simulator if not already running
=> UISample.UITests.Tests(iOS).WelcomeTextIsDisplayed
Full log file: /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/uitest/log-2017-02-06_00-55-34-901.txt
iOS test running Xamarin.UITest version: 2.0.5
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Sim check: App not installed.
7 - LaunchTestAsync:
deviceId: D0602EF4-CCAA-4169-A034-97AEEEB66952
7 - Launching simulator if not already running
Errors and Failures
- SetUp Failed : UISample.UITests.Tests(iOS)
One or more child tests had errors
Test Run Summary
Overall result: Failed
Test Count: 4, Passed: 2, Failed: 2, Inconclusive: 0, Skipped: 0
Failed Tests - Failures: 0, Errors: 2, Invalid: 0
Start time: 2017-02-06 08:51:10Z
End time: 2017-02-06 08:55:56Z
Duration: 285.345 seconds
Results (nunit3) saved as TestResult.xml
result: ï»ż<?xml version="1.0" encoding="utf-8" standalone="no"?>
<![CDATA[ at Xamarin.UITest.iOS.iOSAppLauncher.EnsureCalabashRunning (Xamarin.UITest.iOS.ICalabashConnection connection) [0x0000e] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient, Xamarin.UITest.Shared.Http.HttpClient xtcServicesClient, System.Boolean testCloudUseDeviceAgent) [0x00091] in :0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00302] in :0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
at UISample.UITests.Tests.BeforeEachTest () [0x00067] in <1e6e2a1aacd649268d505512ea3015eb>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <8f2c484307284b51944a1a13a14c0266>:0 ]]>
<![CDATA[ at Xamarin.UITest.iOS.iOSAppLauncher.EnsureCalabashRunning (Xamarin.UITest.iOS.ICalabashConnection connection) [0x0000e] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient, Xamarin.UITest.Shared.Http.HttpClient xtcServicesClient, System.Boolean testCloudUseDeviceAgent) [0x00091] in :0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00302] in :0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
at UISample.UITests.Tests.BeforeEachTest () [0x00067] in <1e6e2a1aacd649268d505512ea3015eb>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <8f2c484307284b51944a1a13a14c0266>:0 ]]>
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/vagrant/bitrise/xamarin/nunit/3.4.1/bin/nunit3-console.exe /Users/vagrant/git/MobileTest/UISample/UITests/bin/AnyCPU/Release/AAA.UISample.UITests.dll â failed
Actually, I am happy that it is working and for sure it is a nice alternative for Xamarin UI Cloud.
By the way, I could place somewhere my dummy Xamarin UI Tests POC along with bitrise proper configuration for future reference. Do we have such place somewhere? Or just give a link to github somewhere.
Cheers guys,
G