NAME
OPCUA::Open62541::Test::Server - run open62541 server for testing
SYNOPSIS
use OPCUA::Open62541::Test::Server;
use Test::More tests => OPCUA::Open62541::Test::Server::planning();
my $server = OPCUA::Open62541::Test::Server->new();
DESCRIPTION
In a module test start and run an open62541 OPC UA server in the background that can be connected by a client. The server is considered part of the test and will write to the TAP stream.
- OPCUA::Open62541::Test::Server::planning
-
Return the number of tests results that running one server will create. Add this to your number of planned tests.
METHODS
- $server = OPCUA::Open62541::Test::Server->new(%args);
-
Create a new test server instance.
- $args{timeout}
-
Maximum time the server will run before shutting down itself. Defaults to 10 seconds. Can be turned off with 0, but this should not be used in automatic tests to avoid dangling processes.
- $args{singlestep}
-
If set, we pause before calling run_iterate(). To iterate, the test has to call step() to signal the server to continue.
- DESTROY
-
Will reap the server process if it is still running. Better call stop() to shutdown the server and check its exit code.
- $server->port($port)
-
Optionally set the port number. If port is not given, returns the dynamically chosen port number of the server. Must be called after start() for that.
- $server->start()
-
Configure the server.
- $server->step()
-
Will let the server continue and call run_iterate() if started with singlestep.
- $server->run()
-
Startup the open62541 server as a background process. The function will return immediately.
- $server->stop()
-
Stop the background server and check its exit code.
SEE ALSO
OPCUA::Open62541, OPCUA::Open62541::Test::Client, OPCUA::Open62541::Test::Logger
AUTHORS
Alexander Bluhm <bluhm@genua.de>,
COPYRIGHT AND LICENSE
Copyright (c) 2020 Alexander Bluhm
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Thanks to genua GmbH, https://www.genua.de/ for sponsoring this work.