C# Xamarin.UITest REPL连接被拒绝

C# Xamarin.UITest REPL连接被拒绝,c#,xamarin.android,C#,Xamarin.android,我正在Xamarin Studio中使用Xamarin.UITest开始UI自动测试。我正在使用Xamarin提供的基本CreditCardValidator项目。我的测试按预期工作,但当我尝试添加行app.Repl()时要查询UI并输入树命令(或任何其他命令),我会不断得到错误: App has been initialized to the 'app' variable. Exit REPL with ctrl-c or see help for more commands. >&g

我正在Xamarin Studio中使用Xamarin.UITest开始UI自动测试。我正在使用Xamarin提供的基本
CreditCardValidator
项目。我的测试按预期工作,但当我尝试添加行
app.Repl()时
要查询UI并输入
命令(或任何其他命令),我会不断得到错误:

App has been initialized to the 'app' variable.
Exit REPL with ctrl-c or see help for more commands.

>>> tree                                                                        
Execution failed with exception: System.Net.WebException: Error: 
ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) <0x3acc998 + 0x0017b> in <filename unknown>:0 
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) <0x3aca8f8 + 0x004b7> in <filename unknown>:0 
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) <0x3acdbe8 + 0x00187> in <filename unknown>:0 
at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (IAsyncResult iar, System.Func`2 endFunction, System.Action`1 endAction,     System.Threading.Tasks.Task`1 promise, Boolean requiresSynchronization) <0x1944280 + 0x00069> in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x18aa010 + 0x00035> in <filename unknown>:0 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x18a7830 + 0x000b7> in <filename unknown>:0 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x18a7790 + 0x00087> in <filename unknown>:0 
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x18a7740 + 0x0003f> in <filename unknown>:0 
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () <0x18a8040 + 0x00024> in <filename unknown>:0 
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () <0x3abbe30 + 0x00df3> in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.UITest.Shared.Http.HttpClient.Request (System.String method, System.String endpoint, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut) <0x3aadc68 + 0x0040f> in <filename unknown>:0 
at Xamarin.UITest.Shared.Http.HttpClient.Get (System.String endpoint, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut) <0x3aadc18 + 0x0003b> in <filename unknown>:0 
at Xamarin.UITest.Android.AndroidGestures.Dump () <0x3aadb18 + 0x00053> in <filename unknown>:0 
at Xamarin.UITest.Utils.TreePrintHelper.PrintTree (ITreePrinter treePrinter) <0x3aada28 + 0x0002a> in <filename unknown>:0 
at Xamarin.UITest.Queries.AppPrintHelper.Tree (Nullable`1 console) <0x3aad950 + 0x0008b> in <filename unknown>:0 
at <InteractiveExpressionClass>.Host (System.Object& $retval) <0x3aad830 + 0x00047> in <filename unknown>:0 
at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) <0x2ede1b0 + 0x0008f> in <filename unknown>:0 
at Xamarin.UITest.Repl.Evaluation.MonoCSharpReplEngine.Evaluate (System.String line) <0x2ede0a0 + 0x00057> in <filename unknown>:0 
at Xamarin.UITest.Repl.Repl.ReplFacade.RunCode (System.String code) <0x2edde88 + 0x00063> in <filename unknown>:0 
at Xamarin.UITest.Repl.PromptHandler.PrintTree () <0x3aa4e50 + 0x0001f> in <filename unknown>:0 
at Xamarin.UITest.Repl.PromptHandler.HandleInput (ConsoleKeyInfo key) <0x3a38520 + 0x001da> in <filename unknown>:0 
at Xamarin.UITest.Repl.Program.Main (System.String[] args) <0x71def8 + 0x003ef> in <filename unknown>:0 
Press any key to exit.
我也使用了Xamarin的葫芦框架,我可以使用
控制台
命令查询应用程序。不确定这对Xamarin.UITest不起作用


我正在运行Java 1.7、NUnit 2.6.3和Xamarin Studio 6.0.1(build 9)

您打算在什么上运行测试?它是一个模拟器还是一个物理设备?我在模拟器和物理设备上都试过,但运气都不好。我每天都在与这些神秘的Repl/UI测试部署错误作斗争,但我从来没有见过这种错误。我的第一个猜测是包括互联网许可,但你已经有了。想到的唯一可能的解决方案是:1)拥有最新的开发版本的Xamarin.UITest 2)让IDE进行部署,而不是直接引用APK路径3)在调试/发布模式之间切换(如果在调试中,则禁用共享运行时)4)禁用任何代理、VPN连接或其他服务(即Fiddler)这可能会造成干扰。我会尝试这些建议并让你知道。感谢所有人,除了让IDE进行部署。我不知道该怎么做。有什么建议吗?
public class RecorderTest
{
    public IApp app;
    [SetUp]
    public void Setup()
    {
        app = ConfigureApp.Android.Debug().ApkFile(<path/to/apk/>).StartApp();
    }

    [Test]
    public void CreditCardNumberTooShortError()
    {
        //app.Repl();
        app.Tap(x => x.Id("creditCardNumberText"));
        app.Screenshot("Tapped on view with class: AppCompatEditText");
        app.EnterText(x => x.Id("creditCardNumberText"), "1234");
        app.Tap(x => x.Id("validateButton"));
        app.Screenshot("Tapped on view with class: AppCompatButton");

        AppResult[] result = app.Query(c => c.Class("AppCompatTextView").Text("Credit card number is too short."));
        Assert.IsTrue(result.Any(), "The error message is not being displayed");
}

    [Test]
    public void CreditCardNumberTooLongError()
    {
        app.Repl();
        app.EnterText(x => x.Marked("creditCardNumberText"), new String('9', 17));
        app.Screenshot("Entered Credit card number");
        app.Tap(x => x.Id("validateButton"));
        app.Screenshot("Tapped on view with class: AppCompatButton");

        AppResult[] result = app.Query(c => c.Id("errorMessagesText").Text("Credit card number is too long."));
        Assert.IsTrue(result.Any(), "The error message is not being displayed");
    }

}