Since we wrote this post we didn't laze around. Check our latest announcement.
The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian Extension Byteman component!
We’re happy to announce the first release of the Arquillian Byteman marriage.
Byteman is a tool which simplifies tracing and testing of Java programs. Byteman allows you to insert extra Java code into your application, either as it is loaded during JVM startup or even after it has already started running. The injected code is allowed to access any of your data and call any application methods, including where they are private. You can inject code almost anywhere you want and there is no need to prepare the original source code in advance nor do you have to recompile, repackage or redeploy your application. In fact you can remove injected code and reinstall different code while the application continues to execute.
When testing your application you can use Byteman to inject faults or synchronization code, causing your application to perform unusual or unexpected operations required to exercise a test scenario.
In this release we added support the @BMRule(s)
annotation on Class
and Method
level.
@RunWith(Arquillian.class)
@BMRules(
@BMRule(
name = "Throw exception on success",
targetClass = "StatelessManagerBean",
targetMethod = "success",
action = "throw new java.lang.RuntimeException()")
)
public class BytemanFaultInjectionTestCase {
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(WebArchive.class)
.addClasses(StatelessManager.class, StatelessManagerBean.class);
}
...
}
@Test(expected = EJBException.class)
@BMRule(
name = "Throw exception on success",
targetClass = "StatelessManagerBean",
targetMethod = "success",
action = "throw new java.lang.RuntimeException()")
public void shouldBeAbleToInjectMethodLevelThrowRule()
{
Assert.assertNotNull("Verify bean was injected", bean);
bean.success();
}
See the Byteman Website for more on how to write rules.
Before we reach the final release we are planning to bring @BMScript
annotation and manual installment of rules during test execution.
What is Arquillian?
Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.
Release details
Published artifacts
org.jboss.arquillian.extension
-
org.jboss.arquillian.extension
»
arquillian-extension-byteman
jar
javadoc
pom
Release notes and resolved issues
2
Simple support for Rules annotations
- Feature Request
-
- ARQ-348 - Create a Byteman integration
Thanks to the following list of contributors:
Aslak Knutsen