Can't run JUnit on Demo-Widget using build-firmware-singleapp as the module nature

As said on title, I couldn’t use JUnit with build-firmware-singleapp as the module nature, and according to this JUnit documentation it should be the expected result as it says it can only be used with

microej-javalib (MicroEJ Add-On Library) or the microej-application (MicroEJ Applications) build type

but upon checking the module nature documentation I found that firmware-singleapp inherits Test Suite so I expected it to run JUnit

Hi,

Can you share the versions you are using :

  • SDK version
  • Build type version in module.ivy (attribute revision of ea:build element), for example:

Hi @frederic.riviere , the build module I could use JUnit on was “build-microej-javalib” version 5.0.+, I don’t know if this is the only one that I can use JUnit on but that’s the first one I tried that worked, the only problem I had was when trying to use “build-firmware-singleapp” version 1.4.+

@ricardobna Hi,
I’m not sure to understand the problem you encounter. What do you mean when you say you couldn’t use JUnit ?

On my test with a build-firmware-singleapp 1.4.+ when I add the JUnit dependency the src-adpgenerated/junit/java is generated.
Or do you mean something else?

Here is the JUnit dependency declaration I used:

<dependency conf="test->*" org="ej.library.test" name="junit" rev="1.5.0"/>

Found here Test Suite with JUnit — MicroEJ Documentation

After further digging, it appears the documentation is misleading on this point. The buildtype build-firmware-singlapp 1.4.+ does not inherit from the Test Suite nature, though it will be in a future release of the SDK.

So that mean you won’t have the JUnit report when you build the module with “Build Module”. However, you can still run the tests manually.

I see, the JUnit report is what I meant by couldn’t use JUnit, as the documentation stated I had to build the module and it would run JUnit so that was what I was trying to do to run it.

Ok, so at the moment this is not possible for standalone application (however it is possible on sandboxed application. buildtype build-application).
Instead, you may extract the code you want to test into an Add-on Library (buildtype microej-javalib).

Best,