Automatic UI tests with SIM

Is there any way to make some automatic UI tests (without writing them inside the code)?

Idea 1

I'm thinking about something like following:

  • start the SIM and switch a list setting every x seconds
  • after this test, switch to the next supported device (or to the next device inside a test cases defined devices) and repeat this

Anyone does something like this automatically? Maybe via a script (I've not seen any script support for the SIM yet though).

Idea 2

Alternatively, define settings with a script (e.g. a settings.xml file), start the SIM with this setting file and automatically export a screenshot.

Why?

I want to test all my data fields on all supported models - exporting screenshots automatically would be a great help. I would not care about speed, I can let this test run and then check the screenshots to find UI problems whenever the test is finished.

I'm open to any alternative idea as well...

  • It's weird, I do exactly what eclipse does but it does not work. And everything you tell me let's me assume that there is nothing special in what eclipse does...

    My 2 test cases are following (test2 is a 1:1 copy of what eclipse does) and I put my test.bat into the root directory of my project (just where the eclipse projects root is as well) to make sure this is not problem, but still it fails... The build process even prints out the same warnings as it does in eclipse (missing translations in my case).

    @echo off
    
    set devKey=M:\dev\02 - keystores\garmin_connect_iq_dev_key
    set sdk=%USERPROFILE%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin
    set java=%USERPROFILE%\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin
    
    rem goto :TEST2
    
    :TEST1
    call %sdk%\connectiq
    call %sdk%\monkeyc -d fenix6xpro_sim -f monkey.jungle -o tmp.prg -y "%devKey%" -s 3.2.0 -w
    call %sdk%\monkeydo tmp.prg fenix6xpro
    goto :END
    
    :TEST2
    call %sdk%\connectiq
    call %java%\java -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %sdk%\monkeybrains.jar -o tmp.prg -w -y "%devKey%" -d fenix6xpro_sim -s 3.2.0 -f monkey.jungle
    call %sdk%\monkeydo tmp.prg fenix6xpro
    
    :END

    Still thanks for all your effort

  • No worries! I can only reiterate my suggestion about trying the same with a simple-as-possible barebones project. (e.g. Create simple datafield from scratch, and simply return "42" or something in compute.)

    Once you get that working, you can look into why your more complex project isn't working.

  • I found the "issue".... I do have spaces in my projects path - if I copy my project to a space free path, everything is working

    It's weird though, because the test.bat file above does only use relative paths to the batch files working directory...

  • Glad you got it sorted out!

    I think the compiler probably resolves the full absolute path of the jungle file specified with -f. (I think jungle files are assumed to be at the root of the project.)

    That, in combination with the spaces in project path and your relative paths ("../shared*") in the jungle file is probably what trips it up. I seem to recall bugs have been reported with spaces in project paths before, so this may be the same bug or a remnant of the original bug (an edge case that wasn't covered.)

    (Ofc that doesn't exactly explain why it works in Eclipse and not from the command line. I'm sure we could figure it out with some digging but it may not be worth the time haha.)

    If I'm not mistaken, you'll find that you can launch monkeyc from *any* working directory as long as the path to the jungle file(s) can be resolved.

  • I published my project including an example watchface here:

    https://github.com/MFlisar/GarminUITestScript

    I could test my project successfully with it and I've written it in a way that it should be useable for others as well - I also added some documentation.

    If you want to try it - there is nothing to do in the scripts, simply make your adjustments in the 2 .dat files

  • Thanks! I see you generated new settings by simply changing the default properties in the resource XML. That's a such an obvious approach in hindsight haha. (I was too focused on how it would be done *without* changing the application source.)

  • Correct. This way you are also completely independent from the settings update functionality and if you compare the build time with time that the settings editor needs to open and push new settings to the SIM you don't even lose time this way...

  • Of course, you can, and one of the easiest and safest options is to let some professionals take care of it. For example, I have been using this platform: https://www.zaptest.com/ui-testing-automation for over a year and am more than satisfied with their work. Moreover, they helped me complete all the projects I needed, and a lot of useful information is posted on their website, which you can use as guides and sources of information to get more knowledge and find more information which I believe it's fantastic.