My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

The Problem

Writing tests for JavaBeans™ is...

  • repetitive,
  • boring,
  • time-consuming, and
  • error-prone.

However, we often build larger systems on top of JavaBeans™, so we need to be sure they're behaving correctly. What's more, if our project uses a code-coverage threshold, our build will fail if we don't test them.

The Missing Point

JavaBeans™ are supposed to be machine-processable!

The Solution

JavaBeanRunner automatically tests your JavaBean properties using the power of !JUnit.

Writing tests with JavaBeanRunner is...

  • fast,
  • efficient, and
  • reliable.

Writing tests for a bean can be done in only a few lines of code, using only a couple of simple annotations. Moreover, JavaBeanRunner will automatically fail if you add new, untested, properties to your bean.

Example

To test this simple bean:

public class Bean {
    private String name;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

You need only write the following test code:

@RunWith(JavaBeanRunner.class)
@Bean(Bean.class)
public BeanTest {
    @Property("name")
    public String name = "name";
}

Resources

Powered by Google Project Hosting