Sim Tester - AspectJ Usage

There is a programming paradigm, called Aspect-Oriented Programming (AOP), which promises to be an exciting step forward from Object-Oriented Programming (OOP), just as OOP was an exciting and important step forward from structural programming. There is a set of extensions that bring AOP to Java known as AspectJ, which has been used in the Sim Tester in a limited way.

Where It's Used

AspectJ is used in the Sim Tester for logging purposes only. It was used to write the ctf.evaluation.TestSuccess aspect, which comes into play:

  1. At the beginning of each test, where it prints the test name
  2. If a test throws an exception at any point, where it prints the exception
  3. At the end of each successful test, where it prints "test complete"

Using AOP simplified #1 and #3, and made #2 possible.

How To Run It

In order to run the Sim Tester as supplied (with the AspectJ extensions), you must have the aspectjrt.jar file in the same directory as sim-tester.jar. This is not a problem, however, as it is supplied on the course website, along with junit.jar and ctf-tools.jar

How To Compile It

When writing your own tests, you may disregard the AspectJ parts completely. The Java compiler will ignore .aj files (where Aspects live), and the only difference you will see is the loss of the logging features mentioned above. All of this information, however, can be seen through the JUnit UI.