We recently announced support for continuous performance management via an extension to our resource metering runtime that transparently injects named assertions (defined externally in a configuration file) into unit test classes (JUnit or TestNG).  

If you look at the screenshot accompanying the update announcement you will have noticed that there was no evidence of any code changes as it is all down under the covers at load-time using byte code instrumentation. But did you know that you can in fact use both transparent instrumentation & measurement with explicit assertions.

A reason to use explicit assertions would be to use more elaborate expressions than the configuration based threshold expressions.

Below is an example of  using transparent measurement (resource metering) with explicit performance related assertions. An additional performance test method (testDBTime) has been created which executes the functional test method (testBD) a number of times to get an average timing. To handle the case of a GC cycle (caused possibly by previous test executions) perturbing the test the assertion discounts GC time from the clock time measure (meter).

Note: The actual measurement (metering) of the functional test method is performed by byte code inserted at load-time.

assertman11

Note: The time reported above would have caused the clock time assertion to fail if we had not discounted the gc time that occurred because of the repeated allocation of BigDecimal objects.

If there is only one test method executing concurrently you can simplify the code above by using our marking facility to track the resource metering delta caused by the transparently injected instrumentation.

Note: The actual measurement (metering) of the functional test method is performed by byte code inserted at load-time.

assertman21

Finally you can simply use both our consumer and producer aspects of our open API to manually insert instrumentation and assertions.

Note: The name used in creating the measurement probe below is arbitrary. I have used the same name that would be created by the load-time byte code instrumentation.

assertman3

Note: Using the same open API above you can easily create a custom dashboard within your own web application that offers a simpler performance management and problem diagnostic view on our resource metering data available in our award winning management console.