Theory-infected: Or How I Learned To Stop Worrying And Use Unit Theories in JUnit 4

David Saff (MIT)

Java · Long Talk

Wednesday, 10:10, 50 minutes | Room 207 | Download in iCal Format

7
·
8
·
9
·
10
·
11
·
12
·
13
·
14
·
15
·
16
·
17
·
18
·
19

Writing developer tests as software is built can provide peace of mind. As the software grows, running the tests can prove that everything still works as the developer envisioned it. But what about the behavior the developer failed to envision? Although verifying a few well-picked scenarios is often enough, experienced developers know bugs can often lurk even in well-tested code, when correct but untested inputs provoke obviously wrong responses. This leads to worry.

JUnit now allows writing unit theories alongside unit tests, to specify desired universal behaviors. For example, when writing a date and time library, we can write a theory stating that adding an hour to any TimePoint produces a later time:

	@Theory
	public void laterDateIsAfter(GlindaTimePoint a) {
		assertThat(a.plus(hours(1)), after(a));
	}

We will demonstrate how writing theories affects test-driven development, how new features in JUnit can verify theories against hand-picked inputs, and how a new tool, Theory Explorer, can search for new inputs, leading to a new, less worrysome approach to development.

David Saff is a Ph.D. student at the Massachusetts Institute of Technology, researching continuous testing, test factoring, and unit theories, all automated techniques to extend the bug-finding power of simple tests. David's previous research includes work on artificial intelligence, intuitive user interfaces, and computing with small distributed devices. Before joining MIT, David was a software engineer and project manager at Molecular, Inc. In addition to his research activities, David is a developer for the JUnit unit-testing framework, and has contributed to the testing capabilities in the Eclipse IDE.

Floor Plan

Gold sponsors

BEA logo

IBM logo

Wind River logo

Replay Solutions logo

JBoss logo

SOPERA logo

Cloudsmith logo

BIRT Exchange logo

Skyway Software logo

Oracle

BlackBerry logo

AMD logo

Silver sponsors

Sybase

Google

Genuitec

Instantiations

Teamprise

Telelogic

Innoopract

Business Objects

LynuxWorks logo

Hardware sponsor

AMD logo

Media sponsors

Extension Media

Methods and Tools

ACM

Addison-Wesley logo

SD Times logo

Open Systems Publishing

Software Test & Performance logo

SDForum

Be a Sponsor