Exemplars

Sureassert UC provides a suite of open-source annotations designed to effectively unit test your software without the need for writing separate test harness code such as that used with JUnit. This is cheifly enabled by the @Exemplar annotation (or if you prefer, @UseCase).

Features

  • Define exemplar inputs, expected outputs and stubs on your method contracts
  • Automatic intelligent test execution by the UC Engine enforces your method contracts by running tests affected by changed code
  • Automatic test context dependency management
  • Annotate either the method itself or it’s interface or super-class: Exemplars are inherited
  • Debug your Exemplar-annotated methods using standard Eclipse Debug As->Sureassert UC
  • Run your workspace through the UC Engine from the command-line (within Equinox container)
  • Exemplar test results and failures automatically marked against your methods and in the Problems View just like compilation errors
  • Name your Exemplars and use them as inputs and in assertions elsewhere
  • Build arrays, Lists, Sets, Maps and read data files without code within your Exemplars for use as test inputs or in asserting results
  • Add behaviour verification without the need to code mock objects
  • Force private internal state of created Objects to easily setup desired test conditions
  • Call out to methods defined anywhere in your workspace and libraries to build inputs and assert results
  • Use default implementations of interfaces and abstract classes generated under-the-covers and stub them on-the-fly for your tests

Examples

Background

The most discrete physical modules of functionality within a Java software system are implemented as methods.

Sureassert Exemplars (or Use Cases) are designed to strengthen the contract of each method by defining exemplar inputs for the functional module and asserting the expected result.  The Sureassert UC Engine for Eclipse automatically tests the pre-conditions, post-conditions, invariants and implementation of your methods whenever you save changes that may affect the result.

Methods that invoke other methods that perform functionality not available in a development context can be seen as invoking external system actors such as calls to remote components.  Sureassert UC provides several means of stubbing these invocations to isolate the method under test from external dependencies.

 

Comments are closed.