SCL unit tests for Siemens PLCs
What SCL unit testing in Studio does
Arrange · Act · Assert
- Visual editor & JSON
- 20+ assertion operators
- Multi-step (write/wait/assert)
PLCSIM Advanced & real PLC
- PLCSIM Advanced V3.0+
- S7 Native & OPC UA
- Safety prompt before hardware runs
AI-authored test suites
- From the block interface
- Boundary-value generation
- Editable straight from chat
CI/CD & reports
- JUnit XML & HTML
- rerun-affected
- Pipeline-ready
History & trends
- Run history & diff
- Flaky detection
- Trend charts & CSV export
No open TIA Portal needed
- Offline authoring
- Paths never stored in clear text
- Check in suites without secrets
SCL unit testing for TIA Portal — guide
A unit test in TIA Portal checks a single PLC block (FB/FC) in isolation: write defined inputs (Arrange), let the controller run a few cycles (Act) and check the outputs against expected values (Assert). The test runs against PLCSIM Advanced or a real S7 PLC — automated, repeatable and in CI/CD.
How does an SCL unit test work?
AnyAutomation Studio reads your block's interface straight from the TIA project so inputs and assertions validate against the real parameter names and types. A test suite is a .tia-tests/*.json file next to your project file. Each test case follows Arrange → Act → Assert: write values, wait cycles, check results. The runner creates the PLCSIM instance, compiles, connects, writes inputs, reads outputs and evaluates the assertions.
Against PLCSIM Advanced or real hardware
By default a suite runs against a PLCSIM Advanced instance — fast and without physical hardware. Via S7 Native or OPC UA you test straight against a real S7-1200/1500. A safety prompt appears before every run on real hardware, and the runner checks the controller is in RUN before it writes. Full configuration is in the unit testing documentation.
Studio vs. Siemens Test Suite
Siemens Test Suite (Advanced) is deeply integrated into TIA Portal and strong for certified acceptance workflows. AnyAutomation Studio takes a different angle: lightweight, scriptable SCL unit tests that fit your version control and CI/CD — Git diffs of the suites, AI-authored cases, trend reports and a command-line runner for the pipeline. If you want to test PLC code like software rather than sign off once, that is the difference. See also TIA Portal Test Suite alternative.
Frequently asked questions
What is a unit test in TIA Portal?
A unit test checks a single PLC block in isolation following Arrange/Act/Assert: set inputs, let the controller cycle, check outputs against expected values — against PLCSIM Advanced or a real S7 PLC.
Can I test against real S7-1200/1500 hardware?
Yes. Over an S7 Native or OPC UA connection a suite runs straight against the real controller. A safety prompt appears before the run, and the runner only writes when the PLC is in RUN.
Do I need an extra Siemens license for unit tests?
For PLCSIM Advanced runs you need a PLCSIM Advanced license from Siemens. The SCL unit testing itself ships with AnyAutomation Studio from the Pro tier — no Test Suite Ultimate license required.
Does it run in CI/CD?
Yes. The tia-test-runner command-line tool runs suites in GitLab CI, Jenkins and similar pipelines and produces JUnit XML and HTML reports. --rerun-affected runs only suites whose block changed.
Can the AI generate test suites?
Yes. The AI assistant derives test cases and boundary values from the block interface and writes them into the .tia-tests folder — editable straight from chat.