How to Integrate AutomationView with GitLab CI for Automated PLC Testing
How to Integrate AutomationView with GitLab CI for Automated PLC Testing
AutomationView%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
A["Developer Push"]:::blue --> B["GitLab CI Runner"]:::green
B --> C["AutomationView CLI"]:::blue
C --> D["Headless Simulation"]:::green
D --> E["Test Report"]:::red
classDef blue fill:#2563eb,stroke:#1e3a8a,stroke-width:2px,color:#ffffff
classDef green fill:#16a34a,stroke:#14532d,stroke-width:2px,color:#ffffff
classDef red fill:#dc2626,stroke:#7f1d1d,stroke-width:2px,color:#ffffff
The traditional approach to PLC programming—where code is tested only during factory acceptance or commissioning—is no longer viable for modern, complex systems. As industrial automation embraces software engineering practices, integrating your PLC logic into a CI/CD pipeline has become a necessity. By leveraging AutomationView’s native Git collaboration and simulation capabilities, you can build a robust automated testing pipeline. Here is how to integrate AutomationView with GitLab CI for automated PLC testing.
Key Takeaways
- AutomationView’s native Git support makes it the perfect candidate for CI/CD pipelines.
- You can trigger headless simulations in GitLab CI runners using the AutomationView CLI.
- Automated testing prevents regressions from reaching the plant floor, drastically reducing commissioning time.
Why Shift Left in PLC Engineering?
In standard PLC environments, logic errors are often discovered during physical commissioning, leading to costly downtime and project delays. By “shifting left”—testing early and often—you catch bugs when they are cheapest to fix. AutomationView GitLab CI integration allows teams to run unit tests on SFC/Grafcet sequences every time a developer pushes a commit. This is crucial for multi-developer teams working on large-scale material handling or process control systems, where merge conflicts or unintended side effects are common.
Setting Up the GitLab CI Runner
To run AutomationView tests in the cloud or on a local server, you need a GitLab Runner configured with the AutomationView CLI. The CLI allows you to execute Python-based unit tests and sequence simulations headlessly without the GUI.
flowchart TD
subgraph ci_pipeline ["GitLab CI Pipeline"]
step1["Linting & Syntax Check"]:::blue --> step2["Unit Tests (SFC Logic)"]:::green
step2 --> step3["Integration Simulation"]:::green
step3 --> step4["Deploy to Staging PLC"]:::red
end
classDef blue fill:#2563eb,stroke:#1e3a8a,stroke-width:2px,color:#ffffff
classDef green fill:#16a34a,stroke:#14532d,stroke-width:2px,color:#ffffff
classDef red fill:#dc2626,stroke:#7f1d1d,stroke-width:2px,color:#ffffff
1. Defining the .gitlab-ci.yml
Create a .gitlab-ci.yml file at the root of your AutomationView project repository. This file will define the stages of your pipeline. A basic pipeline consists of a test stage that invokes the AutomationView test runner.
2. The Headless Test Execution
When the pipeline triggers, the runner pulls the latest commit and uses the AutomationView CLI to run your pre-defined Python test scripts against the SFC logic. The CLI outputs standard JUnit XML reports, which GitLab automatically parses to display pass/fail metrics directly in the merge request interface.
Handling Simulation State in the Pipeline
One of the main challenges engineers face is simulating external physical I/O during an automated test. Without physical sensors, the sequence will hang waiting for transitions.
| Simulation Method | Pros | Cons |
|---|---|---|
| Python Mock Hooks | Fast, no external dependencies, runs perfectly in CI. | Requires writing Python scripts to mock physical sensor behavior. |
| Digital Twin (e.g. Factory IO) | Highly realistic physics-based simulation. | Heavy, requires a Windows runner and a running twin instance. |
| Forced I/O via API | Simple to implement for basic unit tests. | Hard to maintain state over complex multi-step sequences. |
For a GitLab CI pipeline, the Python Mock Hooks approach is generally the best. AutomationView’s Python backend allows you to inject simulated states (e.g., “Sensor_A = True” after 2 seconds) directly into the test context, ensuring the SFC transitions proceed logically.
Reviewing Test Artifacts
Once the pipeline completes, the results are vital. If a sequence fails due to an unexpected state, the AutomationView CLI can export the trace log. You can configure GitLab CI to save this trace as an artifact, which developers can download and replay locally in the AutomationView visualizer to pinpoint the exact step where the logic deviated.
Conclusion
Integrating AutomationView GitLab CI pipelines brings modern software reliability to industrial automation. By automating your PLC testing, you protect the master branch from regressions and ensure that your team deploys sequences with absolute confidence. Start shifting left today and experience the difference during your next commissioning phase.
Ready to upgrade your engineering workflow? Explore the AutomationView Store for tools and templates that accelerate your projects.
FAQ
Do I need a dedicated server for the GitLab Runner?
Yes, for AutomationView CLI executions, it is highly recommended to host a dedicated runner (either a local VM or a cloud instance) that has the appropriate AutomationView runtime and licensing installed.
Can I test safety logic in the CI pipeline?
While standard logic can be simulated, safety logic should still undergo rigorous formal verification and physical validation, as standard CI simulations cannot guarantee deterministic timing or hardware-level fail-safes.
Does this replace physical commissioning?
No. Automated testing drastically reduces logic and sequence errors, saving significant time, but it does not replace the need for physical I/O checks, tuning, and real-world commissioning.
Stay Updated with AutomationView
Get the latest articles and news delivered directly to your inbox.
You must be registered and logged in to manage subscriptions.
Recommended for you
The Engineer’s Guide to Modern PLC Collaboration with Git
AutomationView%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
style Local fill:#0d47a1,stroke:#0d47a1,stroke-width:2px,color:#ffffff
style Remote fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style Deploy fill:#e65100,stroke:#ef6c00,stroke-width:2px,color:#ffffff
Local["Engineer A (Branch)"] -->|Push| Remote["Central Repository"]
Local2["Engineer B (Branch)"] -->|Push| Remote
Remote -->|Merge| Deploy["Production Sequence"]
The Engineer’s Guide to Modern PLC Collaboration with Git
Executive TL;DR: Git eliminates the “USB drive shuffle” and accidental logic overwrites in PLC programming. Feature branching allows safe, isolated testing of new sequences without risking the main project. Visual diff tools in AutomationView make resolving SFC and Python conflicts predictable and visual. I can vividly recall the sheer panic of a 2 AM breakdown […]
How to Build Automated Unit Tests for PLC Sequences in AutomationView
AutomationView%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
---
title: AutomationView Unit Testing Architecture
---
flowchart TD
classDef test fill:#3b82f6,stroke:#2563eb,color:#ffffff
classDef sfc fill:#10b981,stroke:#059669,color:#ffffff
classDef report fill:#f59e0b,stroke:#d97706,color:#ffffff
A["Python Test Runner (PyTest)"]:::test --> B["Mock I/O Variables"]:::test
B --> C["Execute SFC Step/Transition"]:::sfc
C --> D{"Assert Outputs == Expected"}
D -- Pass --> E["Generate Coverage Report"]:::report
D -- Fail --> F["Flag Error & Halt CI/CD"]:::report
How to Build Automated Unit Tests for PLC Sequences in AutomationView
In modern software engineering, pushing code to production without running automated unit tests is considered professional malpractice. Yet, in the industrial automation world, engineers routinely download thousands of lines of ladder logic into critical infrastructure relying solely on manual simulation and blind faith. AutomationView changes this paradigm entirely by introducing a native Python-based unit testing […]
Deep Dive: Resolving Merge Conflicts in PLC Logic using AutomationView’s Visual Diff
AutomationView%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
---
title: AutomationView Visual Diff
---
flowchart LR
classDef default fill:#1E293B,stroke:#475569,stroke-width:2px,color:#F8FAFC
classDef conflict fill:#EF4444,stroke:#B91C1C,color:#FFFFFF
classDef resolved fill:#22C55E,stroke:#15803D,color:#FFFFFF
A["Main Branch"] --> B("Merge")
C["Feature Branch"] --> B
B -->|Conflict Detected| D["Visual Diff Tool"]:::conflict
D -->|Accept Changes| E["Resolved Logic"]:::resolved
Deep Dive: Resolving Merge Conflicts in PLC Logic using AutomationView’s Visual Diff
For decades, collaborative PLC programming was virtually impossible. If two engineers edited the same ladder logic file simultaneously, the result was a binary collision—whoever saved last overwrote the other’s work. By integrating native Git version control, AutomationView fundamentally solved the concurrency problem. However, concurrent engineering inevitably leads to merge conflicts. Resolving these conflicts in raw […]