0

Hola amigos estoy aprendiendo a usar UITest de Xamarin, esto es todo lo que estoy intentando hacer

  #region
    const string sp = "splash_screen";


    #endregion
    public MyTest(Platform platform) : base(platform)
    {} 
    [Test]
    public void firstTest()
    {
        // aaa testing model
        // arrange
        app.WaitForElement ((sp),$"unable to load {sp} ",TimeSpan.FromSeconds(40));
        app.Screenshot($"{sp} screen shot ");
        //act
        //assert
    }

Pero me tira el error "unable to load ..." , por lo que entiendo de que no encuentra mi vista. Segun la documentacion https://docs.microsoft.com/en-us/appcenter/test-cloud/uitest/ , podria llamar a mis elementos de ANDROID por

the Id of the view

the ContentDescription of the view

the Text of a view

(sitando la documentacion)

Este es el

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/splash_screen"
>

y este es el error que me da.

   firstTest
   Duration: 54.6 sec

  Message: 
    System.Exception : Error while performing WaitForElement(Marked("splash_screen"), "unable to load splash_screen ", 00:00:40, null, null)
      ----> System.TimeoutException : unable to load splash_screen 
  Stack Trace: 
    ErrorReporting.With[T](Func`1 func, Object[] args, String memberName)
    AndroidApp.WaitForElement(Func`2 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout)
    AndroidApp.WaitForElement(String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout)
    MyTest.firstTest()
    --TimeoutException
    WaitForHelper.WaitForAny[T](Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout)
    <>c__DisplayClass80_0.<WaitForElement>b__0()
    ErrorReporting.With[T](Func`1 func, Object[] args, String memberName)

   Open additional output for this result

Alguien sabe en que estoy fallando

1 respuesta 1

0

Si alguien le sirve y se le presta un error similar, resulta ser muy simple, esto pasa cuando lo que estas testeando no coinicide con el archivo apk generado, entonces para que puedas encontrar siempre tus xml's despues de un cambio hay que hacer release y que ese apk tengo las vistas con los identificadores que buscas,dado que UITest siempre lee el akp para ejecutarse y no un referencia hacia otro proyecto, de otra forma aparecera ese error. SIEMPRE HACER RELEASE ANTES DE HACER TEST

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.