Using the StreamBase Test Editor

Introduction

The Test Editor is StreamBase Studio's interface for creating unit test files. A unit test file is an XML representation of the various components that allow a StreamBase test to run the same way repeatedly. Unit test files are saved in the current project folder with the .sbtest extension.

Opening the Test Editor

The Test Editor opens automatically under the following circumstances:

  • You begin recording a test scenario with an application running, as described in Creating and Running StreamBase Tests. When the recording completes, the Test Editor opens so that you can complete the configuration of the test scenario just recorded.

  • You create a new, empty test file without an application running by invoking FileNewStreamBase Test. After specifying the target folder and test file name, the Test Editor opens.

  • You double-click the name of an existing test file in the Package Explorer.

The Test Editor window has four major sections:

Target Application Section

Use this section to identify the application to test. Applications specified here are presumed to be already running when the test starts, or specified in a test launch configuration that starts the application and test at the same time. The options are:

  • Default. Run this test against the application running at the time the test is run. Use this option to set up a test that can be run against several applications, or against more than one version of an application.

  • Specified Application File. Run this test against the specific application specified in this field.

  • Specified StreamBase URI. When this test runs, connect to the StreamBase Server instance at this URI, and run the test against the application running on that server.

Input Feed Simulations Section

Use this section to identify one or more feed simulation configuration files that will feed data to the test application's input streams while the test is running. This section has three buttons:

  • Add. Opens the Add Input Feed Simulations dialog, which allows you to select from the feed simulation files in the current project.

  • Edit. Opens the standard Feed Simulation editor to edit the selected feed simulation file.

  • Remove. Removes the selected feed simulation file from this test configuration.

Output Streams to Verify Section

Use this section to identify one or more output streams in the application specified above, as well as the expected schemas of those streams, and their test criteria. The left side of this section has three buttons:

  • Add. Opens the Add Output Stream to Verify dialog, which allows you to select from the streams in the application under test.

  • Edit. Opens the standard Schema editor to edit the selected output stream.

  • Remove. Removes the selected output stream from this test configuration.

The selected output stream is verified using the criteria in the Selected Output Stream Options area on the right side of this section. Select an output stream on the left to see the options on the right for that stream. The options are:

  • Data Validation File. The name of the CSV file containing the expected output of the selected stream. Validation CSV files created during a test recording are named from the test name plus the stream name. Validation CSV files that you create manually can have any name.

  • Ignore Field Character. A single wildcard character found in a CSV file value that matches any output from the stream. The default character is *.

  • Dequeue timeout (seconds). The acceptable duration for a successful dequeue operation. The default is 20 seconds.

  • Use Strict Schema Validation. The test framework compares output stream schemas in the target application to expected schemas defined in the test. The comparison can find more or fewer fields and data types in the target application, or an exact match. If this option is checked, the comparison test looks for an exact match between application and unit test schemas. If cleared, application schemas can have more or fewer fields than defined in the test without causing the test to fail.

  • Validate Tuple Ordering. If cleared, tuples can output in any order. As long as there is a match available in the validation CSV file, the test does not fail.

  • Map to sub-fields of tuple fields. Use this check box to specify that the fields of a flat CSV file are to be mapped to the sub-fields of tuple fields, not to the tuple fields themselves. This feature lets Studio read flat CSV files generated manually or generated by third-party applications such as Microsoft Excel, and lets Studio apply such files to schemas that have tuple fields. See Map to Sub-Fields Option for more on this subject.

Advanced Properties Section

Use this section to specify pre-test setup scripts and post-test cleanup scripts. Scripts are any script or program executable at the shell prompt of the operating system on which the test is run. The fields are:

  • Pre Test script. The script or program to be run before this test begins.

  • Post Test script. The script or program to be run after this test finishes.

  • Script timeout (milliseconds). Specifies how long to wait for either pre- or post- script to finish before continuing with the next step in the test.