Designing Glassbox Tests and Failure focused Tests using Byteman

There is one thing that always intrigued me, the absence of tools that supported the design of GlassBox tests and tests that focused on failure scenarios up to the point that I ever thought about starting my own open source project but recently I stumbled upon Byteman project from JBoss.
The project description on the project site states that Byteman is:

Byteman is a bytecode injection tool which simplifies development of tests for Java applications using a technique called fault injection. Byteman works by inserting scripted side effects into application code, Test scripts may include actions which create and propagate conditions appropriate to the test scenario. Or they may simply verify correct execution of the application program.

Byteman has a good list of pros:

  • Powerful Scripting Language
  • Possibility of adding and updating the Scripts for code modification at runtime
  • Simple Java class for uploading scripts to a running JVM which makes it easy for integrating script updates into a JUnit test

I started to test the tool today and I can say that the first impression was incredible. I agree that the scripting syntax may improve a little (eg.: every rule has to have an IF what forces you to use IF true sometimes) but this can’t be considered an impeditive problem.
I’ll try to post here some examples of its usage.


3 Responses to “Designing Glassbox Tests and Failure focused Tests using Byteman”

  1. June 25, 2010 at 3:24 pm

    Hi Rafael,

    I’m the project lead (and about 90% of the project team 🙂 for Byteman. I am glad to hear you were impressed with what it does. Have you had a chance to try it out properly yet? I’d be interested in any feedback and happy to consider suggestions for new or improved functionality. Hope you enjoy version 1.3.0 just released today.


    Andrew Dinn

    • June 25, 2010 at 8:56 pm

      Hi Andrew,

      Unfortunately on the particular project that made me search for such a solution we were using WebSphere 6.1 and therefore locked to a JVM 1.5… as I dont like to giveup easily I still tried to hack byteman to make it work on 1.5 but I soon found that it was impossible but I am still looking for a chance to use it properly on a project. I really feel like it gives a great oportunity to test alternate flows on use cases such as error conditions… something that is usually mistested on a software… and it isn’t any surprise it is mistested… in fact it is really hard to inject error conditions without the help of a tool as Byteman.
      I’ll let you know anything as soon as I have any chance to use it on a project.

      best regards,
      Rafael Ribeiro

    • April 20, 2013 at 7:57 pm

      Hi Andrew!

      I just attended to an awesome presentation at JUDCon 2013 in where Flavia from JBoss team presented byteman usage on testing race conditions at JBoss AS. I had the impression that a lot of things has been done since I last saw it in 2010 isn’t it?

      best regards,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


Blog Stats

  • 367,566 hits since aug'08

%d bloggers like this: