msbarry/Xtest — Issue #11: Test double support
Author: msbarry
Created: 2012-03-02 13:05:50+00:00
State: open
Labels: enhancement

Add the ability to create new classes/subclasses/anonymous inner classes in xtest in order to provide test doubles to software under test. This could perhaps be a scripting layer that sits on top of an exsting mock-object framework like JMock or EasyMock, since we can create our own syntax and are not limited to java's this could provide a very simple and intuitive way to stage mock objects. For example:

val a = mock(List) {
add("abc") => true
remove(*) => throw new IndexOutOfBoundsException()
}
sut.useList(a)

Until then, you can write mock/spy/dummy java classes adjacent to the xtest files being run.