Xamarin.UITest : UItest for Splash Screen

ana_riana_ri Member ✭✭

How to do a UI test for splash screen?

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @ana_ri said:
    How to do a UI test for splash screen?

    I wouldn't bother personally. Not unless I had automated testing of all of the functionality of the app and still had time to spare.

    If you do try to test the appearance of the splash screen, you'll likely have to handle a race condition, in the form of does the splash screen appear and disappear before your test gets a chance to capture the screen.

    However, if you ignore the race condition for the moment, the basic test would be as follow:

    Set splashScreenAppeared flag = false
    Start app
    
    // you might want to put a maximum elapsed time or iteration count here as well
    while ((splashScreenAppeared == false) && (main screen of app has not appeared))
    {
        Capture screen image
        Compare screen image against expected screen image for the current screen resolution
        If images match
            splashScreenAppeared = true
        else
            wait 100ms
    }
    
    if (splashScreenAppeared == true)
        Test passed
    else
        Test inconclusive // due to possible race condition
    
  • ana_riana_ri Member ✭✭

    @JohnHardman said:

    @ana_ri said:
    How to do a UI test for splash screen?

    I wouldn't bother personally. Not unless I had automated testing of all of the functionality of the app and still had time to spare.

    If you do try to test the appearance of the splash screen, you'll likely have to handle a race condition, in the form of does the splash screen appear and disappear before your test gets a chance to capture the screen.

    However, if you ignore the race condition for the moment, the basic test would be as follow:

    Set splashScreenAppeared flag = false
    Start app
    
    // you might want to put a maximum elapsed time or iteration count here as well
    while ((splashScreenAppeared == false) && (main screen of app has not appeared))
    {
        Capture screen image
        Compare screen image against expected screen image for the current screen resolution
        If images match
            splashScreenAppeared = true
        else
            wait 100ms
    }
    
    if (splashScreenAppeared == true)
        Test passed
    else
        Test inconclusive // due to possible race condition
    

    Hey I'm new to this..I'm unable to implement it

  • JohnHardmanJohnHardman GBUniversity mod
    edited October 2018

    @ana_ri said:
    How to do a UI test for splash screen?

    @JohnHardman said:
    I wouldn't bother personally. Not unless I had automated testing of all of the functionality of the app and still had time to spare.

    @ana_ri said:
    Hey I'm new to this..I'm unable to implement it

    I go back to my initial comment. Whilst the splash screen might be the first thing an app's user sees, it is not a priority IMHO for automated testing. Concentrate on testing functionality, build your UITest experience on the tests that matter, and then once you are done on the functional tests you may have a better feel for how to do testing of less important (and possibly trickier) things. As per my pseudo-code in the previous post, getting a Test Passed/Test Failed result rather than a Test Passed/Test Inconclusive result on splash screen testing will be problematic.

  • ana_riana_ri Member ✭✭
    edited October 2018

    @JohnHardman said:

    @ana_ri said:
    How to do a UI test for splash screen?

    @JohnHardman said:
    I wouldn't bother personally. Not unless I had automated testing of all of the functionality of the app and still had time to spare.

    @ana_ri said:
    Hey I'm new to this..I'm unable to implement it

    I go back to my initial comment. Whilst the splash screen might be the first thing an app's user sees, it is not a priority IMHO for automated testing. Concentrate on testing functionality, build your UITest experience on the tests that matter, and then once you are done on the functional tests you may have a better feel for how to do testing of less important (and possibly trickier) things. As per my pseudo-code in the previous post, getting a Test Passed/Test Failed result rather than a Test Passed/Test Inconclusive result on splash screen testing will be problematic.

    I know it's not priority but I have a assigned task to test splash screen and I have to submit by tomorrow morning.
    I don't know what to do as I'm new to Xamarin.UITest and I didn't find anything online related to splash screen test.
    So if possible can you please help?

  • JohnHardmanJohnHardman GBUniversity mod
    edited October 2018

    @ana_ri said:
    I don't know what to do as I'm new to Xamarin.UITest and I didn't find anything online related to splash screen test.

    How to do it would unfortunately depend on how the splash screen was implemented. It would almost certainly require different implementations for Android and iOS. You would also almost certainly need to bypass the usual UITest operations (using the UITest API you need the interface that provides screenshots, but you need that interface before the main page of the app appears). It's a lot of work for something that will not produce a Pass/Fail result, but just a Pass/Inconclusive result. Let's say that you do implement the test and the test gets included in your company's continuous integration build system. Because of the Pass/Inconclusive result, the build system will inevitably fail at least intermittently on that test. Whoever assigned the task to you will not want the build system failing. Show him/her this thread.

    If you Google how to do this without including Xamarin or UITest in the search criteria, you will still get very few matches, most (but not all) of which are asking a question that goes unanswered. That should be a pretty good indication of how complex this is and/or how low priority such a test is and/or how undesirable the inconclusive result is.

    [One caveat - if the developers add backdoors that you can utilise during automated testing, that could resolve the inconclusive result problem. Whether the project manager/project owner would want that done is another matter]

  • ana_riana_ri Member ✭✭

    @JohnHardman said:

    @ana_ri said:
    I don't know what to do as I'm new to Xamarin.UITest and I didn't find anything online related to splash screen test.

    How to do it would unfortunately depend on how the splash screen was implemented. It would almost certainly require different implementations for Android and iOS. You would also almost certainly need to bypass the usual UITest operations (using the UITest API you need the interface that provides screenshots, but you need that interface before the main page of the app appears). It's a lot of work for something that will not produce a Pass/Fail result, but just a Pass/Inconclusive result. Let's say that you do implement the test and the test gets included in your company's continuous integration build system. Because of the Pass/Inconclusive result, the build system will inevitably fail at least intermittently on that test. Whoever assigned the task to you will not want the build system failing. Show him/her this thread.

    If you Google how to do this without including Xamarin or UITest in the search criteria, you will still get very few matches, most (but not all) of which are asking a question that goes unanswered. That should be a pretty good indication of how complex this is and/or how low priority such a test is and/or how undesirable the inconclusive result is.

    [One caveat - if the developers add backdoors that you can utilise during automated testing, that could resolve the inconclusive result problem. Whether the project manager/project owner would want that done is another matter]

    Ok I think you're right.
    Can you tell me how can I take screenshot of splash screen?

  • JohnHardmanJohnHardman GBUniversity mod

    @ana_ri said:
    Can you tell me how can I take screenshot of splash screen?

    See previous answer.

    @JohnHardman said:
    How to do it would unfortunately depend on how the splash screen was implemented.

    We're going around in circles here, so I'm going to drop out of this thread now

Sign In or Register to comment.