Testing Guide
Getting Started
Setup ServersSecurity
Authentication Security Access-controlAddress Space
Address-space Data-types Methods Dynamic-variables Structures Extension-objects ViewsAdvanced
Events-and-alarms Historical-dataIntegration
Testing-guide Ci-integration CustomizationTesting Guide
Practical test scenarios organized by OPC UA feature. Each scenario lists the server to use, what to do, and what to expect.
1. Connection & Session
Basic connection (no security)
- Server:
opcua-no-security(4840) - Steps:
- Connect to
opc.tcp://localhost:4840/UA/TestServer - Create a session (anonymous)
- Browse root -> Objects -> TestServer
- Connect to
- Expect: Session created, browse returns TestServer with sub-folders
Encrypted connection
- Server:
opcua-userpass(4841) - Steps:
- Discover endpoints via
GetEndpoints() - Select the Basic256Sha256/SignAndEncrypt endpoint
- Present client certificate and key
- Create session with username
admin/admin123
- Discover endpoints via
- Expect: Encrypted session, full access
Connection rejection
- Server:
opcua-userpass(4841) - Steps:
- Try connecting without credentials (anonymous)
- Expect:
BadIdentityTokenRejected
2. Reading & Writing
Read all data types
- Server:
opcua-no-security(4840) - Steps:
- Read all 21 variables under
DataTypes/Scalar - Verify each value matches the documented initial value
- Verify each
DataTypeattribute matches the expected type
- Read all 21 variables under
- Expect: All reads succeed with
Goodstatus
Write and read-back
- Server:
opcua-no-security(4840) - Steps:
- Write
falsetoDataTypes/Scalar/BooleanValue - Read it back
- Verify value is
false - Repeat for each data type with an appropriate test value
- Write
- Expect: All writes succeed, read-back matches written value
Write to read-only variable
- Server:
opcua-no-security(4840) - Steps:
- Write
42toDataTypes/ReadOnly/Int32_RO
- Write
- Expect:
BadNotWritablestatus code
Batch read
- Server:
opcua-no-security(4840) - Steps:
- Build a read request with all 21 scalar variables
- Send as a single Read service call
- Expect: 21 results, all
Good
Array operations
- Server:
opcua-no-security(4840) - Steps:
- Read
DataTypes/Array/Int32Array->[-100000, -1, 0, 1, 100000] - Write
[1, 2, 3](shorter array) - Read back ->
[1, 2, 3] - Read an empty array ->
[] - Write elements to an empty array, read back
- Read
3. Subscriptions & Monitored Items
Basic data change subscription
- Server:
opcua-no-security(4840) - Steps:
- Create subscription (
publishingInterval = 1000) - Add
Dynamic/Counteras monitored item - Wait for notifications
- Create subscription (
- Expect: One notification per second, value incrementing by 1
Fast data changes
- Server:
opcua-no-security(4840) - Steps:
- Create subscription (
publishingInterval = 200) - Monitor
Dynamic/FastCounterwithsamplingInterval = 100
- Create subscription (
- Expect: ~5 notifications/second
Deadband filtering
- Server:
opcua-no-security(4840) - Steps:
- Monitor
Dynamic/SineWavewith absolute deadband of0.5 - Count notifications over 30 seconds
- Monitor
- Expect: Fewer notifications than without deadband (~12 instead of ~30)
Multiple monitored items
- Server:
opcua-no-security(4840) - Steps:
- Create one subscription
- Add 5 dynamic variables as monitored items
- Verify notifications arrive for all 5
- Expect: Interleaved notifications from all monitored items
4. Method Calls
Simple method
- Server:
opcua-no-security(4840) - Steps:
- Call
Methods/Addwitha=2.5, b=3.5
- Call
- Expect: Output
result = 6.0
Method with no input
- Server:
opcua-no-security(4840) - Steps:
- Call
Methods/GetServerTimewith empty input arguments
- Call
- Expect: Output
timeis a DateTime close to current time
Method failure
- Server:
opcua-no-security(4840) - Steps:
- Call
Methods/Failing
- Call
- Expect: StatusCode
BadInternalError
Method timeout
- Server:
opcua-no-security(4840) - Steps:
- Call
Methods/LongRunningwithdurationMs = 10000 - Set client timeout to 5000ms
- Call
- Expect: Client-side timeout before method completes
Array input method
- Server:
opcua-no-security(4840) - Steps:
- Call
Methods/ArraySumwithvalues = [1.0, 2.0, 3.0, 4.0]
- Call
- Expect: Output
sum = 10.0
5. Events
Subscribe to server events
- Server:
opcua-no-security(4840) - Steps:
- Create subscription on the
Servernode - Add event monitored item with select:
[EventType, Message, Severity, Time] - Wait 2 seconds
- Create subscription on the
- Expect: Receive
SimpleEventTypeevent with"Periodic event #N"
Trigger event via method
- Server:
opcua-no-security(4840) - Steps:
- Subscribe to events
- Call
Methods/GenerateEvent("Test event", 750)
- Expect: Receive event with message
"Test event"and severity750
Filter events
- Server:
opcua-no-security(4840) - Steps:
- Subscribe to events with
ContentFilterwhereSeverity >= 500 - Wait for
SystemStatusEventTypein Maintenance state
- Subscribe to events with
- Expect: Only receive events with severity 600 (Maintenance)
6. Alarms
Monitor alarm transitions
- Server:
opcua-no-security(4840) - Steps:
- Subscribe to events on
Alarmsfolder - Wait for
AlarmSourceValueto oscillate
- Subscribe to events on
- Expect: Receive alarm condition events as value crosses thresholds
Manual alarm trigger
- Server:
opcua-no-security(4840) - Steps:
- Write
100.0toAlarms/AlarmSourceValue - Check
HighTemperatureAlarmstate
- Write
- Expect: Alarm is active in
HighHighstate
Acknowledge alarm
- Server:
opcua-no-security(4840) - Steps:
- Trigger an alarm (write extreme value)
- Read alarm's
EventId - Call
Acknowledgemethod - Verify
AckedStateistrue
7. Historical Data
Read raw history
- Server:
opcua-no-security(4840) - Steps:
- Wait 30 seconds after server start
- HistoryRead
Historical/HistoricalTemperaturewithReadRawModifiedDetails - Time range: last 30 seconds
- Expect: ~30 samples (recorded at 1000ms intervals), values oscillating around 22
Paginated history read
- Steps:
- Set
NumValuesPerNode = 10 - Read history
- Use
ContinuationPointto fetch next page
- Set
- Expect: First page has 10 values, continuation returns more
8. Security
All security policies
- Server:
opcua-all-security(4843) - Steps:
- Call
GetEndpoints() - Iterate through returned endpoints
- Connect with each policy/mode combination
- Call
- Expect: Successful connections for all valid combinations
Certificate rejection
- Server:
opcua-certificate(4842) - Steps:
- Connect with
certs/self-signed/cert.pem
- Connect with
- Expect:
BadCertificateUntrusted
Expired certificate
- Server:
opcua-certificate(4842) - Steps:
- Connect with
certs/expired/cert.pem
- Connect with
- Expect:
BadCertificateTimeInvalid
Legacy policies
- Server:
opcua-legacy(4847) - Steps:
- Connect with
Basic128Rsa15 / SignAndEncrypt - Connect with
Basic256 / Sign
- Connect with
- Expect: Both succeed (but your client should ideally warn about deprecated policies)
9. Extension Objects
Read custom structured type
- Server:
opcua-no-security(4840) - Steps:
- Browse to
ExtensionObjects/PointValue - Read the value
- Browse to
- Expect: ExtensionObject with TypeId
ns=3;i=3010, binary body containing{X: 1.5, Y: 2.5, Z: 3.5}
Write custom structured type
- Server:
opcua-no-security(4840) - Steps:
- Write a new
TestPointXYZvalue{X: 10.0, Y: 20.0, Z: 30.0}toExtensionObjects/PointValue - Read it back
- Write a new
- Expect: Value matches
{X: 10.0, Y: 20.0, Z: 30.0}
Read-only extension object
- Server:
opcua-no-security(4840) - Steps:
- Read
ExtensionObjects/RangeValue - Attempt to write a new value
- Read
- Expect: Read returns TypeId
ns=3;i=3011with{Min: 0.0, Max: 100.0, Value: 42.5}, write returnsBadNotWritable
10. Operation Limits
Read with node limit
- Server:
opcua-no-security(4840) -- configured withOPCUA_MAX_NODES_PER_READ=5 - Steps:
- Build a Read request with 10 node IDs
- Send the request
- Expect: Server rejects or limits the request (max 5 nodes per read)
Write with node limit
- Server:
opcua-no-security(4840) -- configured withOPCUA_MAX_NODES_PER_WRITE=5 - Steps:
- Build a Write request with 10 node IDs
- Send the request
- Expect: Server rejects or limits the request (max 5 nodes per write)
11. Browsing & Navigation
Recursive browse
- Server:
opcua-no-security(4840) - Steps:
- Start at
Objects/TestServer - Recursively browse all nodes
- Start at
- Expect: ~300 total nodes discovered
Deep nesting
- Steps:
- Browse
Structures/DeepNesting/Level_1 - Continue browsing deeper:
Level_2,Level_3, ...,Level_10 - Read
Depthat each level
- Browse
- Expect: 10 levels,
Depthvalues 1-10
Browse with view
- Steps:
- Get NodeId of
OperatorViewfromViewsfolder - Browse
TestServerwith that view
- Get NodeId of
- Expect: Only
Dynamic,Methods,Alarmsvisible
12. Access Control
Access level attributes
- Steps:
- Read
accessLevelattribute (ID=17) ofAccessControl/AccessLevels/CurrentRead_Only - Read
userAccessLevelattribute (ID=18)
- Read
- Expect:
accessLevel = CurrentRead,userAccessLevel = CurrentRead
Role-based write protection
- Server:
opcua-userpass(4841) - Steps:
- Connect as
viewer(viewer123) - Try to write to
AccessControl/OperatorLevel/Setpoint
- Connect as
- Expect:
BadUserAccessDenied3. Connect asoperator(operator123) 4. Write to the same variable - Expect:
Good
All type/access combinations
- Steps:
- For each type in
AccessControl/AllCombinations:- Read
_ROvariant ->Good - Write
_ROvariant ->BadNotWritable - Read
_WOvariant ->BadNotReadable - Write
_WOvariant ->Good - Read and write
_RWvariant -> bothGood
- Read
- For each type in
- Expect: 32 variables, all behave as documented
13. Discovery
Find servers
- Server:
opcua-discovery(4844) - Steps:
- Call
FindServers()onopc.tcp://localhost:4844
- Call
- Expect: List of registered servers (if any have registered)
Get endpoints
- Server: any server
- Steps:
- Call
GetEndpoints()on the server endpoint - Parse the response
- Call
- Expect: List of endpoint descriptions with security policy, mode, and auth tokens