Jump to content
  • Functional Unit Testing with Spotfire® Streaming


    Spotfire® Streaming JUnit Tests

    StreamBase® EventFlow and StreamSQL applications may be functionally unit-tested with StreamBase JUnit Tests, the framework for which is built into the delivered product.

    StreamBase JUnit testing is also covered in a unit of the Spotfire® Education TSB401 class.

    Spotfire® Streaming JUnit Tutorial

    • StreamBase JUnit tutorial videos are here and here.
    • The project created during the first tutorial video is attached to this page as sb_unit_tutorial.zip
    • Outline of the tutorial

    Spotfire® Streaming JUnit Test Extensions

    While the productized StreamBase JUnit Test framework has much to recommend it, it has some limitations when creating test suites for applications that have streams that have schemas with large numbers of fields and that may change over the lifetime of the tested application. Specifically, the productized StreamBase JUnit does whole tuple content comparisons, always. Most unit tests are only interested in the contents of a small number of fields and don't care about the contents or even the existence of the other fields. It is helpful to be able to ignore the contents of some fields, especially when they contain values such as timestamps that may be different every time the test is run. Since the whole tuple contents is always specified to the Expecters, if fields are added or deleted, tests that check for specific schemas will break and have to be maintained by hand whenever the schemas are modified. Unit test maintenance can therefore become an expensive undertaking. 

    Therefore, the StreamBase JUnit Test Extensions provide an additional set of Expecters and a number of Matchers that make it possible to create tests that are less sensitive to schema changes over time.

    Further, the Extensions use a fluent style of Java programming that some developers find very concise and natural.

    One tradeoff of using the Extensions versus the productized framework is that there is a wizard in StreamBase Studio that will automatically generate a test class from a manual test. The Extensions do not provide a wizard. Some developers will use the wizard to create a test class automatically, and then go modify the generated class to use the Extension Expecters and Matchers.

    Whichever of these packages you decide to use, the important thing is to use something to created an automated functional regression suite, and to start doing so from the very beginning of project implementation.

    The Extensions are not Spotfire® product, and available on the StreamBase Component Exchange.

    The latest source code is available at https://github.com/streambase/SBUnit-Extensions.  Use the 7.6 branch for all releases of StreamBase 7.6.0 and higher, until there is a newer branch. We don't make a new branch of the Extensions until there is something incompatible in the product releases that force a change in the Extensions source.

    The StreamBase JUnit 102 Outline document is an outline of a tutorial session about the Extensions, attached below as sb_junit_102_training_outline.pdf

     Also attached below is sb_unit_102_tutorial.zip, an importable StreamBase Studio project that supports this tutorial session.

    sb_unit_tutorial.zip

    sb_unit_102_tutorial.zip

    sb_junit_102_training_outline.pdf


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...