Skip to content

SimmelFlo/PlcTestSuite_UI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PlcTestSuite UI

TestSuite.mp4

A Windows Forms application for discovering, managing, and executing Beckhoff TwinCAT PLC test suites via the ADS (Automation Device Specification) protocol.

Overview

PlcTestSuite_UI provides a graphical interface to interact with PLC test suites created using the PlcTestSuite library. The application automatically discovers test suites across multiple TwinCAT PLC runtimes and displays their tests, execution status, and event history.

Prerequisites

Required Software

  1. Windows Operating System - Windows 10 or later
  2. .NET 8.0 Runtime - Download here
  3. TwinCAT XAE/XAR - TwinCAT 3 installation with ADS router running
  4. Visual Studio 2022 (for development) - Community edition or higher

Required NuGet Packages

The following packages are automatically restored during build:

  • Beckhoff.TwinCAT.Ads (v7.0.132) - TwinCAT ADS communication
  • Microsoft.Extensions.Logging.Abstractions - Logging infrastructure
  • Additional TwinCAT and system dependencies

PLC Requirements

Your TwinCAT PLC project must use the PlcTestSuite library:

Note: PlcTestSuite v1.1.1 or greater is required.

  1. Install the PlcTestSuite library in your TwinCAT project
  2. Create test suites that implement the Tc3_PlcTestSuite.I_TestSuite interface
  3. Define tests within your test suite using the PlcTestSuite framework
  4. Ensure your PLC runtime is active on one of the supported ports (851-859)

Installation

Option 1: Run Pre-built Binary

  1. Download the latest release from the releases page
  2. Extract the ZIP file to a folder
  3. Run PlcTestSuite_UI.exe

Option 2: Build from Source

# Clone the repository
git clone <repository-url>
cd PlcTestSuite_UI

# Restore dependencies
dotnet restore PlcTestSuite_UI.csproj

# Build the project
dotnet build PlcTestSuite_UI.csproj --configuration Release

# Run the application
dotnet run --project PlcTestSuite_UI.csproj

Option 3: Publish for Distribution

# Publish for Windows x64
dotnet publish PlcTestSuite_UI.csproj --configuration Release --runtime win-x64

# Publish for Windows x86
dotnet publish PlcTestSuite_UI.csproj --configuration Release --runtime win-x86

# The executable will be in: bin/Release/net8.0-windows/win-x64/publish/

Usage

Getting Started

  1. Launch the Application

    • Start PlcTestSuite_UI.exe
    • The application opens with a dark theme interface
  2. Configure AMS Net-ID (Optional)

    • By default, the application connects to the local TwinCAT runtime
    • To connect to a remote PLC, enter the AMS Net-ID in the format: 192.168.1.84.1.1
    • Leave as "local" for local TwinCAT runtime
  3. Discover Test Suites

    • Click the "πŸ”„ Refresh" button
    • The application scans TwinCAT ports 851-859
    • Discovered test suites appear in the "Available Test Suites" list
    • Format: ProjectName: TestSuiteInstancePath
  4. View Tests

    • Select a test suite from the list
    • Tests are displayed in the main view with:
      • Test Name - The identifier of the test
      • Status - Current state (Init, Running, OK, Failed)
      • Duration - Execution time in seconds
    • Test suite statistics appear on the right:
      • Total Tests
      • Passed Tests
      • Failed Tests
      • Total Duration
  5. Filter Tests

    • Enter text in the "Filter tests..." box
    • The test list updates in real-time to show matching tests
    • Clear the filter to show all tests
  6. View Event History

    • The bottom panel displays event log entries from the TwinCAT Event Logger
    • Shows timestamp, event type, source, and message

Test Suite Discovery

The application discovers test suites by:

  1. Connecting to each PLC runtime port (851-859)
  2. Loading the symbol tree from the PLC
  3. Recursively searching for types with the Tc3_PlcTestSuite.I_TestSuite attribute
  4. Reading the TwinCAT project name and instance path

AMS Net-ID Configuration

  • Local Runtime: Enter "local" or leave empty
  • Remote Runtime: Enter the full AMS Net-ID (e.g., 192.168.1.84.1.1)
  • Invalid entries automatically default to "local"
  • Valid format: Six numbers separated by dots

