WinCC OA Test Explorer

Test Explorer integration for WinCC OA unit tests in Visual Studio Code
⚠️ Pre-Release Version - Not all features have been fully tested yet
✨ Features
🔍 Test Discovery
- Automatic discovery of WinCC OA test files in workspace
- Support for both WinCC OA 3.19 and 3.20 test formats
- 3.19:
getAllTestCaseIds() with switch/case structure
- 3.20:
public int test*() methods
- Auto-refresh on file changes
- Workspace folder hierarchy
🚀 Test Execution
- Run individual test files or entire folders
- Click-to-navigate for all test states (passed, failed, aborted)
- Accurate error locations with StackTrace parsing
- Individual test messages per assertion
- Test execution queue to prevent conflicts
📊 Test Results
- Visual test status indicators in Test Explorer sidebar
- Detailed error messages with file and line references
- Test duration tracking
- Structured logging with configurable log levels
🎨 IDE Integration
- Native VS Code Test Explorer UI
- Recursive folder execution
- Multi-workspace support
🚀 Getting Started
Prerequisites
- Visual Studio Code ^1.106.2
- WinCC OA installation (3.19 or higher)
- WinCC OA Script Actions extension (required for test execution)
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search for "WinCC OA Test Explorer"
- Click Install
- Install the required WinCC OA Script Actions extension
⚙️ Configuration
Configure the extension in your VS Code settings.json:
{
"winccoaTests.testFilesPattern": "scripts/tests/**/*.ctl",
"winccoaTests.logLevel": "INFO"
}
Settings Reference
| Setting |
Default |
Description |
winccoaTests.testFilesPattern |
scripts/tests/**/*.ctl |
Glob pattern to discover test files |
winccoaTests.logLevel |
INFO |
Logging level (ERROR, WARN, INFO, DEBUG, TRACE) |
📋 Usage
Discovering Tests
- Open a WinCC OA project workspace in VS Code
- The extension will automatically scan for test files
- View discovered tests in the Test Explorer sidebar (beaker icon)
Running Tests
Via Test Explorer:
- Click the ▶️ icon next to a test file or folder
- Use the Run All Tests button in the toolbar
Via Command Palette:
WinCC OA Tests: Run All Tests - Run all discovered tests
WinCC OA Tests: Refresh Tests - Manually refresh test discovery
WinCC OA 3.19 Format:
main() {
getAllTestCaseIds();
}
getAllTestCaseIds() {
dyn_string ids;
ids[1] = "tc_01_example";
return ids;
}
test(string id) {
switch(id) {
case "tc_01_example":
// Arrange
int expected = 5;
// Act
int actual = 2 + 3;
// Assert
oaTest_assert(expected == actual);
break;
}
}
WinCC OA 3.20 Format:
public int test_example() {
// Arrange
int expected = 5;
// Act
int actual = 2 + 3;
// Assert
oaTest_assert(expected == actual);
return 0;
}
🛠️ Requirements
- Visual Studio Code 1.106.2 or higher
- WinCC OA installation with test framework
- WinCC OA Script Actions extension for test execution
- Valid WinCC OA project with test files
⚠️ Known Limitations
- Individual test case execution not yet supported (runs entire file)
- Test debugging support not yet implemented
🤝 Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👥 Authors
winccoa-tools-pack
⚠️ Disclaimer
WinCC OA and Siemens are trademarks of Siemens AG. This project is not affiliated with, endorsed by, or sponsored by Siemens AG. This is a community-driven open source project created to enhance the development experience for WinCC OA developers.
Made with ❤️ for the WinCC OA community