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.vsdir
file 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
TcUnit
reference, with latest installed version -
SOURCE
folder is used to place your source code, the implementation logic. -
TESTS
folder will contain all the tests suites required to test the objects fromSOURCE
folder. -
Test suites
folder contains the implementation of tests. UseFB_SUT_Tests
as a template to create them.
-