8.2. Declarative JUnit Test Class Association

JUnit does not enforce any declaration of association between unit tests and the code-under-test, or test classes and classes-under test. Sureassert UC includes the @HasJUnit annotation for achieving this. This annotation is placed on a project class to associate it with the JUnit class (or classes) that tests it. By doing this, you are explicitly defining the association between a project class and one or more test classes. You can then Ctrl+click the JUnit class name on any annotated class to navigate to its JUnit test class(es).

By defining this association, you allow Sureassert to execute the associated test class whenever the class-under-test, or any dependant classes, are changed (on save). This allows Sureassert to treat JUnits for a given class in the same way it treats Exemplars defined within the class itself. Error markers will be added to the test class and/or class-under-test (depending on the location of the error) where a test in the associated JUnit fails.

Previous Page   |   Next Page   |   Table of Contents

Comments are closed.