Calling Rest Services as UI test prerequisites

I have a few UI tests that require a few prerequisites to run. These prerequisites are set up by making calls to API endpoints. To initiate the call I have a reference within my UI test project to the Portable project, so I can use the types, and use a APICallHelper class to make the required calls.

These prerequisites get set up correctly when I run the tests locally, however, when I upload to Test Cloud, the tests in question don't get past the app launch step and fail. The test log has the following error described in it:

SetUp : System.AggregateException : One or more errors occurred.
----> System.IO.FileNotFoundException : Could not load file or assembly or one of its dependencies.
at System.Threading.Tasks.Task.ThrowIfExceptional (Boolean includeTaskCanceledExceptions) <0x622c208 + 0x00043> in :0
at System.Threading.Tasks.Task1[TResult].GetResultCore (Boolean waitCompletionNotification) <0x622c170 + 0x00083> in <filename unknown>:0 at System.Threading.Tasks.Task1[TResult].get_Result () <0x622c0e8 + 0x0002f> in :0
at Expenses.UI.UnitTests.Helpers.LogonTasks.SuccessfulLogon () <0x5b364c0 + 0x000df> in :0
at Expenses.UI.UnitTests.Helpers.LogonTasks.CheckLogon () <0x5b36180 + 0x0001f> in :0
at Expenses.UI.UnitTests.Helpers.ExpenseCategoryTasks.CreateExpenseCategory () <0x5b35f90 + 0x0000f> in :0
at Expenses.UI.UnitTests.Expense.AddEditExpenseTests.ExpenseItemPreRequisties () <0x5b35cc0 + 0x0000f> in :0
at Expenses.UI.UnitTests.Expense.AddEditExpenseTests.BeforeEachTest () <0x5986848 + 0x002ab> in :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, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x2b7e070 + 0x00093> in :0
--FileNotFoundException
at RestSharp.Portable.HttpClient.Impl.DefaultHttpClientFactory..ctor () <0x622a628 + 0x0001b> in :0
at RestSharp.Portable.HttpClient.RestClient..ctor () <0x622a2b0 + 0x00073> in :0
at RestSharp.Portable.HttpClient.RestClient..ctor (System.Uri baseUrl) <0x622a268 + 0x00013> in :0
at RestSharp.Portable.HttpClient.RestClient..ctor (System.String baseUrl) <0x622a210 + 0x00043> in :0
at Expenses.Classes.ApiCallHelper+d__41[T].MoveNext () <0x6229168 + 0x0009f> in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x622c010 + 0x0002b> in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x622bbd0 + 0x000bb> in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x41f7a78 + 0x00083> in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x41f77c8 + 0x00033> in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () <0x622bb78 + 0x00017> in :0
at Expenses.Classes.ApiCallHelper+d__5.MoveNext () <0x5bfa860 + 0x0016f> in :0

At a guess, I set some of my references (system.net.http) to copy local so they would get uploaded with the test. However, the upload command line repeats "status: Validation completed. Waiting for devices xamarin test cloud" and never progresses from there.

Any advice would be appreciated on the issue.

Thanks in anticipation.

Best Answer

Answers

Sign In or Register to comment.