Last updated January 02, 2012 20:38, by Jørgen Austvik
Feedicon  

Extending JET

Some times you need to extend JET to make it fit your needs. JET and JETBatch use a plugin architecture that lets you add functionality to JET without changing the core.

Plugin Architecture

Pligins in JET are read from the configuration files, that can be passed in to JET or JETBatch, placed in the default configuration files, or sent to Java with -D switched.

In JET, a plugin has at least two properties:

  some.start.plugin_name.class=class name
  some.start.plugin_name.enabled=true or false

When JET look for plugins, it will try to find all plugins with the same start in the property name (above: "some.start"). For each unique name after that (here "some_name"), it will look for ".class" and ".enabled". If ".enabled" is "true", it will use the configured plugin class when it runs. If you configure the plugin it is your responsibility to make sure that the plugin is in JET or JETBatch classpath when it should be run.

If you have more properties with the same name, these will be sent to the plugin which can read them. Example:

  some.start.plugin_name.foo=bar
  some.start.plugin_name.baz=123

If you want to know all the details, take a look at com.sun.jet.util.plugin.PluginEngine.java and the unit test for it.

Common Plugins

These plugins are supported by both JET and JETBatch

com.sun.jet.util.bindings

These plugins are used to verify that bindings that are set and read have legal values (to make fewer spelling mistakes).

Class Parameter Description
com.sun.jet.util.bindings.JETBindingsValidator Validates standard JET bindings

jet.loghandler

Describes what to do with logs of different levels.

Parameter Description
name The name of the result file
level The minimum level of logs to be placed in this file
logger The packages that will be placed in this file

Software Plugins

These plugins are run during reporting, to get information about the software that has been running.

There are three types of these plugins:

  • jet.software.host.plugin
  • jet.software.test.plugin
  • jet.software.general.plugin

The jet.software.host.plugin plugins report software that is special for a given host, this can e.g. be version information about the operating system running on the host.

The jet.software.test.plugin plugins report information about the test software that is used to run this test.

The jet.software.general.plugin plugins report information about any software you configure it to. Examples are Java, databases, application servers, and the software under testing.

Product Plugins

The product plugins inherits com.sun.jet.util.software.ProductPlugin and returns lists of BuildInfo and SoftwareInfo. Imiplement these to get the version numbers you run tests against into the XML reports.

The jet.report.product.plugin setting can be used to add more plugins.

Annotations

These plugins add annotations on the XML report on either the <report> or the <report>-<testsuite> level.

You need to create a class that implement the com.sun.jet.util.annotations.AnnotationsPlugin interface, and implement the Map<String, String> getAnnotations(Bindings bindings) method.

To get annotations on the report level, use the jet.report.annotations.plugin configuration parameter, to get them on the testsuite level, use the jet.report.annotations.plugin.testsuite.

JET Plugins

These are the plugins that JET supports.

jet.report.plugin

This plugin is run after each JET test, and generate reports based on the result of the test run.

Class Parameter Description
com.sun.jet.framework.engine.report.XMLReport Generates XML output that describes the test result to a file
filename The filename to store the result in
com.sun.jet.framework.engine.report.TextFileReport Generates output that describes the test result to a plain text file
filename The filename to store the result in
com.sun.jet.framework.engine.report.ConsoleReport Generates output that describes the test result, and prints it to STDOUT
com.sun.jet.framework.engine.report.TAPReport Generates Test Anything Protocol output that describes the test result to a file
filename The filename to store the result in
com.sun.jet.framework.engine.report.JUnitReport Generates JUnit XML output that describes the test result to files
path The path to store the XML files in
com.sun.jet.framework.engine.report.MetricReport Generates files with single metric values - e.g. for reports in Jenkins
metrics Comma separated list of metrics to store
path The path to store the files in

JETBatch

jetbatch.report.plugin

This plugin generate reports from JETBatch after all the tests are run

Class Parameter Description
com.sun.jet.batch.report.XMLReport Generates XML output that describes the test results to a file
filename The filename to store the result in
com.sun.jet.batch.report.TextFileReport Generates text output that describes the test results to a file
filename The filename to store the result in
skipjunitintro Skip lines from JUnit in the stack trace (true/false)
stacktracemax The maximum number of lines in the stacktrace (-1 = unlimited)
warnings Include warnings in the output
sucesses Include successes in the output
com.sun.jet.batch.report.ConsoleReport Generates text output to STDOUT
skipjunitintro Skip lines from JUnit in the stack trace (true/false)
stacktracemax The maximum number of lines in the stacktrace (-1 = unlimited)
warnings Include warnings in the output
sucesses Include successes in the output
com.sun.jet.batch.report.EMMACoverageReport Generates EMMA code coverage reports
com.sun.jet.batch.report.MailReport Sends out text reports as e-mail. You can configure several if you want different settings for different receivers.
smtp.host SMTP host to send e-mails to
smtp.port SMTP port to send e-mails to
to Comma separated list of receiver e-mail addresses
from E-mail address the mail is sent from
subject.date Show date in e-mail subject (true/false)
subject.result Show result of test run in subject line (true/false)
skipjunitintro Skip lines from JUnit in the stack trace (true/false)
stacktracemax The maximum number of lines in the stacktrace (-1 = unlimited)
warnings Include warnings in the output
sucesses Include successes in the output
com.sun.jet.batch.report.TAPReport Generates Test Anything Protocol output that describes the test result to a file
filename The filename to store the result in
com.sun.jet.batch.report.JUnitReport Generates JUnit XML output that describes the test result to files
path The path to store the XML files in
com.sun.jet.batch.report.MetricReport Generates files with single metric values - e.g. for reports in Jenkins
metrics Comma separated list of metrics to store
path The path to store the files in
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close