TDD with TwinCAT using TcUnit – A YouTube tutorial

Sharing knowledge with other TwinCAT developers using a blog is not only an easy and good way, but it’s also quite fun. After a long day at work, I often find it enjoying to sit down and write a little bit on a new blog post. Quite recently I launched TcUnit – the TwinCAT unit testing framework and even though there now is tons of documentation and example code on the official website, some people prefer to learn by watching a video. For this reason I’ve created a series of four videos that will introduce TwinCAT software developers to test driven development (TDD) and how to do TDD using TcUnit.

The first part of the videos gives an introduction to test driven development and why it makes sense in the world of automation.

To demonstrate how to work with TDD and TcUnit, the second part focuses on explaining an example project that we are going to develop. The functionality that is demonstrated is development of a simple moving average function block. In this part we will be creating the project and implement the function block header, though not doing the function block body (implementation), according to TDD.

In the third part we are going to start writing our test cases. The test cases will act as our acceptance criteria for the function block that we are developing. This part is the longest one of the series coming in on 30 minutes, at the same time this is where the core concepts of test driven development are introduced so I would highly encourage to not skip anything in this part!

In the fourth and final part we are in a stage where we have defined our function block functionality/interfaces, written all our tests and executed them. When executing the tests, all of them fail because we haven’t written the body/implementation-part of the function block yet, which we will do in this part. We write the implementing code until our all tests passes.

My hope is that these videos in combination with TcUnit can contribute to the automation world adopting modern software practices.

The example project developed during the video series can be downloaded from my GitHub.

  • Share on:

2 Comments, RSS

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.