Tutorial: Run Connect IQ unit tests 2

In the previous tutorial we learned how to set up our project to be able to do unit testing, in case you didn’t read that article yet I’d advise to read it now as it’s rather essential when you also want to be able to set up unit tests for your own projects. So read the article how to create a unit test project first now. 🙂

Prerequisites for this tutorial

This tutorial is part of a tutorial series:
This tutorial continues where the last tutorial left of. If you did that tutorial you can continue with your code base or you can just download my project here instead.

Create the first unit test

First we’ll create a easy “hello world” Connect IQ unit test to get us started.
  • Create a new file StepsCarouselTests.mc under the source folder
  • In this new file we say hello world and return true to indicate succes:
The contents of the StepsCarouselTests.mc file will be:

Running unit tests

Since Connect IQ 2.3.1 it is possible to run unit tests from within the eclipse editor (in previous versions we had to rely on the command line).

The first thing we do is a create a no “Run No Evil” run profile, we do this by going to the menu run -> run configurations -> run no evil test. Click on the new launch configuration button in the button bar and create the following test profile (Select the watches you want to run the tests on by ticking the boxes – here we have all available watch targets of this test project enabled):



Now we only have to run the test, click the run button!

You’ll see several simulators flash by and when finished you see the results in the run no evil box, you can drill into the details by clicking on the “>” icon.

Source Code

You can download the full source code from github

Up next

In the next tutorial we’ll learn how to create unit tests which actually evaluate business logic.
.ads in wordpress

Feedback

Did you like this article?Questions?
  • Post in the comments section below!

2 thoughts on “Tutorial: Run Connect IQ unit tests

  1. Reply Robert Apr 5,2020 21:35

    I ‘think’ I have followed your instructions correctly and also check your code in GitHub, but i get the following error when I implement this tutorial using my datafield project. The error I get is:-

    BUILD: ERROR: unknown:0: A valid ‘project.manifest’ property was not defined within a jungle file.

    I am using the manifest.XML from the test project rather than the project being tested, is this correct?

    Much appreciated for any assistance

  2. Reply Zunido Jun 4,2020 18:55

    Not sure if its a Mac only issue, but the tests did not run unless my project folder names didn’t have spaces. I would have an error when trying to load the .prg file from bin folder.

Leave a Reply