Junit test cases launched several times when building module

Hi,

I am creating a sandboxed application with MicroEJ Studio 19.05 and I wrote Junit tests for it.
When I build my module, the tests are launched but each of them are executed several times.

For example if I have only one test class called “TestCase” with one test inside, it will be executed 4 times :

    [testsuite:javaTestsuite] C:\Users\user\.microej\workspaces\MicroEJ-Studio-19.05\tata\target~\test\xml\test\20200410-1605-59\testsuite-report.xml
    [testsuite:javaTestsuite] [I3] - No custom property file found for this test: 
    [testsuite:javaTestsuite] Running test (1/4): C:\Users\user\.microej\workspaces\MicroEJ-Studio-19.05\tata\target~\test\classes\myPackage\TestCase.class
    [testsuite:javaTestsuite] Test classname: myPackage.TestCase
    [testsuite:javaTestsuite] Test output name: myPackage.TestCase
    [testsuite:javaTestsuite]  > Test ended as failure
    [testsuite:javaTestsuite] [I3] - No custom property file found for this test: 
    [testsuite:javaTestsuite] Running test (2/4): C:\Users\user\.microej\workspaces\MicroEJ-Studio-19.05\tata\target~\test\classes\myPackage\_AllTestClasses.class
    [testsuite:javaTestsuite] Test classname: myPackage._AllTestClasses
    [testsuite:javaTestsuite] Test output name: myPackage._AllTestClasses
    [testsuite:javaTestsuite]  > Test ended as failure
    [testsuite:javaTestsuite] [I3] - No custom property file found for this test: 
    [testsuite:javaTestsuite] Running test (3/4): C:\Users\user\.microej\workspaces\MicroEJ-Studio-19.05\tata\target~\test\classes\myPackage\_AllTests_TestCase.class
    [testsuite:javaTestsuite] Test classname: myPackage._AllTests_TestCase
    [testsuite:javaTestsuite] Test output name: myPackage._AllTests_TestCase
    [testsuite:javaTestsuite]  > Test ended as failure
    [testsuite:javaTestsuite] [I3] - No custom property file found for this test: 
    [testsuite:javaTestsuite] Running test (4/4): C:\Users\user\.microej\workspaces\MicroEJ-Studio-19.05\tata\target~\test\classes\myPackage\_SingleTest_TestCase_test.class
    [testsuite:javaTestsuite] Test classname: myPackage._SingleTest_TestCase_test
    [testsuite:javaTestsuite] Test output name: myPackage._SingleTest_TestCase_test
    [testsuite:javaTestsuite]  > Test ended as failure

How can I make the build process launch each test only once ?

Thanks

Alex

Hello Alex,

You need to specify the tests inclusion pattern to pass only the tests you want. For example if you want execute the whole testsuite only, add the following property inside the <ea:build></ea:build> element in the module.ivy of your project:

<ea:property name="test.run.includes.pattern" value="**/_AllTests*.class"/>

Adapt depending on which tests you want executed.

Regards,
Gaëtan for MicroEJ

Hi Gaëtan,

I added the line to my module.ivy and it works. Thanks for your answer.

Alex

You can also consult the newly deployed online documentation on this subject.

https://docs.microej.com/en/latest/ApplicationDeveloperGuide/testsuite.html

Gaëtan