2

Xamarin.Forms アプリの UI テストを作成しています。iOS プロジェクトの最初のテストを開始しようとすると、System.Xml.XmlException(詳細は後述) が表示されます。この基本的なテストはうまくいくはずですよね?

更新: シミュレーターからアプリをアンインストールすると、テストが初めて実行されます。その後、次のすべての実行で例外が発生し続けます。

Xamarin Studio (6.1.3 ビルド 19) と Xamarin.UITest パッケージ (2.0.5) を使用しています。

namespace UITest
{
    [TestFixture (Platform.Android)]
    [TestFixture (Platform.iOS)]
    public class Tests
    {
        IApp app;
        Platform platform;

        public Tests (Platform platform)
        {
            this.platform = platform;
        }

        [SetUp]
        public void BeforeEachTest ()
        {
            app = AppInitializer.StartApp (platform);
        }

        [Test]
        public void AppLaunches ()
        {
            try {
                app.WaitForElement ("Waiting for fake element", "Timeout", new TimeSpan (0, 0, 20));
            } catch (TimeoutException ex) {
                int i = 5;
            }

            app.Screenshot ("Welcome screen.");
            app.Tap ("TestButton");
            app.Screenshot ("New test screen.");
        }
    }

    public class AppInitializer
    {
        public static IApp StartApp (Platform platform)
        {

            if (platform == Platform.Android) {
                return ConfigureApp
                    .Android

                    .StartApp ();
            }

            return ConfigureApp
                .iOS

                .Debug ()
                .EnableLocalScreenshots ()
                .StartApp ();
        }
    }
}

例外の詳細:

SetUp : System.Xml.XmlException : '', hexadecimal value 0x01, is an invalid character. Line 11, position 11.
    Stack trace:
      at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x0020a] in <e747267e258a4a668973c7ca7e9014a8>: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) [0x0007a] in <e747267e258a4a668973c7ca7e9014a8>:0 
      at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00302] in <e747267e258a4a668973c7ca7e9014a8>:0 
      at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <e747267e258a4a668973c7ca7e9014a8>:0 
      at UITest.AppInitializer.StartApp (Xamarin.UITest.Platform platform) [0x0001f] in /Users/samg/projects/myapp-mobile/myapp-mobile-2/UITest/AppInitializer.cs:38 
      at UITest.Tests.BeforeEachTest () [0x00008] in /Users/samg/projects/myapp-mobile/myapp-mobile-2/UITest/Tests.cs:26 
      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 /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
4

1 に答える 1