State: TcUnit on TwinCAT kit shipped. Discovery is tested against the real TcUnit-Verifier project; results are read from a model PLC on real TCP whose symbols and types are built from TcUnit's own declarations. Nothing has run against TwinCAT or a controller.
See the tests
The Testing view has a controller PLC Tests: each TwinCAT project, its PLC project, the TcUnit suites (description "TcUnit") and their tests, and TF1140 test cases (description "TF1140"); .st files with suites under their path. Each item opens at the line that declares it. Nothing is built to list them.
- TcUnit suites are the function blocks that extend
FB_TestSuite, directly or through other function blocks of the same PLC project.ABSTRACTsuites are not listed; the suites that extend them are. - Tests are the
TEST('...')andTEST_ORDERED('...')calls in the suite's body and methods (the latter marked "ordered"), read with the Structured Text lexer, so commented-out tests and strings do not count. - A test named with a leading
disabled_is marked "disabled", as TcUnit skips it. A name declared twice in a suite shows once, marked "declared 2 times, TcUnit keeps one". - TF1140 test cases are the function blocks that extend
FB_TestCaseBase, named by theirNameattribute. - The list follows the projects as they change, and
.stfiles as they are saved.
Run on a TwinCAT target
Run on TwinCAT Target is the default run profile (the Run buttons and gutter icons) on a test, a suite, a PLC project or everything:
- Builds the project with the vendor compiler (see Build with the vendor compiler). A failed build stops the run; the messages are in Problems.
- Asks for the target, when the workspace stores more than one, and how to bring the tests onto it: Login and Download then Start PLC, or Activate Configuration first.
- Runs each step with its own confirmation dialog (see Activate and download to TwinCAT). Nothing is confirmed for you; declining a step stops the run and sends nothing further.
- Connects read-only, uploads the symbols and data types, and reads TcUnit's storing flags every 500 ms until TcUnit reports its results stored, showing how many suites registered. Cancelling stops the waiting; the PLC keeps running.
- Marks each test passed, failed (in any instance of the suite, with TcUnit's message of the first failed assertion, the assertion type, the instance and the number of assertions) or skipped (disabled, or not reported). Durations are TcUnit's. Messages sit at the test's
TESTcall: TcUnit does not keep the line of the assertion.
Tests TcUnit reports that the source does not name literally (TEST(sName)) are added under their suite after a run. Continuous runs are not supported: each run changes what the controller runs.
Read results of a run started elsewhere
Read Results from Target reads a run started in XAE or a CI job, read only: nothing is built, downloaded or started. If TcUnit has not finished, it says so and how many suites registered. It also fills a .st suite whose function block the target runs.
Every result names the engine and the target, for example "TcUnit on TwinCAT 3.1.4024.60, 192.0.2.10 (5.1.2.3.1.1:851)".
Offsets, sizes and array bounds come from the data types the target uploads, never from TcUnit's defaults, so a project that changed TcUnit's parameters is read as it is. Only the flags, the totals and each reported suite's tests are read.
What does not run from here
- TF1140 test cases are listed but not run, and their results are not read: run them from XAE.
- A suite in a
.stfile outside a TwinCAT project of the workspace has no project to build; use Read Results from Target.
Not verified
- TcUnit running on a real target, including the symbol name TwinCAT gives TcUnit's runner and whether it uploads the function blocks' internal variables. If it does not, the Editor says the program has no TcUnit runner.
- The data type upload of a real TcUnit program; how long TcUnit takes on a real PLC; runs that abort early.