Features

  • Automatic Discovery - Scans multiple PLC runtime ports (851-859)
  • Real-time Updates - View current test status and execution times
  • Test Filtering - Quickly find specific tests by name
  • Event Logging - Monitor TwinCAT event logger messages
  • Remote Connection - Connect to remote PLCs via AMS Net-ID
  • Dark Theme UI - Modern interface inspired by Beckhoff branding
  • Multi-Runtime Support - Handle multiple PLC runtimes simultaneously

Architecture

Application Structure

PlcTestSuite_UI/
β”œβ”€β”€ PlcTestSuite.cs              # Main form logic and ADS communication
β”œβ”€β”€ PlcTestSuite.Designer.cs     # UI layout and controls
β”œβ”€β”€ PlcTestSuite.resx            # Form resources
β”œβ”€β”€ Program.cs                   # Application entry point
└── PlcTestSuite_UI.csproj      # Project configuration

Key Components

  • AdsClient - Handles ADS communication with TwinCAT runtimes
  • SymbolLoader - Loads PLC symbols for test suite discovery
  • TcEventLogger - Monitors TwinCAT event logger
  • TestSuiteDef - Data structure for discovered test suites

Communication Flow

  1. User clicks Refresh β†’ Scan ports 851-859
  2. For each port:
    • Connect to AmsNetId (local or remote) on port
    • Load PLC symbols
    • Recursively search for test suite types
    • Store discovered test suites
    • Disconnect
  3. User selects test suite β†’ Connect and read test collection
  4. Display tests with status and duration
  5. Filter tests in real-time based on user input

Integration with PlcTestSuite

This UI is designed to work with the PlcTestSuite library by SimmelFlo.

PLC Side Setup

In your TwinCAT PLC project:

PROGRAM MyTestSuite IMPLEMENTS Tc3_PlcTestSuite.I_TestSuite
VAR
    TestSuite : FB_TestSuite;
    TestCollection : ARRAY[0..99] OF FB_TestCase;
END_VAR

// Define and register your tests
TestSuite.AddTest(TestCollection[0], 'TestName1');
TestSuite.AddTest(TestCollection[1], 'TestName2');
// ...

// Execute the test suite
TestSuite.Execute();

Required Attributes

Your test suite must:

  • Implement the Tc3_PlcTestSuite.I_TestSuite interface
  • Have a TestCollection array of test cases
  • Include _TestId, _State, and Duration properties for each test

Refer to the PlcTestSuite documentation for detailed implementation instructions.

Troubleshooting

Application won't connect to PLC

  • Verify TwinCAT runtime is active
  • Check AMS Net-ID is correct (use "local" for local runtime)
  • Ensure ADS router is running
  • Check firewall settings allow ADS communication (TCP port 48898)

No test suites found

  • Verify your test suite implements Tc3_PlcTestSuite.I_TestSuite
  • Check the PLC project is running on ports 851-859
  • Ensure the test suite attribute is properly set
  • Verify PlcTestSuite library is correctly installed in TwinCAT

Tests not displaying

  • Ensure the test suite has a TestCollection array
  • Check test cases have _TestId, _State, and Duration properties
  • Verify the selected test suite is active

Application crashes on startup

  • Verify .NET 8.0 Runtime is installed
  • Check TwinCAT ADS libraries are installed
  • Try running as Administrator

Development

Project Configuration

  • Target Framework: net8.0-windows
  • Output Type: Windows Application (WinExe)
  • Language Version: C# 12.0
  • Nullable: Enabled

Building

# Debug build
dotnet build PlcTestSuite_UI.csproj

# Release build
dotnet build PlcTestSuite_UI.csproj --configuration Release

# Clean build artifacts
dotnet clean PlcTestSuite_UI.csproj

Code Style

  • Dark theme color scheme (Beckhoff red: RGB(204, 0, 0))
  • Async/await patterns for non-blocking operations
  • Exception handling with fallback to local connection
  • Consolas font for test/event lists (monospace)
  • Segoe UI for UI labels and buttons

Version History

Version 1.0.0 (2025-12-26)

Initial release with automatic test suite discovery, real-time test status tracking, test filtering, TwinCAT Event Logger integration, and remote PLC connection support via AMS Net-ID. Built with .NET 8.0 and Beckhoff.TwinCAT.Ads v7.0.132.

Features:

  • Automatic test suite discovery (TwinCAT ports 851-859)
  • Real-time test status and duration display
  • Test filtering with live search
  • Remote PLC connection via AMS Net-ID
  • Event history monitoring
  • Dark theme UI with Beckhoff branding

License

[Specify your license here]

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

Credits

Support

For issues related to:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages