The main goal of this project is to automate OPC UA server performance testing. The intention is not to provide a unit test framework for OPC UA.
Components in green are covered by this project. A http client can trigger new jobs, retrieve results. After requesting a new job, the TestService forks and executes the TestRunner. The TestRunner is a single threaded application, which parses the job configuration, connects to the OPC UA Server and executes the requests. After finishing the tests, a result file with json content is written.
On startup the testService will fetch the availabe test scripts from a github repo.
A job represents a single test run and executes a performance test script. The end user can implement performance test scripts with lua.
The following opc ua specific types / method calls are exposed to the sol2 lua script interpreter:
- Variant read(NodeId id): reads the value attribute of a node
- void write(NodeId, Variant value): writes to the value attribute of a node
- vector browse(NodeId id): browses the hierachical references of the given id
- vector call(NodeId objectId, NodeId methodId, vector inputArguments)
- wait: pauses the job execution for N milliseconds
- connect/disconnect: connects or disconnects from server
- EXPERIMENTAL loadNodeset: imports a nodeset (from scripts folder) and loads the datatypes
- EXPERIMENTAL VariantFromJson: creates a Variant from json string, needs the datatype loaded from nodeset
Todo - NOT IMPLEMENTED:
- readAttribute??
- subscribeToValueChanges
- subscribeToEvents
Per default all opc ua operations will check the statuscodes and throw an exception on error. The exception will not be catched by default, so the job will be marked as aborted.
Test scripts and configuration can be provided via a git repository. The URL of this repository can be specified as command line argument to the testService, e.g.:
testService https://github.com/matkonnerth/opcuaTestToolScripts.git
This arguments can also be passed to the docker run command.
There is a script called libOpc.chai. This script will be loaded before evalulation of the test script. The intention of this script is to refactor out common testing functionality.
Start influxDB sudo docker run -p 8086:8086 -v $PWD:/var/lib/influxdb influxdb
Start Grafana sudo docker run -d --name=grafana -p 3000:3000 grafana/grafana