sbtest

StreamBase Test Utility — runs a unit test defined in a StreamBase test file

SYNOPSIS

sbtest [-afile.sbapp|-uuri] [OPTIONS] [testfile.sbtest | directory-name]

DESCRIPTION

Note

The sbtest command is deprecated and will be removed in a future release. Use the sbunit command to run a StreamBase JUnit test class.

sbtest runs a unit test of a StreamBase application as defined in a StreamBase test configuration file. You can also specify the name of a test suite directory, which contains two or more test configuration files, plus the data input and validation comparison resources needed for those tests.

This command runs a StreamBase Test or Test Suite. Best practice is to use the sbunit command to run a StreamBase JUnit test class.

OPTIONS

-h, --help

Displays usage text.

-u[uri]

Specifies the URI of the StreamBase Server to communicate with, overriding the server URI, if any, defined in the test file. No space is allowed between -u and its argument. If a URI is not currently specified in the test file, you must specify -a without an argument to remove the application setting at the same time.

Without an argument, -u ignores the current URI setting in the test file and requires -aapplication.sbapp on the same command line.

See the sburi page of the Reference Guide (or see sburi(5) at the UNIX shell prompt) for a discussion of the URI format and its shortcuts. The URI can also be set using the STREAMBASE_SERVER environment variable.

-a[file.sbapp]

Specifies an EventFlow or StreamSQL application file to run the test against, overriding the application, if any, defined in the test file. No space is allowed between -a and its argument.

If an application name is not currently specified in the test file, you must specify -u without an argument to remove the URI setting at the same time.

Without an argument, -a ignores the current application setting in the test file and requires -usb://host:port on the same command line.

-f config-file

Specifies an sbd.sbconf configuration file to use when running the test.

-Jjvm-option

Specifies a system property setting or other JVM argument to be passed to the JVM that runs this sbtest command. Use this option to specify temporary settings that affect only the current invocation of sbtest. You must specify multiple -J options to specify multiple JVM arguments.

There must be no space after the -J. For example, specify -J-Xmx2G. Use the full option syntax for jvm-option that you would use at the Java command line, including the initial hyphen. For example, specify -J-Dstreambase.log-level=2 to increase the log level for this invocation of sbtest.

Your jvm-option argument might require surrounding quotes, depending on the characters it contains and the shell you are using. However, do not use quotes to escape the spaces between separate JVM arguments; instead use separate -J options. For example: -J-Xms512M -J-Xmx2G

--version

Prints version information and exits.

EXAMPLES

Run the test file named tradeapp.sbtest, which specifies an application name and server URI:

sbtest tradeapp.sbtest

Run the same test file, but override the server URI specified in the test file:

sbtest -usb://localhost:9900 tradeapp.sbtest

Run the same test file, but override the application specified in the test file, instead running tradetest.sbapp:

sbtest -atradetest.sbapp tradeapp.sbtest

Another test file named uri-noapp.sbtest specifies a server URI, but does not specify an application name. You can run this test against an application named with -a, but you must override the test file's URI at the same time with an empty -u. In this case, the default URI is used, unless you specify a URI in a server configuration file:

sbtest -u -atradetest.sbapp -f sbd.sbconf uri-noapp.sbtest

A third test file named app-nouri.sbtest specifies an application name, but does not specify a server URI. You can run this test with a URI specified with -u, but you must also override the test file's application name at the same time with an empty -a. In this case, specify the application to test in a server configuration file:

sbtest -a -usb://sbhost:9500 -f sbd.sbconf app-nouri.sbtest

Run all the test configuration files in the directory suitefolder on the server instance at port 9900 of the current host:

sbtest -usb://localhost:9900 /home/sbuser/suitefolder

FILES

sbtest requires at least one StreamBase test configuration file, which usually has an .sbtest extension. The test file is typically generated in StreamBase Studio, either by recording a running application in test mode, or by editing a test scenario with the Test Editor. See Using the StreamBase Test Editor in the Test/Debug Guide for more information.

ENVIRONMENT

STREAMBASE_SERVER

Optional. Contains the URI for a StreamBase Server instance. Use this variable to set a default StreamBase URI for StreamBase commands that take the -u option. If set, commands use the URI in this variable, overriding their built-in default URI, which is sb://localhost:10000. If this variable is set, you must use the -u option to communicate with any server other than the one specified in this variable. See the sburi page in the Reference Guide for more on StreamBase URIs.