CfUnit — CODESYS Forge Unit Testing framework

'CfUnit' is motivated by absence of 'good and free' open source IEC61131-3 automated unit-testing solutions. Developed in ST for CODESYS based PLC systems. MIT-Licensed

Download

Features

Easy

Download,
Install,
Reference,
Ready!

Powerful

Higher productivity,
Fewer bugs,
Cleaner code,
CI/CD integration*
*under development

Free

MIT-Licensed

Tour

Download

Getting started

  • Extend your test with CfUnit.FB_TestSuite,
  • Add the attribute-pragma {attribute ‘call_after_init’},
  • Define the inputs and define the expected output (result),
  • Call the CfUnit-assert methods to compare the expected output to the actual output,
  • Close the test with TEST_FINISHED() when finished.
  • Call the test method from the main FB Body

API
Online API reference can be found here.

Q&A
If you have any questions, you can drop them here.
If you cannot find your anwser, you can always drop a question in the comment.
Posted questions will be modderated into the Q&A for future reference.

Bugs
Bugs can be reported by opening a ticket here.

Tutorial

A step by step tutorial for the Simple CfUnit example project can be found here.

About

Kudos to Jakob Sagatowski for his kind permission to port his testing framework to CODESYS. Assistance provided by zer0g & Ingo was greatly appreciated. Without their assistance the porting alone would have taken me several months. Kudos for helping out with various tickets and providing valueable feedback!

Forked and ported from TcUnit, originally written for TwinCAT3 by Jakob Sagatowski.