This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C1290NCPDT: Unit Testing C code in a C project using another C project in same CSS Workspace

Part Number: TM4C1290NCPDT

Tool/software: Code Composer Studio

I read the following reply from a TI employee with interest (relevant paragraph copied below).  I too would like to create Unit Tests in C under a separate project within Code Composer Studio, that will Unit test the functions of another project in the same Workspace (presumably via DSS if that is the easiest way).  I do not want to write the units tests in Java.  If this is possible as mentioned in that reply, are there any examples using C-code in a project in CSS to Unit Test functions in another project that I can leverage from ? This will save me time and present a shallower learning curve to implementing Units Tests.

[UPDATE]:  I just discovered that I need not use DSS as per this and  this answer given by another TI employee. Instead Parasoft is mentioned.   Parasoft indicate they support ARM Compiler v5.1 (I'm using TI's ARM Compiler v5.1.6 under CCS v6.0.x) so Parasoft AFAIK will integrate with my IDE and target ARM MCU (TM4C1290NCPDT) .   Parasoft seems a more direct solution to my problem.  I understand DSS is the only tool supported by TI, but I don't mind paying for another tool to make my life easier.  Am I correct it might be a more direct and integrated solution to my requirements for Unit Testing ?


>>When you say I can create a C harness to call <function_name> and all its permutations;
>>would the test code be written along with my source code in code composer and DSS
>>would be the process to automate and format it into a log report (xml)?

>Yes, exactly. You would write your test code that calls the function you want to test and
>build it all as a single executable. You can then use DSS to automate the running of this executable

regards

  • Parasoft may be the better solution. I have heard good things about their C unit testing suite and they have a good plug-in to CCS. I don't have much personal experience using Parasoft myself. Hence I would contact Parasoft directly for more information.

    Peter John said:
    If this is possible as mentioned in that reply, are there any examples using C-code in a project in CSS to Unit Test functions in another project that I can leverage from ?

    The issue here is your desire to have the test harness code and the code you wish to test in two separate projects (and executables). The suggestion made in the other thread you referenced is to have everything in one project - one executable. If you wish to avoid this, then the Parasoft solution may be a better option.

    Thanks

    ki

  • Ki-Soo Lee said:
    The issue here is your desire to have the test harness code and the code you wish to test in two separate projects (and executables). The suggestion made in the other thread you referenced is to have everything in one project - one executable. If you wish to avoid this, then the Parasoft solution may be a better option.

    Thanks Ki.  It is probably not a show stopper if I need to include the Unit Tests in the same project.  If I was OK to do that, do you have any examples I could follow where the unit test have been written in C ?  Also, when you refer to an executable, are you referring to a Windows EXE, or that .bin file running on the target MCU ?

    I have contacted Parasoft and will see how their solution might differ (aside from what you pointed out regarding where the unit test C code would reside).

  • Peter John said:
    If I was OK to do that, do you have any examples I could follow where the unit test have been written in C ?  Also, when you refer to an executable, are you referring to a Windows EXE, or that .bin file running on the target MCU ?

    executable, in this case, meaning a generated *.out (or *.bin) file generated by the CCS project. Basically you have a standard CCS project with all of the C code, from the test harness code (which can be as simple as calling the functions you wish to test), and the actual code your wish to test (you could also include that code as a library if the other project is a library project)

    As for examples, there is not a specific CCS example that comes to mind that I can share. Many of the custom solutions vary quite a bit. Frankly, most people go with some established third party system like Parasoft or CUnit.