Skip to content

5. Tips to know

Gary Criblez edited this page Jun 26, 2020 · 3 revisions

Logs

When running the "AJ_Tools_UT_runAll" it will log all the results in a file located at : "<database_path>/Logs/UnitTestsResults.json".

Run in compiled mode

It is possible to run the tests in compiled mode. However, you must have run the tests once in interpreted mode to be able to run them in compiled mode. This is because we need to parse all the method to know where there are any unit tests (thanks to the first line comment) and this is only possible in interpreted mode. In compile mode it will look at an existing result logs and will be able to know which methods must be launched.

Wrapper Method for New AJ_Tools_UT_describe

It is recommended to write a wrapper method for the "New AJ_Tools_UT_describe". It will allow you to remove the component when building the final application. Here is a code example of how to write a wrapper method that will pass the compiler once the component is removed :

    // New UnitTest_Describe($1;$2;$3)
    // With this wrapper method, you can now remove the component when you build an application.

   C_TEXT($1;$2;$3)
   C_OBJECT($0)
   ARRAY TEXT($_list_components;0)

   COMPONENT LIST($_list_components)
   $pos:=Find in array($_list_components;"AJ_Tools_UnitTest")

   If ($pos>0)
     Case of
       : (Count parameters=0)
        EXECUTE METHOD("New AJ_Tools_UT_describe";$0)

       : (Count parameters=1)
        EXECUTE METHOD("New AJ_Tools_UT_describe";$0;$1)

       : (Count parameters=2)
        EXECUTE METHOD("New AJ_Tools_UT_describe";$0;$1;$2)

       : (Count parameters=3)
        EXECUTE METHOD("New AJ_Tools_UT_describe";$0;$1;$2;$3)
     End case 
   End if