Version 11

    Byteman is a fault injection tool which was developed to help automate running of crash recovery tests for the JBossTS Web Service Transactions code. The code is available from the Byteman project page under the LGPL.

     

    Bytreman uses the Java agent package (java.lang.instrumentation) and the ObjectWeb ASM bytecode manipulation library to insert side effects or synthetic throws/returns at chosen 'trigger' points in application or JVM method code. Side effects are scripted using a simple Event Condition Action (ECA) rule language. Byteman rules can be used to force 'wrong' or 'unexpected' behaviours to occur and to trace subsequent execution. More complex rule sets may propagate further side effects which ensure that execution of the test application follows the desired path.

     

    Byteman's ECA rule language provides a simple, structured way to introduce side-effects into test code without the need to modify or recompile it. Byteman rule events specify a trigger point, a location in the source code. The event may also bind objects in scope at the trigger point to variables which can be referenced by the rule's condition and action. When control reaches the trigger point the rule's condition is evaluated to decide whether to fire the rule. If the condition is true then the rule is fired by executing each of its actions. Rule conditions and actions can include arbitrary invocations of Java code including Byteman's own builtin calls.

     

    Byteman is particularly oriented towards dealing with the problems involved in convincing non-deterministic, multi-threaded code to run in a reliable and repeatable manner. So, the rule language provides a suite of builtins which can be invoked from conditions or actions to orchestrate thread execution. These builtins implement operations such as delays, waits and notifies, countdowns, rendezvous, etc and can be used to make sure that events in the thread's life cycle happen with the desired timings or orderings. However, the tool is more general than this.

     

    Firstly, arbitray Java code can be invoked from conditions or actions, including methods of application objects bound by the event. So, even if you are just interested in running a simple single-threaded test Byteman provides a very flexible means of scripting errant and aberrant behaviours in arbitrary application and/or JVM code and managing and tracing subsequent execution.

     

    Secondly, the Byteman script language is very easily extensioble and redefinable. The default built-in operations can be extended or redefined merely by providing a POJO (plain old java object) to implement the desired behaviour. This allows you to encapsulate common operations which need to be performed in many different rules  in a simple API. It also means that operations specific to your test domain, such as standard validation checks, can appear as standard operations in your scripts, keeping rules minimal, clear and comprehensible.

     

    Source and binary releases for Byteman are available from the project downloads page. There is also a user forum and a JIRA for reporting and tracking issues. Check out the README which explains the basics of how to use, build and run the tool plus a more complete user guide. Byteman is now available for general release.