to Overview
Mai 29, 2017

Testrecorder – Next Steps

After Presenting at Karlsruher Entwicklertag it is time to write a few words about the future of Testrecorder … Testrecorder is a Java tool vor recording runtime situations. Recording means, that we intercept method invocation and capture the state before and after the invocation. From this captured state we generate JUnit-tests.

How is state recorded with Testrecorder?

Before and after an annotated method, following state is written:

  • the invocations arguments
  • the invocations return value
  • the this object
  • global variables
  • input and output occuring during the invocation
  • exceptions

Based on this state we generate tests. To do this we use:

  • generic adaptors, which are able to represent almost any java object in test code (yet it might not necessarily be comfortable to read)
  • special adaptors, associated to common programming concepts, generating more readable code, such as:
  • preferring object contruction via constructors
  • preferring object construction via setters
  • preferring the construction of arrays, lists, sets or maps with factory methods or adders/putters

How will Testrecorder evolve?

Continuously ideas come into my mind how I could optimize Testrecorder. The current milestones are:

  • separation of serialization of state and generation of tests
  • better readable tests
  • better support for very large data objects

Where can I find more of Testrecorder?

The current release of Testrecorder can be found on the Project’s Homepage. There one may find even some documentation and links to examples. Whoever is interested in an interactive introduction: I plan to present Testrecorder at local conferences in presentations and workshops. I will announce the next date in this blog.

What about alternatives to Testrecorder - also in other programming languages?

For Java I found some promising approaches. Yet there seems to be a proprietary tool, from which I do not know whether it does the job. The following open source approaches seem not to be under active development:

For .NET I also found an interesting tool, yet I do not know whether its features are stable:

I would be very interested in tools for Javascript. Yet I did not find any - and I am quite certain that the complexity of a dynamic language like Javascript, is not easy to handle for both serialization and test generation.