A template library with TcUnit and instructions on how to add the files to have the project added as a template inside the TwinCAT 3.
To create custom project template, follow these steps.
- Download the files in this repo
- Go to
C:\TwinCAT\3.1\Components\Plc\PlcTemplates\1.0.0.0 - Copy the files in this location
- The
PlcTemplates.vsdirfile will be edited. Opt to replace or edit the file manually. Add the following line
Tests template.plcproj|0|Library with unit tests template|3|Creates a project template for library creation and testing using the TcUnit Framework.|0|0|0|0
- If you had your TwinCAT opened, close it and re-open it.
- Try to add new PLC project to your solution, you can now select the following template
7. A new project with the following structure is created
Project structure description:
- References
-
Added
TcUnitreference, with latest installed version -
SOURCEfolder is used to place your source code, the implementation logic. -
TESTSfolder will contain all the tests suites required to test the objects fromSOURCEfolder. -
Test suitesfolder contains the implementation of tests. UseFB_SUT_Testsas a template to create them.
-

