Using AxUnit runner to execute unit tests - Manual - AxUnit - AxUnit - AxUnit,

AxUnit (legacy) CLI Tool (test)

Portfolio
SIMATIC AX
Product
AxUnit
Software version
3.0.4
Edition
08/2025
Language
English (original)
Package Name
@ax/axunit-docs

The AxUnit runner is a tool to run your unit tests.

Warning

  1. It is never advised to run the tests in a productive environment. The tests will run the productive code.
  2. The program tasks will not be executed since the framework creates its own task to run the tests.

Pre-requisites:

The PLC has to be connected and reachable.

  • Use the runner in the CLI to download the tests to the PLC like below:

Synopsis

AxUnit.Runner -i binaryDirectory -o outputDirectory -t ipAddress

where

  • -i|--input The directory that contains the binaries dumped from STC including the TestCasesMeta.xml file
  • -o|--output The directory where the test results are expected
  • -t|--target The IP address of the PLC

Example

AxUnit.Runner -i D:\myFirstProgram\bin -o D:\myFirstProgram\testResults -t 192.168.0.1

Note

Calling the AxUnit.Runner directly is not the easiest way anymore, since Apax has been released. Instead you can just call apax test in your workspace, after you have taken the necessary steps. If you work with the IDE and want to test in the IDE, everything will be done automatically for you.

   ___         __  __         _   __
  / _ | __ __ / / / /  ___   (_) / /_
 / __ | \ \ // /_/ /  / _ \ / / / __/
/_/ |_|/_\_\ \____/  /_//_//_/  \__/



binaries: D:\bundle\bin
results:  D:\bundle\testresults

  Run started
----------------
 status

-> current step: Download
--> done: duration [s]: 10.094
-> current step: Testing
--> done: duration [s]: 4.065
-> current step: Reading results
--> done: duration [s]: 0
-> current step: Reading coverage
--> done: duration [s]: 0.019
Save result
-> current step: Generate Testresult log-file
--> done: duration [s]: 0.008
-> current step: Generate Testresult xml-file
--> done: duration [s]: 0.03
-> current step: Generate Coverage log-file
--> done: duration [s]: 0.004
-> current step: Generate Coverage xml-file
--> done: duration [s]: 0.013

----------------

 Summary

All tests (3) have been executed
 Duration: 0 seconds
 Overall result [passed]
  passed: 3
  failed: 0

Test finished

 Code Coverage

Test_ADD_of_4_plus_4_returns_8: Covered [1//1 blocks]:  100%
Test_of_4_plus_minus4_returns_0: Covered [1//1 blocks]:  100%
Test_of_4_plus_minus4_returns_LessThan_1: Covered [1//1 blocks]:  100%
TestProgram: Covered [0//1 blocks]:  0%
ADD: Covered [1//1 blocks]:  100%

----------------

 Details

passed:   3
passed: Test_ADD_of_4_plus_4_returns_8
passed: Test_of_4_plus_minus4_returns_0
passed: Test_of_4_plus_minus4_returns_LessThan_1

failed:   0
Saved result to D:\bundle\testresults
=== Program ended ===