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...

  • Preparation: in the SIM I select File > Delete All Apps

    Then I try following inside a powershell console:

    Step 1: going to the sdk path
    cd C:\Users\%USERPROFILE%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin

    Step 2: starting the sim
    .\connectiq

    Step 3: building the project (based on the output from eclipse console)
    java -jar C:\Users\%USERPROFILE%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin\monkeybrains.jar -o "<PROJECT_DIRECTORY>\bin\<PROJECT_NAME>.prg" -w -y "<KEYSTORE>" -d fenix6xpro_sim -s 3.2.0 -f "<PROJECT_DIRECTORY>\monkey.jungle"

    Step 3 - ALTERNATIVE (tried this instead of the step 3 above as well)

    .\monkeyc -d fenix6xpro_sim -f "<PROJECT_DIRECTORY>\monkey.jungle" -o "<PROJECT_DIRECTORY>\bin\phoenix-v2.2.prg" -y "<KEYSTORE>"

    Step 4: push the prg to the sim
    .\monkeydo "<PROJECT_DIRECTORY>\bin\phoenix-v2.2.prg" fenix6xpro

    Questions:

    That's nothing more than what eclipse does + pushing the prg to the sim. But this always results in an IQ logo on the SIM. Any ideas how I could solve that?

    Additionally, eclipse does build with fenix6xpro_sim not with fenix6xpro as device name, why? Using the fenix6xpro_sim in step 4 does not work (the sim shows an error that it can't find the device)

  • What do you see when you get the IQ error.  If you don't see anything, try in eclipse.

  • I gave a little more info in my last post. In eclipse, everything works, from powershell console, everything seems to work but after pushing the prg to the sim I get the IQ logo

    I did try without any code changes of course and all steps are reproducable. Eclipse always works, shell never works.

    I also don't see how eclipse pushes the prg to the sim, running monkeybrains.jar only builds the prg and eclipse does not give me any feedback on how it pushed the prg to the sim...

  • It's still an alpha version of the VS Code extension, and missing things like the App Settings editor.

    With the App Settings editor, you can create a series of .set files, and use those, copying the needed one to the sim's temp directory as needed for testing.  No need to develop your own app to build .set files.

    Even when testing a sideload, you can generate a .set file this way, copy to the device, and test things that way.

  • I've not yet tried VS Code yet but I may try it soon.

    Still, the upcoming question is, is it possible to build a project and push it to the sim on windows from the command line? Do you have an idea regarding this as well?

    I'm already finished with my script and it's quite compact - if I can get the build and push to sim process working from the command line it would be really nice

  • See the monkeydo command in the bin directory.

    C:connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin>monkeydo
    Pushes and runs a Connect IQ executable on the Connect IQ simulator. The simulator must be running for this command to succeed.

    Usage: monkeydo executable device_id [/t | /t test_name]
    executable - A Connect IQ executable to run.
    device_id - The device to simulate.
    test_name - When providing the test flag you may specify a one or more test names.

  • That's what I do after building the project: monkeydo "<PROJECT_DIRECTORY>\bin\phoenix-v2.2.prg" fenix6xpro

    This just results in the IQ Logo being displayed

  • Try fenix6xpro_sim instead

    when running in eclipse you'll see something  like this: "-d enduro_sim" in the command

  • I did try this as well... the monkeydo call fails with the sim postfix but the build step seems to work with and without it. I tested both but the result is always the same. Here's the full command line batch script I tested:

    @echo off 
    
    set root=%cd%
    
    REM ------------
    REM - SETTINGS
    REM ------------
    
    set sdk=%USERPROFILE%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin
    
    set projectName=...
    set projectPath=M:\dev\06 - garmin\%projectName%
    set devKey=M:\dev\02 - keystores\garmin_connect_iq_dev_key
    
    REM ------------
    REM - TEST
    REM ------------
    
    set device=fenix6xpro_sim
    set device2=fenix6xpro
    
    cd "%sdk%"
    echo Step 1: Starting SIM
    call connectiq.bat
    echo Step 2: Building project
    call monkeyc.bat -d %device% -f "%projectPath%\monkey.jungle" -o "%projectPath%\bin\%projectName%.prg" -y "%devKey%"
    echo Step 3: Pushing PRG to SIM
    call monkeydo.bat "%projectPath%\bin\%projectName%.prg" %device2%
    echo DONE
    cd %root%

    I think this should work but it seems like there is happening something else if I build my project with eclipse

  • With the App Settings editor, you can create a series of .set files, and use those, copying the needed one to the sim's temp directory as needed for testing.  No need to develop your own app to build .set files.

    Even when testing a sideload, you can generate a .set file this way, copy to the device, and test things that way.

    That was already suggested, but they specified that they wanted to create the settings *programmatically*.